[petsc-users] PetscFinalize at root processor only

Jed Brown jed at jedbrown.org
Thu Nov 1 12:52:31 CDT 2018


PetscFinalize is collective, similar to MPI_Finalize.  You could
MPI_Bcast the result if you want to cleanly exit.  If you want to raise
an error, you could use SETERRA as in other PETSc Fortran examples.

Paula Sanematsu via petsc-users <petsc-users at mcs.anl.gov> writes:

> Hi,
>
> I have a Fortran code that calls an external function only at the root
> processor. If this external function returns an error code that indicates
> that it failed, then I call PetscFinalize() only at the root processor. For
> example:
>
> if(rank==0) then
>     metis_call_status = METIS_SetDefaultOptions(opts)
>     if( metis_call_status /= 1 ) then
>         call PetscFinalize(ierr)
>         stop
>     end if
> end if
>
> I noticed that this will cause the other processors to "hang". I don't want
> to change the Metis call. Do you have a suggestion on how to propagate
> PetscFinalize to other processors? Or another solution?
>
> Thank you,
>
> Paula


More information about the petsc-users mailing list