0

I need to solve Ax=B multiple times and cusparseSolveAnalysisInfo_t is taking huge time inside the loop.

What does cusparseSolveAnalysisInfo_t do in the solution of AX=B? According to the documentation I can create it once and use it for different sets of B. What if I want to use it for different sets of A with the same Sparse structure.

1 Answers1

1

Referring to the documentation, the info structure of type cusparseSolveAnalysisInfo_t is passed to the analysis function to capture data created by the analysis function. It is then passed (unchanged) to the solve function to guide the solver.

You can see an example usage in this cuda sample.

You must re-create it if you change A (i.e. you must re-run the analysis step if you change A).

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • Thanks for the reply Robert. But I think the documentation on cusparseSolveAnalysisInfo_t is not fully correct. The documentation says "The solve phase may be performed multiple times with different right-hand-sides, while the analysis phase needs to be performed only once. This is especially useful when a sparse triangular linear system must be solved for a set of different right-hand-sides one at a time, while its coefficient matrix remains the same." – TheSeriousJoker Jul 21 '13 at 07:04
  • Here the co-efficient matrix does not need to be same in terms of values. It needs to have the same structure, that is it. In my case the structure of the matrix A is same, only the values change. I create the analysisInfo once and call the solve part again and again with different A and B. It is working fine in my case. – TheSeriousJoker Jul 21 '13 at 07:05
  • I agree with your statement, however to be clear, structure means: 1. matrix dimensions and 2. relationship of zero elements to non-zero elements. Therefore, the vales can change, as long as a previously non-zero element remains non-zero, and a previously zero element remains zero. As long as you have met these conditions, I think you can re-use the analysis info even if the values change. – Robert Crovella Jul 21 '13 at 14:08
  • Yes Robert, I am re-using the analysis info as my Matrix is always tri-diagonal sparse. And for such matrices CUDA provides cusparseSgtsvStridedBatch, which gives me a direct solution. Thanks. – TheSeriousJoker Jul 22 '13 at 14:30