[MPIWG Fortran] ticket 351

Jeff Hammond jeff.science at gmail.com
Tue Oct 22 10:56:06 CDT 2013


The UChicagoan in me is compelled to say, "That's all well and good in
practice but how does it work in theory?"

I would expect this program to work every time the following does.

#include <stdio.h>

int main(int argc, char * argv[])
{
  for (int i=0; i<argc; i++)
    printf("argv[%d] = %s \n", i, argv[i]);
  return 0;
}

That this function could potentially not work as expected when
launched as an MPI program is why the MPI Forum defined MPI_INIT as
they did.

Jeff

On Tue, Oct 22, 2013 at 10:50 AM, Bill Long <longb at cray.com> wrote:
> Here's the program:
>
> program test_command
>
>   character(50) :: value
>
>   call get_command_argument (0, value)
>   print *, trim(value)
>
> end program test_command
>
> Cheers,
> Bill
>
>
>
>
> On 10/22/13 10:44 AM, Jeff Hammond wrote:
>>
>> I am hesitant to assume this problem is resolved just because all
>> Linux-based clusters are fine with this*.  I don't think that this
>> will be compiler sensitive either, so testing 5 compilers doesn't
>> prove much.  Testing 5 process launchers might.
>>
>> Best,
>>
>> Jeff
>>
>> * This is not meant to disparage Cray by suggesting their machines
>> behave like Linux clusters in terms of the process environment;
>> rather, this is a good thing.
>>
>> On Tue, Oct 22, 2013 at 10:30 AM, Bill Long <longb at cray.com> wrote:
>>>
>>> Hi Jeff,
>>>
>>> I admit that the Fortran standard is (intentionally) vague about what
>>> constitutes a "command line".  However, I tried the 5 compilers I have
>>> available (Cray, Intel, PGI, gfortran, Pathscale) with a simple program
>>> that
>>> prints argument 0 == the "command name by which the program was invoked",
>>> and in all cases the launcher text  (aprun -n1 ) was ignored and the
>>> program
>>> printed "./a.out".    Not conclusive, but suggests that the vendors have
>>> figured out what the right "quality of implementation" action is here.
>>> If
>>> there are examples to the contrary, I'd be interested in knowing about
>>> them.
>>>
>>> Cheers,
>>> Bill
>>>
>>>
>>>
>>> On 10/22/13 10:12 AM, N.M. Maclaren wrote:
>>>>
>>>>
>>>> On Oct 22 2013, Bill Long wrote:
>>>>>
>>>>>
>>>>>
>>>>> 2) I don't really see the point of this at all.  The user can just
>>>>> call the native Fortran intrinsics directly.  Why should there be a
>>>>> duplicate version that starts with MPI_ ?  I would suggest, instead,
>>>>> that you just add a note in the spec (advice to users) point out that
>>>>> Fortran programmers can access the command line arguments using the
>>>>> language intrinsics.   Maybe someone can convince me this is not
>>>>> adequate, but I've been using those intrinsics with parallel programs
>>>>> for some time and they work just fine.
>>>>
>>>>
>>>>
>>>> I assume that the desire for this is to support the systems which do not
>>>> use a mpiexec/mpirun command, but fire up MPI directly, as IBM poe does.
>>>>
>>>> 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.
>>>>
>>>>
>>>> Regards,
>>>> Nick Maclaren.
>>>>
>>>> _______________________________________________
>>>> mpiwg-fortran mailing list
>>>> mpiwg-fortran at lists.mpi-forum.org
>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran
>>>
>>>
>>>
>>> --
>>> Bill Long                                           longb at cray.com
>>> Fortran Technical Support    &                 voice: 651-605-9024
>>> Bioinformatics Software Development            fax:   651-605-9142
>>> Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
>>>
>>>
>>> _______________________________________________
>>> mpiwg-fortran mailing list
>>> mpiwg-fortran at lists.mpi-forum.org
>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran
>>
>>
>>
>>
>
> --
> Bill Long                                           longb at cray.com
> Fortran Technical Support    &                 voice: 651-605-9024
> Bioinformatics Software Development            fax:   651-605-9142
> Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
>
>



-- 
Jeff Hammond
jeff.science at gmail.com



More information about the mpiwg-fortran mailing list