Пример #1
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of g.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    i = Future(return_void(), value_type=legion.void)
    print("value of i.get() is %s" % i.get())

    j = return_void()
    print("value of j.get() is %s" % j.get())

    show(f)
    show(g)
    show_buffer(h)

    show_nested(f)

    for i in legion.IndexLaunch([3]):
        show_index(i, f)
Пример #2
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of g.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    i = Future(return_void(), value_type=legion.void)
    print("value of i.get() is %s" % i.get())

    show(f)
    show(g)
    show_buffer(h)

    show_nested(f)

    for i in legion.IndexLaunch([3]):
        show_index(i, f)
Пример #3
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of f.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    show(f)
    show(g)
    show_buffer(h)