[mpich-discuss] return() or exit() from int main() (NOT MPICH SPECIFIC)
Michael L. Stokes
Michael.Stokes at uah.edu
Thu Apr 9 14:34:42 CDT 2015
Jeff,
It is true that "mpirun" is not part of the MPI standard, but that
"really" had nothing to do with the question regarding the exit status.
For anyone interested, I found what I was looking for in the MPI 3.0
report. On p. 362 the MPI_Abort() call is discussed where it is stated
... "This function does not require that the invoking environment take
any action with the error code. However, a Unix or POSIX environment
should handle this as a return errorcode from the main program."
It goes on say ...
Advice to users. Whether the errorcode is returned from the executable
or from the MPI process startup mechanism (e.g., mpiexec), is an aspect
of quality of the MPI library but not mandatory. (End of advice to users.)
Advice to implementors. Where possible, a high-quality implementation
will try to return the errorcode from the MPI process startup mechanism
(e.g. mpiexec or singleton init). (End of advice to implementors.)
So the MPI standard is clear that returning the errorcode is not
required. However not providing it in a "high-quality implementation"
for a POSIX environment (Linux is considered POSIX.1 compliant) should
be expected. So I guess I'll have to find out if SGI considers MPT a
high-quality implementation.
I think this also raises another point. While the MPI spec seems to
distance itself (for portability reasons) how an MPI process starts, it
does seem to care, at least partially, how it ends (see arguments to
MPI_Abort()).
I recommend that the spec include some way that the exit status be made
available to the user environment regardless of whether MPI fails or
not. Maybe the standard should have an MPI_Exit() call ??? or maybe a
argument to MPI_Finalize() ???
On 04/09/2015 12:26 PM, Jeff Hammond wrote:
> mpirun is not part of the MPI standard. This is something that you'll
> have to discuss with your MPI implementer at SGI.
>
> Best,
>
> Jeff
>
> On Thu, Apr 9, 2015 at 9:36 AM, Michael L. Stokes
> <Michael.Stokes at uah.edu> wrote:
>> This question is not MPICH specific, but I'm sure the expertise is here to
>> answer this question.
>>
>> While running tests on spirit.afrl.hpc.mil (SGI ICE X) using the MPT/2.11
>> stack, I noticed that mpirun returns 0 to the shell regardless of the exit
>> value ( <stdlib.h> exit(int) ), or the return value (return(int)) from the
>> main.
>>
>> Would this behavior be regarded as an error? What are the issues?
>>
>> --Mike
>> _______________________________________________
>> discuss mailing list discuss at mpich.org
>> To manage subscription options or unsubscribe:
>> https://lists.mpich.org/mailman/listinfo/discuss
>
>
_______________________________________________
discuss mailing list discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss
More information about the discuss
mailing list