Skip to content

v2.1.x: mpi/fortran: fix parsing arrays of Fortran strings #5019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ggouaillardet
Copy link
Contributor

MPI defines the "argv" param to Fortran MPI_COMM_SPAWN as being
terminated by a blank string. While not precisely defined (except
through a non-binding example, Example 10.2, MPI-3.1 p382:6-29), one
can infer that the "array_of_argv" param to Fortran
MPI_COMM_SPAWN_MULTIPLE is also a set of argv, each of which are
terminated by a blank line.

The "array_of_commands" argument to Fortran MPI_COMM_SPAWN_MULTIPLE is
a little less well-defined. It is assumed to be of length "count"
(another parameter to MPI_COMM_SPAWN_MULTIPLE) -- and not be
terminated by a blank string. This is also given credence by the same
example 10.2 in MPI-3.1.

The previous code assumed that "array_of_commands" should also be
terminated by a blank line -- but per the above, this is incorrect.
Instead, we should just parse our "count" number of strings from
"array_of_commands" and not look for a blank line termination.

This commit separates these two cases:

  • ompi_fortran_argv_blank_f2c(): parse a Fortran array of strings out
    and stop when reaching a blank string.
  • ompi_fortran_argv_count_f2c(): parse a Fortran array of strings out
    and stop when "count" number of strings have been parsed.

Signed-off-by: Jeff Squyres [email protected]

(cherry picked from commit 0ab6b20)

MPI defines the "argv" param to Fortran MPI_COMM_SPAWN as being
terminated by a blank string.  While not precisely defined (except
through a non-binding example, Example 10.2, MPI-3.1 p382:6-29), one
can infer that the "array_of_argv" param to Fortran
MPI_COMM_SPAWN_MULTIPLE is also a set of argv, each of which are
terminated by a blank line.

The "array_of_commands" argument to Fortran MPI_COMM_SPAWN_MULTIPLE is
a little less well-defined.  It is *assumed* to be of length "count"
(another parameter to MPI_COMM_SPAWN_MULTIPLE) -- and *not* be
terminated by a blank string.  This is also given credence by the same
example 10.2 in MPI-3.1.

The previous code assumed that "array_of_commands" should also be
terminated by a blank line -- but per the above, this is incorrect.
Instead, we should just parse our "count" number of strings from
"array_of_commands" and *not* look for a blank line termination.

This commit separates these two cases:

* ompi_fortran_argv_blank_f2c(): parse a Fortran array of strings out
  and stop when reaching a blank string.
* ompi_fortran_argv_count_f2c(): parse a Fortran array of strings out
  and stop when "count" number of strings have been parsed.

Signed-off-by: Jeff Squyres <[email protected]>

(cherry picked from commit open-mpi/ompi@0ab6b20)
@jsquyres
Copy link
Member

jsquyres commented Apr 5, 2018

@hppritcha This is good to go.

@jsquyres jsquyres changed the title mpi/fortran: fix parsing arrays of Fortran strings v2.1.x: mpi/fortran: fix parsing arrays of Fortran strings Apr 5, 2018
@hppritcha hppritcha merged commit 9a74cd7 into open-mpi:v2.x Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants