-
Notifications
You must be signed in to change notification settings - Fork 864
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
master and v4.0.x: what should happen when an app compiles with a removed MPI interface? #6278
Comments
We talked about this on the 2019-01-15 webex. Here's what we decided... There are 3 cases:
#if __STDC_VERSION__ >= 201101L
#define MPI_Address(a, b) _Static_assert (0, "MPI_Address was removed in MPI-3.0. Use MPI_Get_address instead")
#endif
|
in the third case, how do you expect the user can compile his code if |
In the 3rd case (where For example: $ mpicc --showme
gcc -I/home/jsquyres/bogus/include -pthread -Wl,-rpath -Wl,/home/jsquyres/bogus/lib -Wl,--enable-new-dtags -L/home/jsquyres/bogus/lib -lmpi
$ mpicc --version
gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# address.c is the example code from the beginning of this issue
$ mpicc -c address.c
address.c: In function ‘main’:
address.c:8:5: warning: implicit declaration of function ‘MPI_Address’; did you mean ‘MPI_Test’? [-Wimplicit-function-declaration]
MPI_Address(&a, &address);
^~~~~~~~~~~
MPI_Test
$ mpicc address.o -o address
$ |
There are two more options:
void MPI_Address(void*,void*)
__attribute__((error ("MPI_Address was removed from this MPI, use MPI_Get_address")));
extern int MPI_Address; But the error message is not that nice:
|
@bertwesarg Oh neat -- I didn't know about the Do you know how portable is this with other compilers? @gpaulsen This could be a 2nd option:
|
Neither PGI nor Clang accept it. No Intel at hand right now. |
Addresses open-mpi#6278 In v4.0.x we intended that if the user did not configure with --enable-mpi1-compatibility, that they would get a Fatal error, even though we are building those removed symbols into libmpi (to support MPI applications compiled and linked with v3.x) This commit changes the deprectated function attribute to instead use the error function attribute supported by many (but not all) compilers. If the compiler doesn't support this attribute they will just get an error trying to use a function that wasn't declared. Signed-off-by: Geoffrey Paulsen <[email protected]>
Addresses open-mpi#6278 In v4.0.x we intended that if the user did not configure with --enable-mpi1-compatibility, that they would get a Fatal error, even though we are building those removed symbols into libmpi. (to support MPI applications compiled and linked with v3.x) This commit changes removed MPI APIs to try to use either the error function attribute (if the compiler supports it) or to use use the C11 Static Assert (also if supported by the compiler) If the compiler doesn't offer this support, the user will instead just get an error trying to use a function that wasn't declared. Signed-off-by: Geoffrey Paulsen <[email protected]>
@gpaulsen That's backwards. It's actually: |
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]>
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]>
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]> (cherry-picked from 3d76b23)
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]>
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]> (cherry-picked from 3136a17)
Now that these PRs have been merged, can we close this issue? |
🎉 |
Refs open-mpi#6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]> (cherry-picked from 3136a17)
From #6120, @gpaulsen noticed that both v4.0.x and master only use the compiler "deprecated" attribute to mark removed MPI functions. Take the following example program:
Case 1: master, with MPI-1 compatibility disabled.
MPI_Address
are marked with the__deprecated__
compiler attribute.MPI_Address
are not included in the MPI library.Meaning:
MPI_Address
is not deprecated -- it's removed)I think it is anti-social to allow the compile to succeed when we know that the link will fail. I think we should somehow make the compile fail (see below).
Case 2: v4.0.x, with MPI-1 compatibility disabled
MPI_Address
are marked with the__deprecated__
compiler attribute.MPI_Address
are included in the MPI library.Meaning:
MPI_Address
is not deprecated -- it's removed)I'm not sure that this is the message that we want to convey to the community (i.e., that it's still ok to use the removed symbols -- i.e., if it's just a compiler warning, people will ignore it). I thought our intent was to raise the pain level (just a little) so that the greater MPI application community became aware of this issue. As such, my gut reaction is that we should make the compile fail.
Applications that were compiled against v3.0.x or v3.1.x (or even v4.0.x) with
MPI_Address
(etc.) will still work becauseMPI_Address
(etc.) are still in the MPI library. -- which is desirable.How to make the compile fail?
If we elect to make the compile fail, it's an open question on how to do this.
__deprecated___
function attribute is just a warning.#define MPI_Address(a,b) some kind of syntax error containing the helpful message
, but that's... tricky).Are these cases really what we want?
The text was updated successfully, but these errors were encountered: