[petsc-users] Slow speed when using PETSc multigrid

Barry Smith bsmith at mcs.anl.gov
Mon Jun 4 18:34:22 CDT 2012


   Also run with -ksp_view to see exasctly what solver options it is using. For example the number of levels, smoother on each level etc. My guess is that the below is running on one level (because I don't see you supplying options to control the number of levels etc). 

   Barry

On Jun 4, 2012, at 4:15 PM, Jed Brown wrote:

> Always send -log_summary when asking about performance.
> 
> On Mon, Jun 4, 2012 at 4:11 PM, TAY wee-beng <zonexo at gmail.com> wrote:
> Hi,
> 
> I tried using PETSc multigrid on my 2D CFD code. I had converted ksp eg. ex29 to Fortran and then added into my code to solve the Poisson equation.
> 
> The main subroutines are:
> 
> call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
> 
> call DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,i3,i3,PETSC_DECIDE,PETSC_DECIDE,i1,i1,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da,ierr)
> call DMSetFunction(da,ComputeRHS,ierr)
> call DMSetJacobian(da,ComputeMatrix,ierr)
> call KSPSetDM(ksp,da,ierr)
> 
> call KSPSetFromOptions(ksp,ierr)
> call KSPSetUp(ksp,ierr)
> call KSPSolve(ksp,PETSC_NULL_OBJECT,PETSC_NULL_OBJECT,ierr)
> call KSPGetSolution(ksp,x,ierr)
> call VecView(x,PETSC_VIEWER_STDOUT_WORLD,ierr)
> call KSPDestroy(ksp,ierr)
> call DMDestroy(da,ierr)
> call PetscFinalize(ierr)
> 
> 
> Since the LHS matrix doesn't change, I only set up at the 1st time step, thereafter I only called ComputeRHS every time step.
> 
> I was using HYPRE's geometric multigrid and the speed was much faster.
> 
> What other options can I tweak to improve the speed? Or should I call the subroutines above at every timestep?
> 
> Thanks!
> 
> 
> -- 
> Yours sincerely,
> 
> TAY wee-beng
> 
> 



More information about the petsc-users mailing list