I have a sparse banded matrix A and I'd like to (direct) solve Ax=b. I have about 500 vectors b, so I'd like to solve for the corresponding 500 x's. 
I'm brand new to CUDA, so I'm a little confused as to what options I have available.

cuSOLVER has a batch direct solver cuSolverSP for sparse A\_i x\_i = b\_i using QR [here](http://devblogs.nvidia.com/parallelforall/parallel-direct-solvers-with-cusolver-batched-qr/). (I'd be fine with LU too since A is decently conditioned.) However, as far as I can tell, I can't exploit the fact that all my A\_i's are the same.

Would an alternative option be to first determine a sparse LU (QR) factorization on the CPU or GPU then perform in parallel the backsubstitution (respectively, backsub and matrix mult) on the GPU? If [cusolverSp< t >csrlsvlu()](http://docs.nvidia.com/cuda/cusolver/index.html#cusolver-lt-t-gt-csrlsvlu) is for one b\_i, is there a standard way to batch perform this operation for multiple b\_i's?

Finally, since I don't have intuition for this, should I expect a speedup on a GPU for either of these options, given the necessary overhead? x has length ~10000-100000. Thanks.
['https://Stackoverflow.com/questions/30107988', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1672126/']
I'm currently working on something similar myself. I decided to basically wrap the conjugate gradient and level-0 incomplete cholesky preconditioned conjugate gradient solvers utility samples that came with the CUDA SDK into a small class.

You can find them in your CUDA\_HOME directory under the path:
`samples/7_CUDALibraries/conjugateGradient` and `/Developer/NVIDIA/CUDA-samples/7_CUDALibraries/conjugateGradientPrecond`

Basically, you would load the matrix into the device memory once (and for ICCG, compute the corresponding conditioner / matrix analysis) then call the solve kernel with different b vectors.

I don't know what you anticipate your matrix band structure to look like, but if it is symmetric and either diagonally dominant (off diagonal bands along each row and column are opposite sign of diagonal and their sum is less than the diagonal entry) or positive definite (no eigenvectors with an eigenvalue of 0.) then CG and ICCG should be useful. Alternately, the various multigrid algorithms are another option if you are willing to go through coding them up.

If your matrix is only positive semi-definite (e.g. has at least one eigenvector with an eigenvalue of zero) you can still ofteb get away with using CG or ICCG as long as you ensure that:
1) The right hand side (b vectors) are orthogonal to the null space (null space meaning eigenvectors with an eigenvalue of zero).
2) The solution you obtain is orthogonal to the null space.

It is interesting to note that if you do have a non-trivial null space, then different numeric solvers can give you different answers for the same exact system. The solutions will end up differing by a linear combination of the null space... That problem has caused me many many man hours of debugging and frustration before I finally caught on, so its good to be aware of it.

Lastly, if your matrix has a [Circulant Band structure](https://en.wikipedia.org/?title=Circulant_matrix) you might consider using a fast fourier transform (FFT) based solver. FFT based numerical solvers can often yield superior performance in cases where they are applicable.
If you don't mind going with an open-source library, you could also check out CUSP:
[CUSP Quick Start Page](https://code.google.com/p/cusp-library/wiki/QuickStartGuide)

It has a fairly decent suite of solvers, including a few preconditioned methods:
[CUSP Preconditioner Examples](http://code.google.com/p/cusp-library/source/browse/#hg%2Fexamples%2FPreconditioners)

The smoothed aggregation preconditioner (a variant of algebraic multigrid) seems to work very well as long as your GPU has enough onboard memory for it.