[petsc-users] Slow speed when using PETSc multigrid

Jed Brown jedbrown at mcs.anl.gov
Mon Jun 4 16:15:15 CDT 2012


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120604/cd1e0d1e/attachment.html>


More information about the petsc-users mailing list