[mpich-discuss] Why does MPI_Init() get NULL argc and argv when running Fortran programs?

Jeff Hammond jhammond at alcf.anl.gov
Mon Dec 3 13:36:46 CST 2012


As far as I can tell, there's no standard way to access argc/argv from
Fortran until Fortran 2003
(http://fortranwiki.org/fortran/show/Command-line+arguments).  Until
MPI-3, the Fortran bindings were targeting FORTRAN 77 and Fortran 90
and 95 (and somewhat awkwardly), so there was no reasonable way to try
to deal with them.

Now that there are Fortran 2008 bindings in MPI-3, it might be
interesting to consider how to handle argc/argv in a nice way just as
is done for C.  I don't know if anyone has thought of what happens
when Fortran 2003+ users use the argc/argv access routines.  It would
seem that the same problem would exist that is present if one accesses
argc/argv in C before MPI_INIT is called (i.e. argc/argv will have
mpiexec-related arguments, not just the ones relative to the user
program).

I created a ticket with the MPI Forum about this:
https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/351.

Best,

Jeff

On Mon, Dec 3, 2012 at 9:19 AM, Rajeev Thakur <thakur at mcs.anl.gov> wrote:
> The Fortran binding for MPI_Init is
>
> MPI_INIT(IERROR)
>
> There are no command line arguments.
>
> Rajeev
>
>
> On Dec 3, 2012, at 6:22 AM, clara wrote:
>
>> Hi,
>>
>> I added a print statement at the beginning of MPI_Init() in mpich2-1.4 in order to check the arguments of MPI_Init(). When running a Fortran program, e.g. ep.S.1, the arguments of MPI_Init() are NULL; however, when running a C program, e.g. is.S.1, *argc of MPI_Init() is 1 and (*argv)[0] points to the name of the executed file is.S.1.
>> Can anyone tell us why there is difference in dealing with arguments of MPI_Init() between C and Fortran programs? How could arguments be transferred to MPI_Init() for Fortran programs in mpich2? Thanks.
>>
>> Best,
>> Clara
>> _______________________________________________
>> 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



-- 
Jeff Hammond
Argonne Leadership Computing Facility
University of Chicago Computation Institute
jhammond at alcf.anl.gov / (630) 252-5381
http://www.linkedin.com/in/jeffhammond
https://wiki.alcf.anl.gov/parts/index.php/User:Jhammond



More information about the discuss mailing list