Skip to content
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

Add missing MPI_Status conversion subroutines #7762

Merged
merged 4 commits into from
Sep 10, 2020

Conversation

ggouaillardet
Copy link
Contributor

  • MPI_Status_c2f08()
  • MPI_Status_f082c()
  • MPI_Status_f082f()
  • MPI_Status_f2f08()

and the PMPI_* related subroutines

Refs. #1475

Signed-off-by: Gilles Gouaillardet [email protected]

Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except it is missing the use-mpi-ignore-tkr and use-mpi-tkr versions.

ompi/mpi/c/status_c2f08.c Outdated Show resolved Hide resolved
@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from 1d5c8e9 to e6d5a08 Compare May 27, 2020 06:27
@ggouaillardet
Copy link
Contributor Author

@jsquyres are you sure we need these subroutines in the use mpi bindings?
i mean, are the use mpi bindings supposed to be aware of of the type(MPI_Status) type from use mpi_f08?

@ggouaillardet ggouaillardet requested a review from jsquyres May 27, 2020 06:47
@jsquyres
Copy link
Member

MPI-3.1 Figure 17.1 states what functions need to be available in which languages:

Screen Shot 2020-05-27 at 4 44 11 PM

For the Fortran subroutines, it's not specified that the Fortran routines would only be available in the mpi_f08 module, so therefore they must be available in all Fortran interfaces (mpif.h, mpi module, and mpi_f08 module).

@ggouaillardet
Copy link
Contributor Author

@jsquyres That does make sense. And it also begs the question "how to declare type(MPI_Status) in both mpif.h and use mpi" ? Can you please help me answering this one?

@jsquyres
Copy link
Member

jsquyres commented May 28, 2020

Forgive me, my Fortran is a little rusty, but perhaps something like this?

use :: mpi_f08_types, only : MPI_Status
implicit none
include 'mpif.h'
! ...use type(MPI_Status) and integer array with size MPI_STATUS_SIZE

and

use :: mpi_f08_types, only : MPI_Status
use mpi
! ...use type(MPI_Status) and integer array with size MPI_STATUS_SIZE

@jsquyres
Copy link
Member

Oh, you're asking a different question... not how to use it in the user application, but how do we define it in the mpi module and mpif.h itself. Gotcha.

I guess defining that type in mpi and mpif.h would have to be contingent upon supporting enough F08 in the compiler (I don't know the correct preprocessor macro we establish for that in configure.ac, but I'm sure we have one).

Meaning: I would imagine that mpif.h and the mpi modules would just conditionally include a definition for the MPI_Status type. Extra bonus points if that definition can be a standalone file that can be included in all relevant places -- mpif.h, mpi module, mpi_f08 module (vs. replicating the code in multiple places).

@awlauria awlauria added this to the v5.0.0 milestone Jun 30, 2020
@ggouaillardet
Copy link
Contributor Author

@jsquyres I started this PR a while ago, and did not finalize it, mainly because I still cannot make any sense of MPI_Status_f08tof() and friend with include 'mpif.h' and use mpi.

One option is to declare type(MPI_Status) in mpif.h and mpi.mod.
An other option would be do (and have the end users do)

use mpi_f08, only :: type(MPI_Status)
implicit none
include 'mpif.h'
call MPI_Status_f08tof(...)

Both options look fishy to me, and even if I do not challenge your literal interpretation of the MPI standard
(e.g. it does not say use mpi_f08 only, so we have to do it for all Fortran flavors), I would rather ask the MPI
Forum what the initial intent was, and to tell us how we should interpret the standard (and some guidelines on how to implement it if needed).

Refs. #7918 #7921

@jsquyres
Copy link
Member

Both options look fishy to me, and even if I do not challenge your literal interpretation of the MPI standard
(e.g. it does not say use mpi_f08 only, so we have to do it for all Fortran flavors), I would rather ask the MPI
Forum what the initial intent was, and to tell us how we should interpret the standard (and some guidelines on how to implement it if needed).

Ok, I'll ask.

I note that MPI-3.1 does define the C type MPI_F08_status. So at least there's an obvious answer for the C side (which you already implemented).

I suspect that it means that TYPE(MPI_Status) is going to need to be in mpif.h and the mpi module (if the compiler supports it). I not sure if that's exactly what we intended when we wrote that text, but I think that's a consequence of the existing MPI-3.1 language.

@jsquyres
Copy link
Member

Asked to the MPI Forum Fortran working group here: https://lists.mpi-forum.org/pipermail/mpiwg-fortran/2020-July/003554.html

@jsquyres
Copy link
Member

@ggouaillardet We got an answer from the MPI Forum Fortran working group: the MPI_Status_f208() and MPI_Status_f082f() routines and the TYPE(MPI_Status) type only need to be available in mpi_f08 and mpi -- not in mpif.h.

This may take a little time to wind through the Forum, but I think their conclusions are fairly definitive. See mpi-forum/mpi-issues#298.

Can you update this PR to match?

@ggouaillardet
Copy link
Contributor Author

@jsquyres will do.
What should we do if the use_mpif08 bindings cannot be built?

  • should we still define type(MPI_Status) in mpi.mod?
  • if ye, should we still declare the Fortran to/from Fortran2008 subroutines in mpi.mod ? if yes, what should they do?
    (failure? no-op and success?)

@jsquyres
Copy link
Member

@jsquyres will do.
What should we do if the use_mpif08 bindings cannot be built?

  • should we still define type(MPI_Status) in mpi.mod?

If we are able to, yes. I.e., this is part of the mpi bindings, so we might as well do our best to build the mpi bindings (even though it's not technically useful in the mpi bindings without the mpi_f08 bindings, it's still part of the mpi bindings).

  • if ye, should we still declare the Fortran to/from Fortran2008 subroutines in mpi.mod ? if yes, what should they do?
    (failure? no-op and success?)

If it is possible, we should have the routines and they should do their actual operations. Might as well not special case it as much as possible -- e.g., the mpi_f08 module might not be built for some obscure reason, but doing the INTEGER<-->TYPE(MPI_Status) conversion may still be possible to do.

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from e6d5a08 to c6eafa9 Compare July 22, 2020 04:58
@ibm-ompi
Copy link

The IBM CI (XL) build failed! Please review the log, linked below.

Gist: https://gist.github.com/724834b0718fa83b4f9bffd3f85af160

@ibm-ompi
Copy link

The IBM CI (PGI) build failed! Please review the log, linked below.

Gist: https://gist.github.com/b7020ee901c2c6cef4a47a443a45de2c

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from c6eafa9 to 06a9aeb Compare July 22, 2020 05:45
@ibm-ompi
Copy link

The IBM CI (XL) build failed! Please review the log, linked below.

Gist: https://gist.github.com/e9d6bced07c397b5a5141bfdb275eeb5

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch 4 times, most recently from 6bc34ec to e7b903a Compare July 22, 2020 13:42
@ggouaillardet
Copy link
Contributor Author

:bot:retest

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from 737d2fa to 0d0f629 Compare July 26, 2020 11:11
@ibm-ompi
Copy link

The IBM CI (PGI) build failed! Please review the log, linked below.

Gist: https://gist.github.com/538b3acbfdb70d854f891f2dadc6f0ba

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from 0d0f629 to 3f7d57c Compare July 26, 2020 11:34
@ibm-ompi
Copy link

The IBM CI (PGI) build failed! Please review the log, linked below.

Gist: https://gist.github.com/02bb6f209f9b447969dac8eb737c59c4

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from 3f7d57c to d85191b Compare July 26, 2020 12:13
@ibm-ompi
Copy link

The IBM CI (PGI) build failed! Please review the log, linked below.

Gist: https://gist.github.com/bd62c351c1eb88b8e987d565ce8fdd24

@ggouaillardet ggouaillardet force-pushed the topic/mpi_status_f08_c branch from d85191b to 7edd0fd Compare July 26, 2020 12:41
@ggouaillardet
Copy link
Contributor Author

@jsquyres

I had to revamp more stuff than anticipated.

Finally, type(MPI_Status) is defined in its own mpi_types module (located in ompi/mpi/fortran/use-mpi) and this module is used by use-mpi-tkr, use-mpi-ignore-tkr and use-mpi-f08 if the compiler provides enough support.

