[petsc-users] PetscFinalize at root processor only

Smith, Barry F. bsmith at mcs.anl.gov
Thu Nov 1 12:26:59 CDT 2018


   The only way to do it is to put a broadcast after the call to METIS on process 0 and have all the other processes wait for the result; if not 1 then all processes call PetscFinalize() that the same time.

    Barry


> On Nov 1, 2018, at 11:48 AM, Paula Sanematsu via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> 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