Matrix inverse with cublas or cusolver


I’m trying to do a matrix inverse via CUDA fortran.

If I were not in CUDA, I would use getrf for the LU decomposition, followed by getri.

Can I do this via cusolver, please? I see the subroutine for the equivalent of getrf, but not getri.

Or would it be better to use cublas, please?


cublas only has batched versions of getrf/getrs. If you only need to do one matrix inversion, I would suggest using cusolver getrf followed by getrs on the identity matrix. I’m not sure if we had a getri function it would run any faster than getrs on the identity.

It works like a charm!
Thank you so much for your help.

Would you like to see the code, or are you good, please?