On Mon, May 12, 2014 at 12:27 PM, <[email protected]> wrote: > 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? >
It would be amazing if we could do that given the description. First, we do not know exactly what solver is being used (-ksp_view), but lets assume its GMRES/ILU(0) which is the default. Second, we have no idea what the convergence was like (-ksp_monitor_true_residual -ksp_converged_reason), so we do not know what the bottleneck is, and have no performance monitoring (-log_summary). Lastly, even if we had that we have no idea what the operator is so that we could make intelligent suggestions for other preconditioners. Matt > Thanks. > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
