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
Not really an issue but, I'm trying to populate a struct in constant memory containing (device) pointers in order to run my kernel through kernel tuner. In C the struct looks something like:
I can see how I would pack pointers into this with struct.pack("PP0l", spk_cnt, spk) and then convert to numpy as described in your example before passing via the cmem_args kwarg to tune_kernel. But, I've no idea how I would create (and initialise) these pointers from Python! Any pointers?
I'm not sure how to do this from cupy, but with pycuda it should be easy. If you have PyCuda device allocation you can just cast it to an int to get the GPU memory address. From a cupy array you may be able to extract the pointer somehow, but I just had a look at cupy and DLpack, but I'm not sure how to extract the device pointer from those data types. If using PyCuda is an option for you, I think you could make it work.
Activity
benvanwerkhoven commentedon Sep 29, 2023
I'm not sure how to do this from cupy, but with pycuda it should be easy. If you have PyCuda device allocation you can just cast it to an int to get the GPU memory address. From a cupy array you may be able to extract the pointer somehow, but I just had a look at cupy and DLpack, but I'm not sure how to extract the device pointer from those data types. If using PyCuda is an option for you, I think you could make it work.
neworderofjamie commentedon Oct 2, 2023
I haven't used either PyCuda or cupy so happy to use whichever is easier - thanks for the suggestion