[Mpi-comments] MPI_Comm_spawn_multiple: parameter description and Fortran bindings

Gilles Gouaillardet gilles at rist.or.jp
Tue Feb 6 02:04:00 CST 2018


Dear MPI Forum,


The description of the 'array_of_commands` parameter passed to 
'MPI_Comm_spawn_multiple()' is not crystal clear IMHO.

The standard simply states

    MPI_COMM_SPAWN_MULTIPLE(count, array_of_commands, ...)
    IN count number of commands (positive integer, significant to MPI
    only at root | see advice to users)
    IN array_of_commands programs to be executed (array of strings,
    significant only at root)

    Advice to users. The argument count is interpreted by MPI only at
    the root, as is
    array_of_argv. Since the leading dimension of array_of_argv is
    count, a non-positive
    value of count at a non-root node could theoretically cause a
    runtime bounds check
    error, even though array_of_argv should be ignored by the
    subroutine. If this happens,
    you should explicitly supply a reasonable value of count on the
    non-root nodes. (End
    of advice to users.)


And the Fortran binding is

MPI_COMM_SPAWN_MULTIPLE(COUNT, ARRAY_OF_COMMANDS, ...)
INTEGER  COUNT
CHARACTER*(*) ARRAY_OF_COMMANDS(*)


Intuitively, it seems obvious that 'array_of_commands' is an array of 
'count' commands.

That being said, the standard does not state that, and it is unclear 
whether 'array_of_commands' should be

NULL-terminated (so to speak) or not.


Back to the Fortran binding, the following prototype, which is somehow 
consistent with 'array_of_argv',

could (help to) clear the confusion. The same comments also apply to the 
Fortran 2008 binding.


CHARACTER*(*) ARRAY_OF_COMMANDS(COUNT)



Gilles


More information about the mpi-comments mailing list