[MPIWG Fortran] ticket 351

N.M. Maclaren nmm1 at cam.ac.uk
Tue Oct 22 11:56:40 CDT 2013

On Oct 22 2013, Jeff Hammond wrote:
>> However, I have always felt that the original C approach was a horrible
>> hack, just as having C's argument list (and arguments) writable is.
>> There were good reasons at the time but, given that Fortran has done
>> without it with little to no trouble for so long, I agree with Bill.
>I do not see how Fortran has any power to fix this any more than C
>does.  The perceived superiority of Fortran over C is not a valid
>argument within the MPI Forum.  The MPI Forum only addressed the C
>case because Fortran did not have a standard way to access argc/argv
>until the 2003 specification.

That's not my point.  It didn't have to (ab)use it.  MPI_Init could
have returned an integer saying how many arguments it had used, and not
updated the list at all.

I know that the C standard permits the argument list and arguments to
be written to, but that was because adding const would have broken K&R
codes.  Some people on WG14 wanted that to be explicitly undefined, and
it was (is?) a seriously bad idea in some implementations.  Inter alia,
it is on any system where the run-time system uses related tricks.

Implementing it on any system where the arguments are provided as read-only
(as read-only data should be), or when any library call needs to access
them, or on any system which passes references to the same arguments to all
processes started by mpiexec/mpirun, is a real pain.  All can be kludged
up (I have), but it's totally unnecessary and horrible hackery.

>I do not understand your apparent argument that argc/argv are not
>useful.  Do you assume that Fortran applications always use the exact
>same input filename?  I know many Fortran codes that do this and it's
>really sad to see how they contort to provide a general workflow.

I never said that, nor did I imply it.    It's the hackery that I
dislike.  In addition to the above, MPI_Init(int *argc, char ***argv)
was NOT compatible with the normative wording of C90, nor does it say
that MPI_Init MUST change argc and argv.

And, lastly, MPI 3.0 already defines a way of getting this that is
the same in both Fortran and C - using MPI_INFO_ENV.

Nick Maclaren.

More information about the mpiwg-fortran mailing list