MCPcopy Create free account
hub / github.com/apache/tvm / create_nvshmem_array

Function create_nvshmem_array

tests/python/tirx/codegen/test_codegen_nvshmem.py:49–62  ·  view source on GitHub ↗

Create and optionally initialize an nvshmem-accessible DNDArray.

(sess, shape, dtype, init_data_fn=None, zero_out=True)

Source from the content-addressed store, hash-verified

47
48
49def create_nvshmem_array(sess, shape, dtype, init_data_fn=None, zero_out=True):
50 """Create and optionally initialize an nvshmem-accessible DNDArray."""
51 nvshmem_empty = sess.get_global_func("runtime.disco.nvshmem.empty")
52 arr = nvshmem_empty(ShapeTuple(shape), dtype, None)
53
54 if init_data_fn:
55 for i in range(NUM_WORKERS):
56 arr.debug_copy_from(i, init_data_fn(i, shape, dtype))
57 elif zero_out:
58 zero_data = np.zeros(shape, dtype=dtype)
59 for i in range(NUM_WORKERS):
60 arr.debug_copy_from(i, zero_data)
61
62 return arr
63
64
65@pytest.mark.gpu

Callers 4

test_transferFunction · 0.85
test_signal_opFunction · 0.85
test_put_signalFunction · 0.85
test_fence_barrierFunction · 0.85

Calls 3

get_global_funcMethod · 0.80
debug_copy_fromMethod · 0.80
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…