Skip to content

Commit

Permalink
Remove MPI_Info_get() and MPI_Info_get_valuelen()
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Apr 21, 2024
1 parent b45021f commit fa387a1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
36 changes: 32 additions & 4 deletions mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,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);
Expand Down Expand Up @@ -1523,11 +1521,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);
Expand Down Expand Up @@ -1894,6 +1890,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
Expand All @@ -1913,6 +1917,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
Expand All @@ -1925,6 +1941,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
Expand Down
4 changes: 0 additions & 4 deletions mpistubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,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; }
Expand Down Expand Up @@ -954,11 +952,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; }
Expand Down

0 comments on commit fa387a1

Please sign in to comment.