MCPcopy Create free account
hub / github.com/NVIDIA/MatX / scope_okay

Function scope_okay

examples/python_integration_sample/example_matxutil.py:22–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21# Demonstrate cupy array stays in scope when returning valid dlp
22def scope_okay():
23 a = cp.empty((3,3), dtype=cp.float32)
24 a[1,1] = 2
25 dlp = a.__dlpack__()
26 assert(matxutil.check_dlpack_status(dlp) == 0)
27 return dlp
28
29#Do all cupy work using the "with stream" context manager
30stream = cp.cuda.stream.Stream(non_blocking=True)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected