[petsc-users] ksp for AX=B system

Barry Smith bsmith at mcs.anl.gov
Tue Apr 16 19:15:40 CDT 2013


   Shuangshuang,

    How large is n and m?  PETSc does not have any built-in "multiple right hand side" iterative solvers. Generally if m is small, m < 10-20 we recommend just solving each one in a loop as you suggest below.  If m is large and n is not "too large" we recommend using a direct solver and using MatMatSolve() to solve all the right hand sides "together". If n is not "too large" and m is very large it would also be reasonable to solve in parallel different "sets" of right hand sides where each "set" of right hand sides is solve in parallel using a direct solver with MatMatSolve(), we don't have specific "canned" code set up to do this but it is pretty straightforward. 

   Also where is your matrix coming from? A PDE where there are good known preconditioners to solve it (like multigrid) or some other type of problem without good preconditioners?

   Once we know the type of problem and some idea of n and m we can make more specific recommendations.

    Barry


On Apr 16, 2013, at 6:21 PM, "Jin, Shuangshuang" <Shuangshuang.Jin at pnnl.gov> wrote:

> Hi, petsc developers, I have another question regarding solving the AX=B linear systems.
>  
> I know that we can use PETSc ksp solver to solve an Ax=b linear system in parallel, where A is a square matrix, and b is a column vector for example.
>  
> What about solving AX=B in parallel, where A is still n*n, and B is a n*m matrix?
>  
> If I solve each column of B one by one, such as:
> for (i = 0; i < m; i++)
> Callkspsolver(A, xi, bi); // user defined wrapper function to call PETSc ksp solver
>  
> Then for solving each individual Axi = bi, it’s parallel. However, if m is big, the sequential outside loop is quite inefficient.
>  
> What is the best approach to parallelize the outside loop as well to speed up the overall computation?
>  
> Thanks,
> Shuangshuang
>  



More information about the petsc-users mailing list