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

Remove from ABI, but keep in API #32

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Remove from ABI, but keep in API #32

wants to merge 3 commits into from

Conversation

dalcinl
Copy link
Collaborator

@dalcinl dalcinl commented Mar 19, 2024

This one is going to be controversial... but isn't it beautiful 😇 ?
Even if it is ultimately rejected, I believe it is worth to put into condideration.

Implemented so far:

  • Remove most deprecated types/constants/functions.
  • Add backward API compatibility #define's for the removals.
  • Add backward API compatibility static inline functions.

For further consideration:

  • MPI_Info_get[_valuelen]() are implemented with static inline functions. inline is not in C89, but in that case most compilers support the __inline keyword as an extension.
  • Maybe we could do #define MPI_T_ERR_INVALID_ITEM MPI_T_ERR_INVALID_INDEX to get rid of the deprecated enum value?
  • What to do with MPI_HOST? Maybe #define MPI_HOST MPI_KEYVAL_INVALID to defer failure to runtime?

mpi.h Outdated
#define MPI_Status_set_elements_x MPI_Status_set_elements_c
#define MPI_Type_get_extent_x MPI_Type_get_extent_c
#define MPI_Type_get_true_extent_x MPI_Type_get_true_extent_c
#define MPI_Type_size_x MPI_Type_size_c
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am against this. Either you want to include them, then declare them explicitly and treat them as regular abi symbols; or remove them completely and do not support legacy code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • These symbols cannot be removed in 4.2, they have been just deprecated so far. Moreover, a full removal will do nothing more than harm users.
  • But this stuff is deprecated, and we would like to somehow start to get rid of it or discourage use, right? If we keep this stuff, we will probably have to keep it FOREVER. In the future, we are not going to break the ABI compatibility of the library just for removing silly deprecated routines added 30 years ago or workarounds no longer needed like the _x routines. As I said in the meeting, MPI 3.0 was the only version to actually remove things and break APIs and ABIs. MPICH did not went along with it. Open MPI did, and that unravel some minor level of misery on end users. I do remember PETSc folks rushing for a workaround to fix the creation of a struct datatype.

This change is a very good compromise between removal, and keeping support forever.

  • To use the ABI, applications have to be recompiled anyway.
  • Upon recompilation, most code will not notice in practice that a bunch of long deprecated stuff are now preprocessor aliases.
  • User binaries will reference the new replacement symbols.
  • MPI implementations will not have to care about implementing and supporting this deprecated stuff, at least under the ABI (not every implementation generates bindings with scripts).

Copy link
Collaborator

@hzhou hzhou Mar 20, 2024

Choose a reason for hiding this comment

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

You are effectively removing deprecated functions. The aliases are just one of the workaround for patching code. I don't have an opinion one way or another. This should be up to the forum to decide.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are effectively removing deprecated functions.

Yes, I'm removing them from the C ABI, but not quite from the C API, in the sense that user code compiles unmodified to avoid any pain and grief. The produced binaries will not have any references to the old stuff.

This should be up to the forum to decide.

Definitely. I'm just submitting PRs to open up the discussion, and to make the point with actual code that user applications (mpi4py so far, and only for the _x functions) can happily compile.

@dalcinl dalcinl marked this pull request as draft March 20, 2024 15:57
@dalcinl dalcinl force-pushed the rm-deprecated branch 6 times, most recently from 0e6ea26 to 309285d Compare March 21, 2024 13:06
@jeffhammond
Copy link
Member

Maybe we could do #define MPI_T_ERR_INVALID_ITEM MPI_T_ERR_INVALID_ITEM to get rid of the deprecated enum value?

What?

@dalcinl
Copy link
Collaborator Author

dalcinl commented Apr 21, 2024

Maybe we could do #define MPI_T_ERR_INVALID_ITEM MPI_T_ERR_INVALID_ITEM to get rid of the deprecated enum value?

What?

Sorry, bad copy & paste, I meant

#define MPI_T_ERR_INVALID_ITEM MPI_T_ERR_INVALID_INDEX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants