Discussion:
Using numpy in SourceModule code
(too old to reply)
Pierrick Bruneau
2018-02-08 08:25:47 UTC
Permalink
Hi all,

This may sound as dumb to some of you, but is it possible to use numpy
functions in code compiled by compiler.SourceModule in some way ? (e.g.
included API)

I'm wondering this as there seems to be a close bind between numpy arrays,
gpuarrays, and int/float arrays in C++ code.

If numpy is not an option, there are maybe good practices in terms of
included libraries that play well with pycuda? To avoid recoding every
possible vector/matrix and utility stats functions :)

Best regards,
Pierrick Bruneau
Lev E Givon
2018-02-08 11:51:42 UTC
Permalink
Post by Pierrick Bruneau
Hi all,
This may sound as dumb to some of you, but is it possible to use numpy
functions in code compiled by compiler.SourceModule in some way ? (e.g.
included API)
I'm wondering this as there seems to be a close bind between numpy arrays,
gpuarrays, and int/float arrays in C++ code.
If numpy is not an option, there are maybe good practices in terms of
included libraries that play well with pycuda? To avoid recoding every
possible vector/matrix and utility stats functions :)
Best regards,
Pierrick Bruneau
One can make API calls to shared GPU-based libraries (CUBLAS, CUFFT,
etc.) that access GPU memory allocated by pycuda in between (but not
directly from) CUDA kernels compiled with compiler.SourceModule - see
http://scikit-cuda.rtfd.io. You may also want to take a look at
numba's GPU support (http://numba.pydata.org).
--
Lev E. Givon, PhD
http://lebedov.github.io
Loading...