[petsc-users] solving Ax=b with constant A
likunt at caltech.edu
likunt at caltech.edu
Mon May 12 12:27:51 CDT 2014
Dear Petsc developers,
I am solving a linear system Ax=b, while A is constant and b is changing
in each time step. Here is the code I wrote:
/****************************************************************
...compute matrix A...
KSPCreate(PETSC_COMM_WORLD, &ksp); CHKERRQ(ierr);
KSPSetOperators(ksp, A, A, SAME_PRECONDITIONER); CHKERRQ(ierr);
KSPSetTolerances(ksp, 1.e-5, 1.E-50, PETSC_DEFAULT, PETSC_DEFAULT);
KSPSetFromOptions(ksp);
for(int step=0; step<STEP; step++)
{
... compute vector b ...
KSPSolve(ksp, b, x);
}
*****************************************************************/
I tested a system with size 1725*1725, on 4 processors, it takes 0.06s.
Would you please let me know if there is a way to improve its efficiency?
Thanks.
More information about the petsc-users
mailing list