2

I am using cuDSS to solve a set of Ax=b equations as follows

cudssMatrixType_t mtype = CUDSS_MTYPE_SPD;
cudssMatrixViewType_t mview = CUDSS_MVIEW_UPPER;
cudssIndexBase_t base = CUDSS_BASE_ZERO;
    
cudssMatrixCreateCsr(&AA, nrows, ncols, nnz, d_row, NULL,
    d_col, d_val, CUDA_R_32I, CUDA_R_64F, mtype, mview,
    base);

cudssMatrixCreateDn(&b, ncols, nrhs, ldb, d_b, CUDA_R_64F,
    CUDSS_LAYOUT_COL_MAJOR);
    
cudssMatrixCreateDn(&x, nrows, nrhs, ldx, d_x, CUDA_R_64F,
    CUDSS_LAYOUT_COL_MAJOR);


/* Symbolic factorization */
cudssExecute(handle, CUDSS_PHASE_ANALYSIS, solverConfig, solverData,
    AA, x, b);

/* Factorization */
cudssExecute(handle, CUDSS_PHASE_FACTORIZATION, solverConfig,
    solverData, AA, x, b);


/* Solving */
cudssExecute(handle, CUDSS_PHASE_SOLVE, solverConfig, solverData,
    AA, x, b);

However, matrix AA remains constant while rhs vector b is updated at every timestep. Is there a way to extract the factors and reuse it as part of CUDSS_PHASE_SOLVE step at subsequent timesteps? I see that CUDSS_PHASE_FACTORIZATION is more expensive than CUDSS_PHASE_SOLVE and hence I would prefer to avoid this step at every time step.

5
  • 1
    I think cudssExecute is just a generic interface so it requires the same arguments to be passed each time, so perhaps just giving it dummy values for x and b during the CUDSS_PHASE_ANALYSIS and CUDSS_PHASE_FACTORIZATION, leaving only CUDSS_PHASE_SOLVE inside your loop. At least this is what I would expect for direct solvers in general, the main selling point is that factorization can be reused for many RHS. Commented May 8 at 18:29
  • @MikaelÖhman Not sure if I follow you. I will have to destroy the library handle and deallocate all memory before returning the x vector back to the calling program. So sure how to run CUDSS_PHASE_SOLVE in a loop Commented May 8 at 19:27
  • 2
    You don't t have to destroy anything. The point is to keep the factorized results; this is the main expensive computation in any direct solver. You must keep all these values around for the lifetime until you are done solving all your RHS Commented May 8 at 22:58
  • 2
    I generally agree with @MikaelÖhman. Small caveat: "Prior to calling cudssExecute(), all objects passed as parameters must already be created and properly initialized." So a "dummy" might not be possible, but replacing a proper vector with another should be fine. Commented May 9 at 0:15
  • 2
    forums.developer.nvidia.com/t/… Commented May 9 at 16:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.