You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using numpy 2.0.2 and cuda-core 0.1.1. I cannot successfully convert a numpy array into a StridedMemoryView. My understanding is that this should be possible because numpy arrays implement the dlpack interface.
importnvmath# used to patch cupy imports of nvidia-wheelsimportnumpyasnpimportcuda.core.experimentalasccximportcupyascpimporttorchhost_array=np.ones(50)
device_array=cp.ones(50)
device=ccx.Device()
device.set_current()
torch_array=torch.ones(50)
stream=device.create_stream()
# StridedMemoryView cannot wrap NumPy arrays because of impossible constraints on the# stream_ptr parameter.# Try 1: Provide a valid stream pointerprint(host_array)
wrapped_host_array=ccx.utils.StridedMemoryView(host_array, stream_ptr=stream.handle)
# RuntimeError: NumPy only supports stream=None.print(wrapped_host_array)
# Try 2: Provide no stream pointerprint(host_array)
wrapped_host_array=ccx.utils.StridedMemoryView(host_array, stream_ptr=None)
# BufferError: stream=None is ambiguous with view()print(wrapped_host_array)
print(torch_array)
wrapped_torch_array=ccx.utils.StridedMemoryView(torch_array, stream_ptr=None)
# BufferError: stream=None is ambiguous with view()print(wrapped_torch_array)
# The following workprint(torch_array)
wrapped_torch_array=ccx.utils.StridedMemoryView(torch_array, stream_ptr=stream.handle)
print(wrapped_torch_array)
torch_array=torch_array.to('cuda')
print(torch_array)
wrapped_torch_array=ccx.utils.StridedMemoryView(torch_array, stream_ptr=stream.handle)
print(wrapped_torch_array)
print(device_array)
wrapped_device_array=ccx.utils.StridedMemoryView(device_array, stream_ptr=stream.handle)
print(wrapped_device_array)
The text was updated successfully, but these errors were encountered:
I'm using numpy 2.0.2 and cuda-core 0.1.1. I cannot successfully convert a numpy array into a StridedMemoryView. My understanding is that this should be possible because numpy arrays implement the dlpack interface.
The text was updated successfully, but these errors were encountered: