From cb7d5faf09e1bc479d4b8a11751409e430f17444 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Thu, 6 Mar 2025 23:13:14 +0300 Subject: [PATCH 1/4] Remove most deprecated types/constants/functions * Add backward API compatibility #define's. * MPI_Info_get[_valuelen]() may also be doable. --- .github/workflows/mpi4py.yml | 4 +-- mpi.h | 58 ++++++++++++++++++++---------------- mpistubs.c | 20 ------------- 3 files changed, 35 insertions(+), 47 deletions(-) diff --git a/.github/workflows/mpi4py.yml b/.github/workflows/mpi4py.yml index c462803..954fa1f 100644 --- a/.github/workflows/mpi4py.yml +++ b/.github/workflows/mpi4py.yml @@ -92,8 +92,8 @@ jobs: ncx=$(nm $module | awk '/ MPI_.*_x$/' | wc -l) ncc=$(nm $module | awk '/ MPI_.*_c$/' | wc -l) test $nci -ge 149 - test $ncx -eq 5 - test $ncc -eq 0 + test $ncx -eq 0 + test $ncc -eq 5 - name: Test mpi4py module (small-count) shell: python {0} diff --git a/mpi.h b/mpi.h index 6a2f0d4..5840a5b 100644 --- a/mpi.h +++ b/mpi.h @@ -440,8 +440,6 @@ typedef int (MPI_Grequest_query_function)(void *extra_state, MPI_Status *status) typedef int (MPI_Grequest_free_function)(void *extra_state); typedef int (MPI_Grequest_cancel_function)(void *extra_state, int complete); -typedef int (MPI_Copy_function)(MPI_Comm comm, int keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag); /* deprecated: MPI-2.0 */ -typedef int (MPI_Delete_function)(MPI_Comm omm, int keyval, void *attribute_val, void *extra_state); /* deprecated: MPI-2.0 */ typedef int (MPI_Comm_copy_attr_function)(MPI_Comm comm, int keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag); typedef int (MPI_Comm_delete_attr_function)(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); typedef int (MPI_Type_copy_attr_function)(MPI_Datatype datatype, int keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag); @@ -463,9 +461,6 @@ typedef MPI_File_errhandler_function MPI_File_errhandler_fn; typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn; typedef MPI_Session_errhandler_function MPI_Session_errhandler_fn; -#define MPI_NULL_COPY_FN ((MPI_Copy_function*)0x0) /* deprecated: MPI-2.0 */ -#define MPI_DUP_FN ((MPI_Copy_function*)0x1) /* deprecated: MPI-2.0 */ -#define MPI_NULL_DELETE_FN ((MPI_Delete_function*)0x0) /* deprecated: MPI-2.0 */ #define MPI_COMM_NULL_COPY_FN ((MPI_Comm_copy_attr_function*)0x0) #define MPI_COMM_DUP_FN ((MPI_Comm_copy_attr_function*)0x1) #define MPI_COMM_NULL_DELETE_FN ((MPI_Comm_delete_attr_function*)0x0) @@ -593,9 +588,6 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls int MPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm); int MPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request); int MPI_Alltoallw_init_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request); -int MPI_Attr_delete(MPI_Comm comm, int keyval); /* deprecated: MPI-2.0 */ -int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag); /* deprecated: MPI-2.0 */ -int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val); /* deprecated: MPI-2.0 */ int MPI_Barrier(MPI_Comm comm); int MPI_Barrier_init(MPI_Comm comm, MPI_Info info, MPI_Request *request); int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm); @@ -787,7 +779,6 @@ int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count); int MPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); int MPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count); int MPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); -int MPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); /* deprecated: MPI-4.1 */ int MPI_Get_hw_resource_info(MPI_Info *hw_info); int MPI_Get_library_version(char *version, int *resultlen); int MPI_Get_processor_name(char *name, int *resultlen); @@ -892,8 +883,6 @@ int MPI_Isendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dest, int MPI_Isendrecv_replace_c(void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request); int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); int MPI_Issend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); -int MPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state); /* deprecated: MPI-2.0 */ -int MPI_Keyval_free(int *keyval); /* deprecated: MPI-2.0 */ int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name); int MPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Status *status); int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Status *status); @@ -1033,7 +1022,6 @@ int MPI_Status_get_tag(MPI_Status *status, int *tag); int MPI_Status_set_cancelled(MPI_Status *status, int flag); int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); int MPI_Status_set_elements_c(MPI_Status *status, MPI_Datatype datatype, MPI_Count count); -int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count); /* deprecated: MPI-4.1 */ int MPI_Status_set_error(MPI_Status *status, int error); int MPI_Status_set_source(MPI_Status *status, int source); int MPI_Status_set_tag(MPI_Status *status, int tag); @@ -1077,11 +1065,9 @@ int MPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_add int MPI_Type_get_envelope_c(MPI_Datatype datatype, MPI_Count *num_integers, MPI_Count *num_addresses, MPI_Count *num_large_counts, MPI_Count *num_datatypes, int *combiner); int MPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent); int MPI_Type_get_extent_c(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent); -int MPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent); /* deprecated: MPI-4.1 */ int MPI_Type_get_name(MPI_Datatype datatype, char *type_name, int *resultlen); int MPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent); int MPI_Type_get_true_extent_c(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent); -int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent); /* deprecated: MPI-4.1 */ int MPI_Type_get_value_index(MPI_Datatype value_type, MPI_Datatype index_type, MPI_Datatype *pair_type); int MPI_Type_indexed(int count, const int array_of_blocklengths[], const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype); int MPI_Type_indexed_c(MPI_Count count, const MPI_Count array_of_blocklengths[], const MPI_Count array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype); @@ -1090,7 +1076,6 @@ int MPI_Type_set_attr(MPI_Datatype datatype, int type_keyval, void *attribute_va int MPI_Type_set_name(MPI_Datatype datatype, const char *type_name); int MPI_Type_size(MPI_Datatype datatype, int *size); int MPI_Type_size_c(MPI_Datatype datatype, MPI_Count *size); -int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size); /* deprecated: MPI-4.1 */ int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype); int MPI_Type_vector_c(MPI_Count count, MPI_Count blocklength, MPI_Count stride, MPI_Datatype oldtype, MPI_Datatype *newtype); int MPI_Unpack(const void *inbuf, int insize, int *position, void *outbuf, int outcount, MPI_Datatype datatype, MPI_Comm comm); @@ -1259,9 +1244,6 @@ int PMPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispl int PMPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm); int PMPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request); int PMPI_Alltoallw_init_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request); -int PMPI_Attr_delete(MPI_Comm comm, int keyval); -int PMPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag); -int PMPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val); int PMPI_Barrier(MPI_Comm comm); int PMPI_Barrier_init(MPI_Comm comm, MPI_Info info, MPI_Request *request); int PMPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm); @@ -1453,7 +1435,6 @@ int PMPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count); int PMPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); int PMPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count); int PMPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); -int PMPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count); int PMPI_Get_hw_resource_info(MPI_Info *hw_info); int PMPI_Get_library_version(char *version, int *resultlen); int PMPI_Get_processor_name(char *name, int *resultlen); @@ -1558,8 +1539,6 @@ int PMPI_Isendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dest int PMPI_Isendrecv_replace_c(void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request); int PMPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); int PMPI_Issend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); -int PMPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state); -int PMPI_Keyval_free(int *keyval); int PMPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name); int PMPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Status *status); int PMPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Status *status); @@ -1699,7 +1678,6 @@ int PMPI_Status_get_tag(MPI_Status *status, int *tag); int PMPI_Status_set_cancelled(MPI_Status *status, int flag); int PMPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); int PMPI_Status_set_elements_c(MPI_Status *status, MPI_Datatype datatype, MPI_Count count); -int PMPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count); int PMPI_Status_set_error(MPI_Status *status, int error); int PMPI_Status_set_source(MPI_Status *status, int source); int PMPI_Status_set_tag(MPI_Status *status, int tag); @@ -1743,11 +1721,9 @@ int PMPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_ad int PMPI_Type_get_envelope_c(MPI_Datatype datatype, MPI_Count *num_integers, MPI_Count *num_addresses, MPI_Count *num_large_counts, MPI_Count *num_datatypes, int *combiner); int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent); int PMPI_Type_get_extent_c(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent); -int PMPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent); int PMPI_Type_get_name(MPI_Datatype datatype, char *type_name, int *resultlen); int PMPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent); int PMPI_Type_get_true_extent_c(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent); -int PMPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent); int PMPI_Type_get_value_index(MPI_Datatype value_type, MPI_Datatype index_type, MPI_Datatype *pair_type); int PMPI_Type_indexed(int count, const int array_of_blocklengths[], const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype); int PMPI_Type_indexed_c(MPI_Count count, const MPI_Count array_of_blocklengths[], const MPI_Count array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype); @@ -1756,7 +1732,6 @@ int PMPI_Type_set_attr(MPI_Datatype datatype, int type_keyval, void *attribute_v int PMPI_Type_set_name(MPI_Datatype datatype, const char *type_name); int PMPI_Type_size(MPI_Datatype datatype, int *size); int PMPI_Type_size_c(MPI_Datatype datatype, MPI_Count *size); -int PMPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size); int PMPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype); int PMPI_Type_vector_c(MPI_Count count, MPI_Count blocklength, MPI_Count stride, MPI_Datatype oldtype, MPI_Datatype *newtype); int PMPI_Unpack(const void *inbuf, int insize, int *position, void *outbuf, int outcount, MPI_Datatype datatype, MPI_Comm comm); @@ -1891,6 +1866,39 @@ int PMPI_T_source_get_info(int source_index, char *name, int *name_len, char *de int PMPI_T_source_get_num(int *num_sources); int PMPI_T_source_get_timestamp(int source_index, MPI_Count *timestamp); +/* Backward-compatibility MPI API definitions for MPI ABI removals */ + +/* MPI deprecated types and constants */ +#define MPI_Copy_function MPI_Comm_copy_attr_function +#define MPI_Delete_function MPI_Comm_delete_attr_function +#define MPI_NULL_COPY_FN MPI_COMM_NULL_COPY_FN +#define MPI_DUP_FN MPI_COMM_DUP_FN +#define MPI_NULL_DELETE_FN MPI_COMM_NULL_DELETE_FN + +/* MPI deprecated functions */ +#define MPI_Attr_delete MPI_Comm_delete_attr +#define MPI_Attr_get MPI_Comm_get_attr +#define MPI_Attr_put MPI_Comm_set_attr +#define MPI_Get_elements_x MPI_Get_elements_c +#define MPI_Keyval_create MPI_Comm_create_keyval +#define MPI_Keyval_free MPI_Comm_free_keyval +#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 + +/* PMPI deprecated functions */ +#define PMPI_Attr_delete PMPI_Comm_delete_attr +#define PMPI_Attr_get PMPI_Comm_get_attr +#define PMPI_Attr_put PMPI_Comm_set_attr +#define PMPI_Get_elements_x PMPI_Get_elements_c +#define PMPI_Keyval_create PMPI_Comm_create_keyval +#define PMPI_Keyval_free PMPI_Comm_free_keyval +#define PMPI_Status_set_elements_x PMPI_Status_set_elements_c +#define PMPI_Type_get_extent_x PMPI_Type_get_extent_c +#define PMPI_Type_get_true_extent_x PMPI_Type_get_true_extent_c +#define PMPI_Type_size_x PMPI_Type_size_c + #if defined(__cplusplus) } #endif diff --git a/mpistubs.c b/mpistubs.c index ae7c1a6..36b26e3 100644 --- a/mpistubs.c +++ b/mpistubs.c @@ -35,9 +35,6 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls int MPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm) { abort(); return 0; } int MPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } int MPI_Alltoallw_init_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } -int MPI_Attr_delete(MPI_Comm comm, int keyval) { abort(); return 0; } -int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) { abort(); return 0; } -int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) { abort(); return 0; } int MPI_Barrier(MPI_Comm comm) { abort(); return 0; } int MPI_Barrier_init(MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) { abort(); return 0; } @@ -229,7 +226,6 @@ int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count) { int MPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } int MPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count) { abort(); return 0; } int MPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } -int MPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } int MPI_Get_hw_resource_info(MPI_Info *hw_info) { abort(); return 0; } int MPI_Get_library_version(char *version, int *resultlen) { abort(); return 0; } int MPI_Get_processor_name(char *name, int *resultlen) { abort(); return 0; } @@ -334,8 +330,6 @@ int MPI_Isendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dest, int MPI_Isendrecv_replace_c(void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } int MPI_Issend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } -int MPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state) { abort(); return 0; } -int MPI_Keyval_free(int *keyval) { abort(); return 0; } int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name) { abort(); return 0; } int MPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Status *status) { abort(); return 0; } int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Status *status) { abort(); return 0; } @@ -475,7 +469,6 @@ int MPI_Status_get_tag(MPI_Status *status, int *tag) { abort(); return 0; } int MPI_Status_set_cancelled(MPI_Status *status, int flag) { abort(); return 0; } int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count) { abort(); return 0; } int MPI_Status_set_elements_c(MPI_Status *status, MPI_Datatype datatype, MPI_Count count) { abort(); return 0; } -int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count) { abort(); return 0; } int MPI_Status_set_error(MPI_Status *status, int error) { abort(); return 0; } int MPI_Status_set_source(MPI_Status *status, int source) { abort(); return 0; } int MPI_Status_set_tag(MPI_Status *status, int tag) { abort(); return 0; } @@ -519,11 +512,9 @@ int MPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_add int MPI_Type_get_envelope_c(MPI_Datatype datatype, MPI_Count *num_integers, MPI_Count *num_addresses, MPI_Count *num_large_counts, MPI_Count *num_datatypes, int *combiner) { abort(); return 0; } int MPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent) { abort(); return 0; } int MPI_Type_get_extent_c(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent) { abort(); return 0; } -int MPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent) { abort(); return 0; } int MPI_Type_get_name(MPI_Datatype datatype, char *type_name, int *resultlen) { abort(); return 0; } int MPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent) { abort(); return 0; } int MPI_Type_get_true_extent_c(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent) { abort(); return 0; } -int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent) { abort(); return 0; } int MPI_Type_get_value_index(MPI_Datatype value_type, MPI_Datatype index_type, MPI_Datatype *pair_type) { abort(); return 0; } int MPI_Type_indexed(int count, const int array_of_blocklengths[], const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int MPI_Type_indexed_c(MPI_Count count, const MPI_Count array_of_blocklengths[], const MPI_Count array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } @@ -532,7 +523,6 @@ int MPI_Type_set_attr(MPI_Datatype datatype, int type_keyval, void *attribute_va int MPI_Type_set_name(MPI_Datatype datatype, const char *type_name) { abort(); return 0; } int MPI_Type_size(MPI_Datatype datatype, int *size) { abort(); return 0; } int MPI_Type_size_c(MPI_Datatype datatype, MPI_Count *size) { abort(); return 0; } -int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) { abort(); return 0; } int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int MPI_Type_vector_c(MPI_Count count, MPI_Count blocklength, MPI_Count stride, MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int MPI_Unpack(const void *inbuf, int insize, int *position, void *outbuf, int outcount, MPI_Datatype datatype, MPI_Comm comm) { abort(); return 0; } @@ -701,9 +691,6 @@ int PMPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispl int PMPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm) { abort(); return 0; } int PMPI_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } int PMPI_Alltoallw_init_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } -int PMPI_Attr_delete(MPI_Comm comm, int keyval) { abort(); return 0; } -int PMPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) { abort(); return 0; } -int PMPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) { abort(); return 0; } int PMPI_Barrier(MPI_Comm comm) { abort(); return 0; } int PMPI_Barrier_init(MPI_Comm comm, MPI_Info info, MPI_Request *request) { abort(); return 0; } int PMPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) { abort(); return 0; } @@ -895,7 +882,6 @@ int PMPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count) int PMPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } int PMPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count) { abort(); return 0; } int PMPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } -int PMPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) { abort(); return 0; } int PMPI_Get_hw_resource_info(MPI_Info *hw_info) { abort(); return 0; } int PMPI_Get_library_version(char *version, int *resultlen) { abort(); return 0; } int PMPI_Get_processor_name(char *name, int *resultlen) { abort(); return 0; } @@ -1000,8 +986,6 @@ int PMPI_Isendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dest int PMPI_Isendrecv_replace_c(void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } int PMPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } int PMPI_Issend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) { abort(); return 0; } -int PMPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state) { abort(); return 0; } -int PMPI_Keyval_free(int *keyval) { abort(); return 0; } int PMPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name) { abort(); return 0; } int PMPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Status *status) { abort(); return 0; } int PMPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Status *status) { abort(); return 0; } @@ -1141,7 +1125,6 @@ int PMPI_Status_get_tag(MPI_Status *status, int *tag) { abort(); return 0; } int PMPI_Status_set_cancelled(MPI_Status *status, int flag) { abort(); return 0; } int PMPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count) { abort(); return 0; } int PMPI_Status_set_elements_c(MPI_Status *status, MPI_Datatype datatype, MPI_Count count) { abort(); return 0; } -int PMPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count) { abort(); return 0; } int PMPI_Status_set_error(MPI_Status *status, int error) { abort(); return 0; } int PMPI_Status_set_source(MPI_Status *status, int source) { abort(); return 0; } int PMPI_Status_set_tag(MPI_Status *status, int tag) { abort(); return 0; } @@ -1185,11 +1168,9 @@ int PMPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_ad int PMPI_Type_get_envelope_c(MPI_Datatype datatype, MPI_Count *num_integers, MPI_Count *num_addresses, MPI_Count *num_large_counts, MPI_Count *num_datatypes, int *combiner) { abort(); return 0; } int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent) { abort(); return 0; } int PMPI_Type_get_extent_c(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent) { abort(); return 0; } -int PMPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent) { abort(); return 0; } int PMPI_Type_get_name(MPI_Datatype datatype, char *type_name, int *resultlen) { abort(); return 0; } int PMPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent) { abort(); return 0; } int PMPI_Type_get_true_extent_c(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent) { abort(); return 0; } -int PMPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent) { abort(); return 0; } int PMPI_Type_get_value_index(MPI_Datatype value_type, MPI_Datatype index_type, MPI_Datatype *pair_type) { abort(); return 0; } int PMPI_Type_indexed(int count, const int array_of_blocklengths[], const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int PMPI_Type_indexed_c(MPI_Count count, const MPI_Count array_of_blocklengths[], const MPI_Count array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } @@ -1198,7 +1179,6 @@ int PMPI_Type_set_attr(MPI_Datatype datatype, int type_keyval, void *attribute_v int PMPI_Type_set_name(MPI_Datatype datatype, const char *type_name) { abort(); return 0; } int PMPI_Type_size(MPI_Datatype datatype, int *size) { abort(); return 0; } int PMPI_Type_size_c(MPI_Datatype datatype, MPI_Count *size) { abort(); return 0; } -int PMPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) { abort(); return 0; } int PMPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int PMPI_Type_vector_c(MPI_Count count, MPI_Count blocklength, MPI_Count stride, MPI_Datatype oldtype, MPI_Datatype *newtype) { abort(); return 0; } int PMPI_Unpack(const void *inbuf, int insize, int *position, void *outbuf, int outcount, MPI_Datatype datatype, MPI_Comm comm) { abort(); return 0; } From 36837eaaca45edebbdea578061a82244ae66f3d0 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Thu, 6 Mar 2025 23:13:14 +0300 Subject: [PATCH 2/4] Remove MPI_Info_get() and MPI_Info_get_valuelen() --- mpi.h | 36 ++++++++++++++++++++++++++++++++---- mpistubs.c | 4 ---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/mpi.h b/mpi.h index 5840a5b..8f761f9 100644 --- a/mpi.h +++ b/mpi.h @@ -845,11 +845,9 @@ int MPI_Info_create_env(int argc, char *argv[], MPI_Info *info); int MPI_Info_delete(MPI_Info info, const char *key); int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo); int MPI_Info_free(MPI_Info *info); -int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag); /* deprecated: MPI-4.0 */ int MPI_Info_get_nkeys(MPI_Info info, int *nkeys); int MPI_Info_get_nthkey(MPI_Info info, int n, char *key); int MPI_Info_get_string(MPI_Info info, const char *key, int *buflen, char *value, int *flag); -int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag); /* deprecated: MPI-4.0 */ int MPI_Info_set(MPI_Info info, const char *key, const char *value); int MPI_Init(int *argc, char ***argv); int MPI_Init_thread(int *argc, char ***argv, int required, int *provided); @@ -1501,11 +1499,9 @@ int PMPI_Info_create_env(int argc, char *argv[], MPI_Info *info); int PMPI_Info_delete(MPI_Info info, const char *key); int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo); int PMPI_Info_free(MPI_Info *info); -int PMPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag); int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys); int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key); int PMPI_Info_get_string(MPI_Info info, const char *key, int *buflen, char *value, int *flag); -int PMPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag); int PMPI_Info_set(MPI_Info info, const char *key, const char *value); int PMPI_Init(int *argc, char ***argv); int PMPI_Init_thread(int *argc, char ***argv, int required, int *provided); @@ -1868,6 +1864,14 @@ int PMPI_T_source_get_timestamp(int source_index, MPI_Count *timestamp); /* Backward-compatibility MPI API definitions for MPI ABI removals */ +#if !defined(MPI_ABI_static_inline) +# if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) +# define MPI_ABI_static_inline static inline +# else +# define MPI_ABI_static_inline static __inline +# endif +#endif + /* MPI deprecated types and constants */ #define MPI_Copy_function MPI_Comm_copy_attr_function #define MPI_Delete_function MPI_Comm_delete_attr_function @@ -1887,6 +1891,18 @@ int PMPI_T_source_get_timestamp(int source_index, MPI_Count *timestamp); #define MPI_Type_get_true_extent_x MPI_Type_get_true_extent_c #define MPI_Type_size_x MPI_Type_size_c +MPI_ABI_static_inline int MPI_Info_get(MPI_Info MPI_info, const char *MPI_key, int MPI_valuelen, char *MPI_value, int *MPI_flag) { + int MPI_buflen = MPI_valuelen + 1; + return MPI_Info_get_string(MPI_info, MPI_key, &MPI_buflen, MPI_value, MPI_flag); +} + +MPI_ABI_static_inline int MPI_Info_get_valuelen(MPI_Info MPI_info, const char *MPI_key, int *MPI_valuelen, int *MPI_flag) { + int MPI_ierr; int MPI_buflen = 0; char MPI_value[1] = {0}; + MPI_ierr = MPI_Info_get_string(MPI_info, MPI_key, MPI_valuelen ? &MPI_buflen : MPI_valuelen, MPI_value, MPI_flag); + if (MPI_ierr == MPI_SUCCESS && MPI_valuelen) *MPI_valuelen = MPI_buflen - 1; + return MPI_ierr; +} + /* PMPI deprecated functions */ #define PMPI_Attr_delete PMPI_Comm_delete_attr #define PMPI_Attr_get PMPI_Comm_get_attr @@ -1899,6 +1915,18 @@ int PMPI_T_source_get_timestamp(int source_index, MPI_Count *timestamp); #define PMPI_Type_get_true_extent_x PMPI_Type_get_true_extent_c #define PMPI_Type_size_x PMPI_Type_size_c +MPI_ABI_static_inline int PMPI_Info_get(MPI_Info MPI_info, const char *MPI_key, int MPI_valuelen, char *MPI_value, int *MPI_flag) { + int MPI_buflen = MPI_valuelen + 1; + return PMPI_Info_get_string(MPI_info, MPI_key, &MPI_buflen, MPI_value, MPI_flag); +} + +MPI_ABI_static_inline int PMPI_Info_get_valuelen(MPI_Info MPI_info, const char *MPI_key, int *MPI_valuelen, int *MPI_flag) { + int MPI_ierr; int MPI_buflen = 0; char MPI_value[1] = {0}; + MPI_ierr = PMPI_Info_get_string(MPI_info, MPI_key, MPI_valuelen ? &MPI_buflen : MPI_valuelen, MPI_value, MPI_flag); + if (MPI_ierr == MPI_SUCCESS && MPI_valuelen) *MPI_valuelen = MPI_buflen - 1; + return MPI_ierr; +} + #if defined(__cplusplus) } #endif diff --git a/mpistubs.c b/mpistubs.c index 36b26e3..ae45fb3 100644 --- a/mpistubs.c +++ b/mpistubs.c @@ -292,11 +292,9 @@ int MPI_Info_create_env(int argc, char *argv[], MPI_Info *info) { abort(); retur int MPI_Info_delete(MPI_Info info, const char *key) { abort(); return 0; } int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { abort(); return 0; } int MPI_Info_free(MPI_Info *info) { abort(); return 0; } -int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag) { abort(); return 0; } int MPI_Info_get_nkeys(MPI_Info info, int *nkeys) { abort(); return 0; } int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) { abort(); return 0; } int MPI_Info_get_string(MPI_Info info, const char *key, int *buflen, char *value, int *flag) { abort(); return 0; } -int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag) { abort(); return 0; } int MPI_Info_set(MPI_Info info, const char *key, const char *value) { abort(); return 0; } int MPI_Init(int *argc, char ***argv) { abort(); return 0; } int MPI_Init_thread(int *argc, char ***argv, int required, int *provided) { abort(); return 0; } @@ -948,11 +946,9 @@ int PMPI_Info_create_env(int argc, char *argv[], MPI_Info *info) { abort(); retu int PMPI_Info_delete(MPI_Info info, const char *key) { abort(); return 0; } int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { abort(); return 0; } int PMPI_Info_free(MPI_Info *info) { abort(); return 0; } -int PMPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag) { abort(); return 0; } int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys) { abort(); return 0; } int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key) { abort(); return 0; } int PMPI_Info_get_string(MPI_Info info, const char *key, int *buflen, char *value, int *flag) { abort(); return 0; } -int PMPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag) { abort(); return 0; } int PMPI_Info_set(MPI_Info info, const char *key, const char *value) { abort(); return 0; } int PMPI_Init(int *argc, char ***argv) { abort(); return 0; } int PMPI_Init_thread(int *argc, char ***argv, int required, int *provided) { abort(); return 0; } From 41536584057ebc915612ea63b244bbfd833ff570 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Thu, 6 Mar 2025 23:13:14 +0300 Subject: [PATCH 3/4] Add headers collecting compatibility for removals and deprecations --- mpi-api-deprecated.h | 82 +++++++++++++++++++++++++++++++++++++++ mpi-api-removed.h | 92 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 mpi-api-deprecated.h create mode 100644 mpi-api-removed.h diff --git a/mpi-api-deprecated.h b/mpi-api-deprecated.h new file mode 100644 index 0000000..46106f5 --- /dev/null +++ b/mpi-api-deprecated.h @@ -0,0 +1,82 @@ +#pragma once + +#if !defined(MPI_ABI_static_inline) +# if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) +# define MPI_ABI_static_inline static inline +# else +# define MPI_ABI_static_inline static __inline +# endif +#endif + +/* MPI deprecated types and constants */ + +#define MPI_Copy_function MPI_Comm_copy_attr_function +#define MPI_Delete_function MPI_Comm_delete_attr_function +#define MPI_DUP_FN MPI_COMM_DUP_FN +#define MPI_NULL_COPY_FN MPI_COMM_NULL_COPY_FN +#define MPI_NULL_DELETE_FN MPI_COMM_NULL_DELETE_FN + +#define MPI_HOST MPI_KEYVAL_INVALID +#define MPI_T_ERR_INVALID_ITEM MPI_T_ERR_INVALID_INDEX + +/* MPI deprecated functions */ + +#define MPI_Attr_delete MPI_Comm_delete_attr +#define MPI_Attr_get MPI_Comm_get_attr +#define MPI_Attr_put MPI_Comm_set_attr + +#define MPI_Keyval_create MPI_Comm_create_keyval +#define MPI_Keyval_free MPI_Comm_free_keyval + +#define MPI_Get_elements_x MPI_Get_elements_c +#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 + +#define MPI_Info_get MPI_ABI_Info_get +#define MPI_Info_get_valuelen MPI_ABI_Info_get_valuelen + +MPI_ABI_static_inline int MPI_Info_get(MPI_Info MPI_info, const char *MPI_key, int MPI_valuelen, char *MPI_value, int *MPI_flag) { + int MPI_buflen = MPI_valuelen + 1; + return MPI_Info_get_string(MPI_info, MPI_key, &MPI_buflen, MPI_value, MPI_flag); +} + +MPI_ABI_static_inline int MPI_Info_get_valuelen(MPI_Info MPI_info, const char *MPI_key, int *MPI_valuelen, int *MPI_flag) { + int MPI_ierr; int MPI_buflen = 0; char MPI_value[1] = {0}; + MPI_ierr = MPI_Info_get_string(MPI_info, MPI_key, MPI_valuelen ? &MPI_buflen : MPI_valuelen, MPI_value, MPI_flag); + if (MPI_ierr == MPI_SUCCESS && MPI_valuelen) *MPI_valuelen = MPI_buflen - 1; + return MPI_ierr; +} + +/* PMPI deprecated functions */ + +#define PMPI_Attr_delete PMPI_Comm_delete_attr +#define PMPI_Attr_get PMPI_Comm_get_attr +#define PMPI_Attr_put PMPI_Comm_set_attr + +#define PMPI_Keyval_create PMPI_Comm_create_keyval +#define PMPI_Keyval_free PMPI_Comm_free_keyval + +#define PMPI_Get_elements_x PMPI_Get_elements_c +#define PMPI_Status_set_elements_x PMPI_Status_set_elements_c + +#define PMPI_Type_get_extent_x PMPI_Type_get_extent_c +#define PMPI_Type_get_true_extent_x PMPI_Type_get_true_extent_c +#define PMPI_Type_size_x PMPI_Type_size_c + +#define PMPI_Info_get PMPI_ABI_Info_get +#define PMPI_Info_get_valuelen PMPI_ABI_Info_get_valuelen + +MPI_ABI_static_inline int PMPI_Info_get(MPI_Info MPI_info, const char *MPI_key, int MPI_valuelen, char *MPI_value, int *MPI_flag) { + int MPI_buflen = MPI_valuelen + 1; + return PMPI_Info_get_string(MPI_info, MPI_key, &MPI_buflen, MPI_value, MPI_flag); +} + +MPI_ABI_static_inline int PMPI_Info_get_valuelen(MPI_Info MPI_info, const char *MPI_key, int *MPI_valuelen, int *MPI_flag) { + int MPI_ierr; int MPI_buflen = 0; char MPI_value[1] = {0}; + MPI_ierr = PMPI_Info_get_string(MPI_info, MPI_key, MPI_valuelen ? &MPI_buflen : MPI_valuelen, MPI_value, MPI_flag); + if (MPI_ierr == MPI_SUCCESS && MPI_valuelen) *MPI_valuelen = MPI_buflen - 1; + return MPI_ierr; +} diff --git a/mpi-api-removed.h b/mpi-api-removed.h new file mode 100644 index 0000000..9467c8d --- /dev/null +++ b/mpi-api-removed.h @@ -0,0 +1,92 @@ +#pragma once + +#if !defined(MPI_ABI_static_inline) +# if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) +# define MPI_ABI_static_inline static inline +# else +# define MPI_ABI_static_inline static __inline +# endif +#endif + +/* MPI removed types and constants */ + +#define MPI_Handler_function MPI_Comm_errhandler_function + +#define MPI_LB MPI_DATATYPE_NULL +#define MPI_UB MPI_DATATYPE_NULL + +#define MPI_COMBINER_HVECTOR_INTEGER MPI_UNDEFINED +#define MPI_COMBINER_HINDEXED_INTEGER MPI_UNDEFINED +#define MPI_COMBINER_STRUCT_INTEGER MPI_UNDEFINED + +/* MPI removed functions */ + +#define MPI_Address MPI_Get_address + +#define MPI_Errhandler_create MPI_Comm_create_errhandler +#define MPI_Errhandler_get MPI_Comm_get_errhandler +#define MPI_Errhandler_set MPI_Comm_set_errhandler + +#define MPI_Type_hindexed MPI_Type_create_hindexed +#define MPI_Type_hvector MPI_Type_create_hvector +#define MPI_Type_struct MPI_Type_create_struct + +#define MPI_Type_extent MPI_ABI_Type_extent +#define MPI_Type_lb MPI_ABI_Type_lb +#define MPI_Type_ub MPI_ABI_Type_ub + +MPI_ABI_static_inline int MPI_Type_extent(MPI_Datatype MPI_datatype, MPI_Aint *MPI_extent) +{ + MPI_Aint MPI_lb; + return MPI_Type_get_extent(MPI_datatype, &MPI_lb, MPI_extent); +} + +MPI_ABI_static_inline int MPI_Type_lb(MPI_Datatype MPI_datatype, MPI_Aint *MPI_lb) +{ + MPI_Aint MPI_extent; + return MPI_Type_get_extent(MPI_datatype, MPI_lb, &MPI_extent); +} + +MPI_ABI_static_inline int MPI_Type_ub(MPI_Datatype MPI_datatype, MPI_Aint *MPI_ub) +{ + MPI_Aint MPI_lb; int MPI_ierr; + MPI_ierr = MPI_Type_get_extent(MPI_datatype, &MPI_lb, MPI_ub); + if (MPI_ierr == MPI_SUCCESS && MPI_ub) *MPI_ub += MPI_lb; + return MPI_ierr; +} + +/* PMPI removed functions */ + +#define PMPI_Address PMPI_Get_Address + +#define PMPI_Errhandler_create PMPI_Comm_create_Errhandler +#define PMPI_Errhandler_get PMPI_Comm_get_errhandler +#define PMPI_Errhandler_set PMPI_Comm_set_errhandler + +#define PMPI_Type_hindexed PMPI_Type_create_hindexed +#define PMPI_Type_hvector PMPI_Type_create_hvector +#define PMPI_Type_struct PMPI_Type_create_struct + +#define PMPI_Type_extent PMPI_ABI_Type_extent +#define PMPI_Type_lb PMPI_ABI_Type_lb +#define PMPI_Type_ub PMPI_ABI_Type_ub + +MPI_ABI_static_inline int PMPI_Type_extent(MPI_Datatype MPI_datatype, MPI_Aint *MPI_extent) +{ + MPI_Aint MPI_lb; + return PMPI_Type_get_extent(MPI_datatype, &MPI_lb, MPI_extent); +} + +MPI_ABI_static_inline int PMPI_Type_lb(MPI_Datatype MPI_datatype, MPI_Aint *MPI_lb) +{ + MPI_Aint MPI_extent; + return PMPI_Type_get_extent(MPI_datatype, MPI_lb, &MPI_extent); +} + +MPI_ABI_static_inline int PMPI_Type_ub(MPI_Datatype MPI_datatype, MPI_Aint *MPI_ub) +{ + MPI_Aint MPI_lb; int MPI_ierr; + MPI_ierr = PMPI_Type_get_extent(MPI_datatype, &MPI_lb, MPI_ub); + if (MPI_ierr == MPI_SUCCESS && MPI_ub) *MPI_ub += MPI_lb; + return MPI_ierr; +} From c74f7051c653841d53c18b5cebd6bdd25c1d9d60 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Fri, 7 Mar 2025 00:01:07 +0300 Subject: [PATCH 4/4] Add removed MPI_Fint and c2f/f2c routines --- mpi-api-removed.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/mpi-api-removed.h b/mpi-api-removed.h index 9467c8d..0832727 100644 --- a/mpi-api-removed.h +++ b/mpi-api-removed.h @@ -90,3 +90,83 @@ MPI_ABI_static_inline int PMPI_Type_ub(MPI_Datatype MPI_datatype, MPI_Aint *MPI_ if (MPI_ierr == MPI_SUCCESS && MPI_ub) *MPI_ub += MPI_lb; return MPI_ierr; } + +/* C <-> Fortran Handle Conversion */ + +#define MPI_Fint int + +MPI_ABI_static_inline int MPIX_ABI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status) +{ + int MPI_pos = 0; + enum { MPI_off = 3, MPI_len = sizeof(c_status->MPI_internal)/sizeof(MPI_Fint) }; + f_status[MPI_pos++] = c_status->MPI_SOURCE; + f_status[MPI_pos++] = c_status->MPI_TAG; + f_status[MPI_pos++] = c_status->MPI_ERROR; + for (MPI_pos = 0; MPI_pos < MPI_len; MPI_pos++) + f_status[MPI_off + MPI_pos] = c_status->MPI_internal[MPI_pos]; + return MPI_SUCCESS; +} + +MPI_ABI_static_inline int MPIX_ABI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status) +{ + int MPI_pos = 0; + enum { MPI_off = 3, MPI_len = sizeof(c_status->MPI_internal)/sizeof(MPI_Fint) }; + c_status->MPI_SOURCE = f_status[MPI_pos++]; + c_status->MPI_TAG = f_status[MPI_pos++]; + c_status->MPI_ERROR = f_status[MPI_pos++]; + for (MPI_pos = 0; MPI_pos < MPI_len; MPI_pos++) + c_status->MPI_internal[MPI_pos] = f_status[MPI_off + MPI_pos]; + return MPI_SUCCESS; +} + +#define MPI_Comm_c2f MPI_Comm_toint +#define MPI_Errhandler_c2f MPI_Errhandler_toint +#define MPI_File_c2f MPI_File_toint +#define MPI_Group_c2f MPI_Group_toint +#define MPI_Info_c2f MPI_Info_toint +#define MPI_Message_c2f MPI_Message_toint +#define MPI_Op_c2f MPI_Op_toint +#define MPI_Request_c2f MPI_Request_toint +#define MPI_Session_c2f MPI_Session_toint +#define MPI_Status_c2f MPIX_ABI_Status_c2f +#define MPI_Type_c2f MPI_Type_toint +#define MPI_Win_c2f MPI_Win_toint + +#define MPI_Comm_f2c MPI_Comm_fromint +#define MPI_Errhandler_f2c MPI_Errhandler_fromint +#define MPI_File_f2c MPI_File_fromint +#define MPI_Group_f2c MPI_Group_fromint +#define MPI_Info_f2c MPI_Info_fromint +#define MPI_Message_f2c MPI_Message_fromint +#define MPI_Op_f2c MPI_Op_fromint +#define MPI_Request_f2c MPI_Request_fromint +#define MPI_Session_f2c MPI_Session_fromint +#define MPI_Status_f2c MPIX_ABI_Status_f2c +#define MPI_Type_f2c MPI_Type_fromint +#define MPI_Win_f2c MPI_Win_fromint + +#define PMPI_Comm_c2f PMPI_Comm_toint +#define PMPI_Errhandler_c2f PMPI_Errhandler_toint +#define PMPI_File_c2f PMPI_File_toint +#define PMPI_Group_c2f PMPI_Group_toint +#define PMPI_Info_c2f PMPI_Info_toint +#define PMPI_Message_c2f PMPI_Message_toint +#define PMPI_Op_c2f PMPI_Op_toint +#define PMPI_Request_c2f PMPI_Request_toint +#define PMPI_Session_c2f PMPI_Session_toint +#define PMPI_Status_c2f MPIX_ABI_Status_c2f +#define PMPI_Type_c2f PMPI_Type_toint +#define PMPI_Win_c2f PMPI_Win_toint + +#define PMPI_Comm_f2c PMPI_Comm_fromint +#define PMPI_Errhandler_f2c PMPI_Errhandler_fromint +#define PMPI_File_f2c PMPI_File_fromint +#define PMPI_Group_f2c PMPI_Group_fromint +#define PMPI_Info_f2c PMPI_Info_fromint +#define PMPI_Message_f2c PMPI_Message_fromint +#define PMPI_Op_f2c PMPI_Op_fromint +#define PMPI_Request_f2c PMPI_Request_fromint +#define PMPI_Session_f2c PMPI_Session_fromint +#define PMPI_Status_f2c MPIX_ABI_Status_f2c +#define PMPI_Type_f2c PMPI_Type_fromint +#define PMPI_Win_f2c PMPI_Win_fromint