-
Notifications
You must be signed in to change notification settings - Fork 936
v4.0.x: fortran.m4: disallow when sizeof(int) != sizeof(INTEGER) #7922
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
v4.0.x: fortran.m4: disallow when sizeof(int) != sizeof(INTEGER) #7922
Conversation
|
Are you sure you want My understanding is the issue only occurs with the |
I guess that's the question: what would a user expect?
I guess we have (lots of) precedent for having only things that are possible to be available. It still feels a little weird in this case, but I can't put my finger on the reason why. Bottom line: I don't have a good argument against your suggestion, so I'll update this PR per your suggestion. |
|
I think suddenly not building the f08 bindings in the 4.0.x series would be unexpected. I would suggest we do like we used to with C++, where we include the check and abort, but if the user disables the f08 bindings, then we don't run the check. If that is possible; can't remember if we have that much fine grained control over which bindings get built. |
Yes, I think we have this level of granularity. I will check. |
|
IIRC, the logic for the Fortran bindings is "by default, build all you can". This is why I suggested we do not build |
|
FWIW, we do offer the desired granularity: I'm guessing that people who compile Open MPI with INTEGER=8 bytes and int4 bytes is pretty small. So we're probably talking about a change that only affects a small number of users. I think Gilles is right to cite our "build everything you can, and mention-but-ignore what you can't build" philosophy. We have lots of precedence for that. Per Brian's point: not building the The real issue here might be the decision not to fix this error (and simply decide not to build @bwbarrett Do you feel strongly about this? |
|
I feel strongly that a customer will be confused if they have f08 bindings with 4.0.4 and 4.0.5 with the exact same configure arguments results in no f08 bindings. I think something like the following in the 4.x branches whenever we detect the mismatch:
That way, no one gets surprised, but also no one has to do much work. |
NOTE: This is intentionally not a cherry pick from master. See below. There is a problem with the mpi_f08 module when sizeof(int) != sizeof(INTEGER): the size of TYPE(MPI_Status) is too small. This causes buffer overruns when Open MPI is configured with (for example) sizeof(int)==4 and sizeof(INTEGER)==8, and then you call the mpi_f08 MPI_RECV subroutine. This will end up copying the resulting C MPI_Status to the buffer pointing to the Fortran status, but the code does not know if the Fortran status is an mpif.h status or a TYPE(MPI_Status) -- it just blindly copies over as if the Fortran status is an INTEGER array of length MPI_STATUS_SIZE. Unfortunately, TYPE(MPI_Status) is actually smaller than this, so we overrun the buffer. Hilarity ensues. The simple fix for this is to make TYPE(MPI_Status) the same size as INTEGER(MPI_STATUS_SIZE), but we can't do that here on the release branch because it will break ABI. This commit does the following: - checks to see if we're in a sizeof(int) != sizeof(INTEGER) scenario - if so, if the user has not specifically excluded building the mpi_f08 module, display a Giant Error Message (GEM) and abort configure. This is unusual; we don't usually abort configure when feature XYZ can't be built -- if the user didn't specifically ask for XYZ, we just emit a notice that we won't build XYZ and continue. This situation is a little different because we're on a release branch: prior releases have built mpi_f08 by default -- even in this "bad" scenario. Hence, in this case, we explicitly tell the user that this is now a known-bad scenario and abort. In the GEM, we give the user two options: 1. Change their compiler flags so that sizeof(int) == sizeof(INTEGER) and re-run configure, or 2. Explicitly disable the mpi_f08 module via --enable-mpi-fortran=usempi Thanks to @ahaichen for reporting the issue. Note: the proper fix has been implemented on master (i.e., what will become v5.0.0), but since that breaks ABI, we can't cherry pick it back here to an existing release branch series. Signed-off-by: Jeff Squyres <[email protected]>
affa853 to
27836a6
Compare
|
Here's what the new error message looks like: |
NOTE: This is intentionally not a cherry pick from master. See below.
There is a problem with the mpi_f08 module when sizeof(int) !=
sizeof(INTEGER): the size of TYPE(MPI_Status) is too small. This
causes buffer overruns when Open MPI is configured with (for example)
sizeof(int)==4 and sizeof(INTEGER)==8, and then you call the mpi_f08
MPI_RECV subroutine. This will end up copying the resulting C
MPI_Status to the buffer pointing to the Fortran status, but the code
does not know if the Fortran status is an mpif.h status or a
TYPE(MPI_Status) -- it just blindly copies over as if the Fortran
status is an INTEGER array of length MPI_STATUS_SIZE. Unfortunately,
TYPE(MPI_Status) is actually smaller than this, so we overrun the
buffer. Hilarity ensues.
The simple fix for this is to make TYPE(MPI_Status) the same size as
INTEGER(MPI_STATUS_SIZE), but we can't do that here on the release
branch because it will break ABI.
This commit does the following:
mpi_f08 module, display a Giant Error Message (GEM) and abort
configure.
This is unusual; we don't usually abort configure when feature XYZ
can't be built -- if the user didn't specifically ask for XYZ, we
just emit a notice that we won't build XYZ and continue.
This situation is a little different because we're on a release
branch: prior releases have built mpi_f08 by default -- even in this
"bad" scenario. Hence, in this case, we explicitly tell the user that
this is now a known-bad scenario and abort. In the GEM, we give the
user two options:
and re-run configure, or
Thanks to @ahaichen for reporting the issue.
Note: the proper fix has been implemented on master (i.e., what will
become v5.0.0), but since that breaks ABI, we can't cherry pick it
back here to an existing release branch series.
Signed-off-by: Jeff Squyres [email protected]
Refs #7918