-
Notifications
You must be signed in to change notification settings - Fork 931
Corrections to Fortran 2008 interfaces #5453
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
Corrections to Fortran 2008 interfaces #5453
Conversation
|
Can one of the admins verify this patch? |
|
ok to test |
|
@PhilippOtte Thanks for the PR! Please note that we have a "Signed off by" requirement on our commits to indicate that you agree to our contributors declaration: https://github.com/open-mpi/ompi/blob/master/.github/CONTRIBUTING.md#contributors-declaration |
| ! The sizeof interfaces | ||
|
|
||
| include "sizeof_f08.h" | ||
| ! include "sizeof_f08.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to comment this out? That doesn't seem correct.
|
The IBM CI (XL Compiler) build failed! Please review the log, linked below. Gist: https://gist.github.com/1d987ba950d7a00a542a6a6e1fa75a58 |
| BIND(C, name="ompi_iallgather_f") | ||
| implicit none | ||
| OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf | ||
| OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf, recvbuf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendbuf and recvbuf cannot be defined twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw, that too. I'm also getting a compile error that I'm puzzling over:
EDIT: See next comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops -- I originally pasted in the wrong compile error. This is the right one:
PPFC ialltoallw_f08.lo
ialltoallw_f08.F90:35:53:
call ompi_ialltoallw_f(sendbuf,sendcounts,sdispls,sendtypes(1)%MPI_VAL,&
1
Error: Rank mismatch in argument ‘sendtypes’ at (1) (rank-1 and scalar)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see the problem. Directed comment coming up...
| OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf | ||
| INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) | ||
| INTEGER, INTENT(IN), ASYNCHRONOUS :: sendtypes(*) | ||
| INTEGER, INTENT(IN), ASYNCHRONOUS :: recvtypes(*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You changed the types of sendtypes and recvtypes from scalars to arrays here. They were specifically scalars (in both ompi_alltoallw_f and ompi_ialltoallw_f) -- see the lengthy comment here: https://github.com/open-mpi/ompi/blob/master/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90#L24-L33
Yes, it's a hack, but there did not seem to be another performant way to get the values from one call to the other (i.e., without allocating a temporary array from the heap [because this is ialltoallw, and we'll return before sendtypes/recvtypes are finished being used], individually copying all the elements from sendtypes/recvtypes to the temporary array, and then passing the temporary array to the underlying call. Then there will need to be some kind of hook when the request completes to know to free that temporary array, too).
Is there a better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fortran allows you to obtain the address of the first element in an array via the intrinsic c_loc which returns a type(c_ptr) which is equivalent to a void pointer in C. There would be no copying involved and you would prevent the compiler from doing any unwanted magic there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add that to this PR? I'm wasn't enough of a Fortran expert to get that to work back when I originally wrote this stuff -- this hack was the best that I could come up with. 😳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Modern Fortran explained by Metcalf, Reid and Cohen the proposed way of using c_loc may lead to invalid pointers. So, your hack is probably the safer way of doing things.
|
Is there a safe way of signing off the unsigned commits or should I create a new branch with the changes in it and create a new PR? |
|
The IBM CI (XL Compiler) build failed! Please review the log, linked below. Gist: https://gist.github.com/f6d76331dd80495c769a46dabc151ac3 |
7f4db0b to
f2398a8
Compare
|
@ggouaillardet do you still request changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably squash the last 3 commits into the earlier commit(s). I.e., there's no real point in having a PR that makes change X in a commit, and then in a later commit on the same PR, removes change X.
|
Sorry -- meant to say: squash the last 2 commits. |
f2398a8 to
4d92c89
Compare
4d92c89 to
be6bb2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah -- this PR fell off my radar (because github doesn't mail us upon force pushes). Doh! This all looks good to me now. @ggouaillardet can you review? (you have a negative review on this PR, but I think everything is fixed now)
|
@ggouaillardet Can you re-review? All the problems have been fixed. |
|
@ggouaillardet Can you please re-review? |
|
@PhilippOtte Can you please rebase (again)? |
be6bb2a to
d632969
Compare
|
I just rebased -- we're now good. Just need a new review from @ggouaillardet |
|
Question, is this going to break binary compatibility with the older compiled apps? Even if this is more correct, if it breaks binary compatibility, this might trigger a new major release version bump. |
|
I'm not going to swear to it, but I don't think A Fortran expert should chime in here... (too funny: Firefox underlines Fortran like it's misspelled! 😆) |
|
the same changes have to be applied to Should this PR make it for |
Corrected the signatures of the collectives used by the Fortran 2008 interface to state correct intent for inout arguments and use the ASYNCHRONOUS attribute in non-blocking collective calls. Also corrected the C-bindings in Fortran accordingly Signed-off-by: Philipp Otte <philipp.j.otte@googlemail.com>
Corrected the signatures of the collectives used by the Fortran 2008 interface to state correct intent for inout arguments and use the ASYNCHRONOUS attribute in non-blocking collective calls. Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
d632969 to
f750c69
Compare
|
@jsquyres I fixed the signatures for the |
|
First round of answers from Fortran experts here say:
|
|
@gpaulsen is this something stated in the standard ? I might be a bit too paranoid/pedantic here, but unless stated in the standard, we should theoretically verify this technical choice was made on all supported compilers. |

Following changes were carried out in ompi/mpi/fortran/use-mpi-f08:
Important: I was not able to compile other parts of the code and could not check whether files compile but I think it would be wasted effort not to create a PR
Refs #5442