Open leofang opened 1 month ago
https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/tests/test_kernelParams.py
To add on, ctypes
is another alternative for constructing kernel params. Both the ctypes
and numpy
approaches are tested in test_kernelParams.
@gigony complained the following example is unclear compared to CuPy's RawKernel, and I agree. https://github.com/NVIDIA/cuda-python/blob/e1e332564c48db556212d59262a149b1a63285e8/docs_src/source/overview.md?plain=1#L208-L223 Specifically, how to pass typed pointers and scalars is really unclear.
This also raises the question: It seems NumPy has to be a run-time dependency of cuda-python (which is completely fine, since it is impossible that users have GPU projects installed to an environment where NumPy does not exist, we just need to ensure this intent is expressed as a package dependency).
For comparison, here's
cupy.RawKernel
's documentation https://docs.cupy.dev/en/stable/user_guide/kernel.html#kernel-arguments