NVIDIA / cuda-python

CUDA Python Low-level Bindings
https://nvidia.github.io/cuda-python/
Other
809 stars 63 forks source link

`cudart.cudaMemset` should take a device pointer, but doesn't #58

Closed fjwillemsen closed 1 month ago

fjwillemsen commented 3 months ago

According to the documentation, cudart.cudaMemset should take a device pointer as first argument. However, with version 12.3.0 on Python 3.11.7, this results in the following error: TypeError: Provided argument is of type <class 'cuda.cuda.CUdeviceptr'> but expected Type <class 'NoneType'>, <class 'type'> or object with Buffer Protocol.

vzhurba01 commented 3 months ago

I see that you're trying to interop between Driver's cuda.CUdeviceptr type and the Runtime's cudart.cudaMemset API. While there already exists some interop in Runtime, this does looks like a good area for extending it.

In the meantime, as a WAR you can call the type's __int__() method to get a Runtime compatible value.

vzhurba01 commented 1 month ago

Resolved with latest CUDA Python 12.5.0 release. Closing.