CEMeNT-PSAAP / MCDC

MC/DC: Monte Carlo Dynamic Code
https://mcdc.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
20 stars 20 forks source link

Outside GPU libraries for GPU functions #167

Open jpmorgan98 opened 6 months ago

jpmorgan98 commented 6 months ago

As we start to integrate more advanced hybrid methods on the GPU we are finding that [most numpy functions]() are not supported on the GPU. I think we have two options here (1) reimplement all operations (gemm, LU decomp, etc.) in our own python-numba functions or (2) use CuPy supposed interoperability allowing for zero-overhead copy.

I think 2 is the way to go but would probably require an object mode call to work which is way less then ideal. This is related to #158 and how best to store data with the Cupy array potentially being the way to go.

jpmorgan98 commented 6 months ago

Actually I think we should be able to call into CUDA libraries (i.e. cusolver etc.). I believe this is done by pulling things from nvvm. This would be the most seamless thing to do I think and could allow for some from_cpu from_gpu` stuff. This could also eliminate the need to reimplement things like GEMRES as cuda libraries are already written that do that.

More investigation is required tho. This idea came from looking at numba.cuda.tests. Also of interest on this front might be the pyculib package from numba.