Hi Andreas,

and pardon my possible double-post for I was not sure whether HTML was prohibited or not.

Thanks for the suggestion and your quick response, however I don't think this will gonna solve my case. More precisely I try to process a stack of Python/OpenCV images in CUDA. I know one sole image can easily be transformed to a 1D-Pointer, but a list of images is what I'm thinking about right know. One workaround would be appending all images , create so a huge one, and keep the offsets. This way I know exactly at which (x,y) a next image starts on the huge picture. It is working but not very nice to maintain at least for my goals.

Another case would be a list of 1D-lists as suggested of random sizes (m x 1) :

listToProc = [[-1,-2,-3,-4,-5],[1,2,3,4,5,6,7,8.1,9],[2,3],[456,2,3,63],[1,2,3]]

Do you think one of the two cases can be transformed to a sparse matrix? If so is there an example about these matrices for CUDA ?

Kind Regards
Frank



On 12.05.2016 06:31, Andreas Kloeckner wrote:
Hi Frank,

Frank Ihle <frank.i...@yahoo.de> writes:
I try to speed up my Python program with a not so trivial algorithm, so
I need to know. What is the correct way of transferring a list of lists
of floats to the (Py)CUDA Kernel?
Nested, variable-sized structures are generally tricky to map onto
array-shape hardware. You'll likely want to store your data in a
CSR-like data structure:

https://en.wikipedia.org/wiki/Sparse_matrix

Scans (such as the one in PyCUDA) can help significantly with the
resulting index computations.

Hope that helps,
Andreas



_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
https://lists.tiker.net/listinfo/pycuda

Reply via email to