Menu

Same structure, changing values

2013-04-24
2013-06-12
  • Paul Dufort

    Paul Dufort - 2013-04-24

    Hey, what a great library! Thanks very much for creating it.

    I'm new to ViennaCL but not to sparse solvers. I'm solving a nonlinear problem that requires repeatedly solving a sparse linear system. The system has the structure of a simple discretized Poisson operator, but in 6 dimensions instead of the usual 2 or 3. Each time I loop around to solve the sparse system again, the matrix structure will be identical but all of the values will have changed (as well as the RHS of course). Naturally, if possible, I'd prefer to do any work related just to the structure only once.

    So I have two questions:

    1) First ignoring the changes in the matrix values, is there a particular preconditioner for use with the CG solver that would be best for this matrix structure?

    2) Considering the change in values on every iteration, does the ViennaCL CG solver and/or any preconditioner have the ability to specify the structure once, then update the matrix values (and RHS) and re-solve repeatedly without changing the structure? Or do you have to start over from scratch every time? I used to be able to do this with PETSc from Argonne.

    Thank you very much in advance for any answers.

    Regards,
    Paul

     
  • Karl Rupp

    Karl Rupp - 2013-04-24

    Hi Paul,

    oh, I'm actually working with the PETSc guys now. ViennaCL is now also available through PETSc in the latest developer branch, yet not everything has been wrapped yet.

    As for your questions:
    a) If your matrix values change only mildly, the natural choice would be multigrid for a Poisson-like problem. One could reasonably build the coarse hierarchy once and then only update the smoothers and the grid transfer operators. This is currently work in progress, so it's not yet ready for use. Other than that, you can reuse any preconditioner for the updated matrices because the setup of the preconditioner is decoupled from the actual solver cycle stage. For CG you can give an incomplete Cholesky factorization a try and reuse that for subsequent solves. It depends on how much your matrix changes of course…

    b) You can update the values in the compressed_matrix or any of the other sparse matrix formats directly, yes. You usually want to do this on the same device the matrix resides, i.e. via CUDA if the matrix lives in CUDA memory, and similarly for OpenCL. The solver itself cannot make use of that structural information, because all information it gets from the matrix is via matrix-vector products.

    I hope that helps.

    Best regards,
    Karli

     

Log in to post a comment.