[petsc-dev] What to do when it's hopeless?

Barry Smith bsmith at mcs.anl.gov
Thu May 13 13:07:16 CDT 2010


On May 13, 2010, at 10:48 AM, Jed Brown wrote:

> I'm concerned by the following which appears in
> PetscAttachDebuggerErrorHandler() and Petsc_MPI_DebuggerOnError():
> 
>  ierr = PetscAttachDebugger();
>  if (ierr) { /* hopeless so get out */
>    MPI_Finalize();
>    exit(*flag);
>  }
> 
> Since the error handler is not guaranteed to be called collectively, it
> seems completely unreasonable to call a collective function, especially
> not one with broader scope than PETSC_COMM_WORLD.  It seems to me that
> the hopeless case should instead call MPI_Abort() on the relevant
> communicator.

   You are probably right; this code fragment is so old it may have been written before I knew what MPI_Abort() was. I am changing it.


>  Similarly, why does Petsc_MPI_AbortOnError() call abort()
> instead of MPI_Abort()?

   I think this is clearly documented in the comment above it.  Here is the comment:

 "This is so MPI errors in the debugger will leave all the stack 
  frames. The default abort cleans up and exits."

  You use this error handler if you are running in the debugger (for example with -start_in_debugger). If you call MPI_Abort() it cleans up and you get no useful stack information in the debugger. I will change the comment to:

"This is so MPI errors in the debugger will leave all the stack 
  frames. The default MP_Abort() cleans up and exits thus providing no useful information
  in the debugger hence we call abort() instead of MPI_Abort()."

Is it clear now, or am I missing something?

  Barry




> 
> Jed




More information about the petsc-dev mailing list