Can anyone point me to an example using the sparse double cholesky solver on gpu using C++ and CUDA.
I can get dense solver to give correct answers but the sparse solver does not so I must be doing something wrong.
Cheers
Terry
Hi @terryhendicott, can you share more details of your problem? What are you trying to compute?
Also, you can check out cuDSS, which is a Direct Sparse Solver on GPU. It may be suitable solution to your problem.
I will check out cuDSS thsnk you for the hint.
Trying to solve a simple matrix first before launching into large sparse matrices
const int N = 3; // Matrix size
const int nnz = 5; // Number of non-zero elements
const int csrRowPtrA[N + 1] = { 0, 2, 4, 5 }; // Row pointers
const int csrColIndA[nnz] = { 0, 1, 0, 1, 2 }; // Column indices
const double csrValA[nnz] = { 4.0, 1.0, 1.0, 3.0, 1.0 }; // Non-zero values of A
// Right-hand side vector b
const double b[N] = { 1.0, 2.0, 3.0 };
double x[N]; // Solution vector
No matter what I try get wrong numeric solution?
HI terryhendicott, I am the developer of cuDSS, could you please share the whole example code?
Have resolved what the problem is and it was on my side.
kernel.zip (3.4 KB)
Have been trying for years to get a command line fast sparse solver that I can call from other software. Just need to add saving x to a binary file to be complete. This means an awful lot to me thank you.
Challenge.zip (729 Bytes)
Here is my data files for the small matrix check but I have got the correct answer with 46328x46328 matrix.
Thank you so much.
I run you kernel.cu for both matrices from message above and from your attachments and I see the correct solution.
Thanks Antonia appreciate your work thank you greatly
Hi @antona I am having a similar issue using cudss to solve a sparse linear system of equations. I am new to cuda. I have been using Eigen libraries so far and wanted to compare cudss to Eigen linear solver for accuracy and speed. Attached is an example where I am using cudss and then solving the same equation using Eigen LU solver. Some of the numbers are matching. However, cudss gives nan for small numbers. Not sure why. The attached spread sheet shows the results comparison. I can’t figure out what I am missing. Any help is appreciated.
CudaRuntime1.zip (1.1 MB)
Hi, The matrix type is set to SPD while the matrix is not positive defined. You can check INFO by calling
cudssDataGet(handle, solverData, CUDSS_DATA_INFO, &cudss_error, sizeof(cudss_error), &sizeWritten);
after factorization.
if you set matrix type to CUDSS_MTYPE_SYMMETRIC, then the solution is correct. And if you check INERTIA by
cudssDataGet(handle, solverData, CUDSS_DATA_INERTIA, cudss_inertia, sizeof(cudss_inertia), &sizeWritten);
there will be (6314, 34) that means that 34 eigen values are negative.
Hi @antona Thank you very much for your quick response. setting the mtype as you recommended gives the exact results.