I have matrices like the one at this link:
https://www.dropbox.com/s/tte3rlfsrprgtt8/ExampleMatrix.txt?dl=0
This example is a 9x9 sparse matrix where the values of the elements differ in magnitude significantly. For example the magnitude of the smallest element is 7.130249e-17 and the largest is 1.944061e-07.
This matrix is the A matrix in a set of linear equations Ax=b which I need to solve. In my application A is cuDoubleComplex type.
Currently I do this using magma_zgesv_batched (calculating many (25 currently) at once, A and B different for each batch) which does the LU decomposition with partial pivoting and row interchanges. This works and gives correct output which matches the output of the original code I am trying to accelerate. I am confident this works.
However, in 'real life' the matrices I need to solve for will be much larger, ~2000*2000 and magma_zgesv_batched has issues with this as it is designed to be used for small matrices. It is very slow and gives warnings to use the native version. The searching I've done suggests people have gone up to matrix size 1024*1024 with magma_zgesv_batched but I haven't tested this myself yet.
As the matrix A is sparse (and will be more sparse as the size increases) I looked into using cuSovlerSp routines, specifically the cusolverSpZcsrlsvluHost (traditional LU with partial pivoting) as this is the most similar to the magma_zgesv_batched.
However, this does not give the correct results as magma_zgesv_batched. But again, I am confident I have coded the problem up correctly in csr format etc. I have tested a dummy matrix with 'normal' (order 1) numbers in the same positions as the 9*9 matrix above and run the equivalent Matlab A\b with the same (dense) dummy A and b this does give the same output as cusolverSpZcsrlsvluHost for the dummy data. So I am convinced it is an issue with the specific data I have in my problem with the large dynamic range.
So my question is to ask if anyone else has encountered problems like this before with matrix elements that have a large dynamic range and if so how can they be dealt with? Is there a trick/scaling I can apply to the matrix?
What is the difference between magma_zgesv_batched and cusolverSp routine? Do they do the matrix inversion etc. differently?
Should I just stick with using magma_zgesv_batched with reduced size problems as I know this works?
Any advice much appreciated!
Thanks