There are two remaining comments I have not addressed yet.

@jsquyres
Copy link
Member

jsquyres commented Aug 19, 2020

FYI: the MPI Forum errata regarding this issue passed: mpi-forum/mpi-issues#298

Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need a few very minor changes.

I think the code all checks out. I made a comprehensive set of tests to check all of this -- see open-mpi/ompi-tests-public#2.

config/ompi_setup_mpi_fortran.m4 Outdated Show resolved Hide resolved
ompi/mpi/c/status_c2f08.c Show resolved Hide resolved
ompi/mpi/c/status_f082c.c Show resolved Hide resolved
ompi/mpi/man/man3/MPI_Status_f082c.3in Outdated Show resolved Hide resolved
ompi/mpi/man/man3/MPI_Status_f082c.3in Outdated Show resolved Hide resolved
ompi/mpi/man/man3/MPI_Status_f082f.3in Outdated Show resolved Hide resolved
@ggouaillardet
Copy link
Contributor Author

I updated the PR (but did not rewrite the man pages in markdown)

@jsquyres
Copy link
Member

jsquyres commented Sep 8, 2020

I updated the PR (but did not rewrite the man pages in markdown)

Yeah, fair enough -- I wasn't expecting you to re-write it in Markdown. ;-) Could you review open-mpi/ompi-tests-public#2?

Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggouaillardet I added a trivial commit to add {} and another commit to convert the 3 man pages to Markdown. I fixed some typos and slightly improved the text along the way. If you're good with the changes, go ahead and merge.

@gpaulsen gpaulsen requested a review from markalle September 8, 2020 15:36
@jsquyres
Copy link
Member

jsquyres commented Sep 8, 2020

bot:aws:retest

@jsquyres
Copy link
Member

jsquyres commented Sep 9, 2020

ggouaillardet and others added 4 commits September 9, 2020 06:59
Make the C MPI_F08_status type definition match the updated
mpi_f08 type(MPI_Status) definition.

This fix the inconsistency introduced in open-mpi/ompi@98bc7af

Signed-off-by: Gilles Gouaillardet <[email protected]>
manually cleanup the generated .mod file in OMPI_FORTRAN_CHECK_BIND_C_TYPE

Signed-off-by: Gilles Gouaillardet <[email protected]>
Only in C bindings:
 - MPI_Status_c2f08()
 - MPI_Status_f082c()

In all bindings but mpif.h
 - MPI_Status_f082f()
 - MPI_Status_f2f08()

and the PMPI_* related subroutines

As initially inteded by the MPI forum, the Fortran to/from Fortran 2008
conversion subtoutines are *not* implemented in the mpif.h bindings.
See the discussion at mpi-forum/mpi-issues#298

Refs. open-mpi#1475

Signed-off-by: Gilles Gouaillardet <[email protected]>
Convert the MPI_Status_f082f, MPI_Status_f082c, and MPI_Status_f2c man
pages to Markdown.  Fix some typos and improve the text a bit along
the way.

Left the raw NROFF redirect pages MPI_Status_f2f08, MPI_Status_c2f08,
and MPI_Status_c2f files as they were -- they're 1-line redirects, and
it seems simpler to leave those (vs. duplicating the Markdown).

Signed-off-by: Jeff Squyres <[email protected]>
@jsquyres jsquyres force-pushed the topic/mpi_status_f08_c branch from cb15697 to c04dc35 Compare September 9, 2020 13:59
@markalle
Copy link
Contributor

markalle commented Sep 9, 2020

Should there be Fortran versions for _c2f08 and _f082c? I may be missing them, but I only see Fortran versions for the _f2f08 and _f082f calls.

@jsquyres
Copy link
Member

jsquyres commented Sep 9, 2020

Should there be Fortran versions for _c2f08 and _f082c? I may be missing them, but I only see Fortran versions for the _f2f08 and _f082f calls.

No.

See #7762 (comment) (aka MPI-3.1 figure 17.1).

@markalle
Copy link
Contributor

markalle commented Sep 9, 2020

Ah perfect, thanks. I saw the comment but was totally misreading the figure.

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.

5 participants