# cuSOLVER/cuBLAS solving of LUx=b with batched interface

Hello,

I made LU-decomposition using cublasDgetrfBatched() and cublasDgetriBatched() for inverse, but is there any way to solve the LUx=b using the same batched approach?

Looks like there is similar question here - cublas solving a linear system - #4 by sreeram
just wondering - maybe this approach was integrated into cuBLAS of cuSOLVER since then?

I also followed this example:

but looks like - the number of matrices (batches) is set to 1 which means that cublasDgemv() function (used in the example above) will compute LUx=b only for the first batch (in case we decide to raise the amount of matrices).

Sorry, I’m new to cuBLAS and cuSOLVER - is there any solvers inside those libraries for solving LUx=b equation using batching?

Thank you!

The problem solved. I found this example:

For some reason I missed cublasDgetrsBatched function. So, to solve the Ax=B using batched approach - first you should use cublasDgetrfBatched (or cublasgetrfBatched() in general) which will LU factorize the A matrix and then - invoke cublasDgetrsBatched (or cublasgetrsBatched() in general) to solve the system in LUx=B representation.

One important thing to know!!! It actually confused me for some time: cublasDgetrfBatched returns information about each batch factorization (successful or not) in the array, so the space for the “info” array should be allocated on the device. On the other hand - cublasDgetrsBatched returns “info” as a single value, so it expects a pointer to a variable on HOST.
That is basically it - working example located inside the link above.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.