Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] proper use of MPI_Abort
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2013-11-11 13:30:33


On Nov 7, 2013, at 2:13 PM, "Andrus, Brian Contractor" <bdandrus_at_[hidden]> wrote:

> Good to know. Thanks!

(sorry for the delay in replying; I was traveling last week, which always makes a disaster of my INBOX)

> Seems really like MPI_ABORT should only be used within error traps after MPI functions have been started.

Correct. We treat MPI_Abort to mean that something Bad has happened, and we should be noisy about it.

> Code-wise, the sample I got was not the best. Usage should be checked before MPI_Initialize, I think :)
>
> It seems the expectation is that MPI_ABORT is only called when the user should be notified something went haywire.

Yes. Another way you might consider handling this is to have one process do the error checking (e.g., MCW rank 0) and then broadcast out a flag result indicating "time to MPI_Finalize/exit" or "everything looks good; let's proceed." I.e., something like this (pseudocode typed off the top of my head; excuse errors):

-----
   int rank, flag = 0;
   MPI_Init(...);
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
   if (0 == rank) {
       check_for_badness();
       if (bad) {
           fprintf(stderr, "Badness...\n");
           flag = 1;
       }
   }
   MPI_Bcast(&flag, 1, MPI_INT, 0, MPI_COMM_WORLD);
   if (flag) {
       MPI_Finalize();
       exit(1);
   }
-----

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/