NVIDIA / warp

A Python framework for high performance GPU simulation and graphics
https://nvidia.github.io/warp/
Other
4.28k stars 243 forks source link

Options indexing a list of arrays (likeragged arrays) #254

Closed shi-eric closed 1 month ago

shi-eric commented 4 months ago

Discussed in https://github.com/NVIDIA/warp/discussions/208

Originally posted by **cadop** April 17, 2024 I have a list of numpy arrays, where each array is of different length. The typical numpy method in the past has been to set their datatypes to object and allow ragged arrays. Since I have ~100,000 arrays, and each thread gets 1 array, it's not feasible to pass all as arguments to the kernel. Ideally I would just send the list and index them as needed. I could create a flat array, separately pass the corresponding indices for array starts/ends, seemingly mirroring a list of pointers with some extra leg-work. Perhaps I can pad the arrays and then construct a BSR to help get rid of the padding. Are there better/built-in ways?