Created
July 19, 2023 20:13
-
-
Save rhc54/9c615b86f2d43db1c15911390667ab10 to your computer and use it in GitHub Desktop.
OMPI main - patch for PMIx v3.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/VERSION b/VERSION | |
index 2178439c11..9bd94561b2 100644 | |
--- a/VERSION | |
+++ b/VERSION | |
@@ -25,7 +25,7 @@ mpi_standard_subversion=1 | |
# OMPI required dependency versions. | |
# List in x.y.z format. | |
-pmix_min_version=4.1.2 | |
+pmix_min_version=3.2.4 | |
prte_min_version=2.0.2 | |
hwloc_min_version=1.11.0 | |
event_min_version=2.0.21 | |
diff --git a/ompi/communicator/comm_cid.c b/ompi/communicator/comm_cid.c | |
index 07970e8354..1e0128cbfe 100644 | |
--- a/ompi/communicator/comm_cid.c | |
+++ b/ompi/communicator/comm_cid.c | |
@@ -303,6 +303,7 @@ static volatile int64_t ompi_comm_cid_lowest_id = INT64_MAX; | |
static int ompi_comm_cid_epoch = INT_MAX; | |
#endif /* OPAL_ENABLE_FT_MPI */ | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_communicator_t *comm, | |
ompi_comm_extended_cid_block_t *new_block, | |
const void *arg0, const void *arg1, bool send_first, int mode, | |
@@ -410,10 +411,11 @@ fn_exit: | |
free (name_array); | |
name_array = NULL; | |
} | |
- | |
return ret; | |
} | |
+#endif | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
static int ompi_comm_nextcid_ext_nb (ompi_communicator_t *newcomm, ompi_communicator_t *comm, | |
ompi_communicator_t *bridgecomm, const void *arg0, const void *arg1, | |
bool send_first, int mode, ompi_request_t **req) | |
@@ -474,6 +476,7 @@ static int ompi_comm_nextcid_ext_nb (ompi_communicator_t *newcomm, ompi_communic | |
/* nothing more to do here */ | |
return OMPI_SUCCESS; | |
} | |
+#endif | |
int ompi_comm_nextcid_nb (ompi_communicator_t *newcomm, ompi_communicator_t *comm, | |
ompi_communicator_t *bridgecomm, const void *arg0, const void *arg1, | |
@@ -482,11 +485,13 @@ int ompi_comm_nextcid_nb (ompi_communicator_t *newcomm, ompi_communicator_t *com | |
ompi_comm_cid_context_t *context; | |
ompi_comm_request_t *request; | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
if (mca_pml_base_supports_extended_cid() && NULL == comm) { | |
return ompi_comm_nextcid_ext_nb (newcomm, comm, bridgecomm, arg0, arg1, send_first, mode, req); | |
} | |
+#endif | |
- /* old CID algorighm */ | |
+ /* old CID algorithm */ | |
/* if we got here and comm is NULL then that means the app is invoking MPI-4 Sessions or later | |
functions but the pml does not support these functions so return not supported */ | |
diff --git a/ompi/errhandler/errhandler.c b/ompi/errhandler/errhandler.c | |
index 76b902932f..7c98d78fda 100644 | |
--- a/ompi/errhandler/errhandler.c | |
+++ b/ompi/errhandler/errhandler.c | |
@@ -463,6 +463,7 @@ typedef struct ompi_errhandler_event_s { | |
static void *ompi_errhandler_event_cb(int fd, int flags, void *context) { | |
ompi_errhandler_event_t *event = (ompi_errhandler_event_t*) context; | |
int status = event->status; | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
opal_process_name_t source = event->source; | |
opal_process_name_t prc; | |
int rc; | |
@@ -510,6 +511,7 @@ static void *ompi_errhandler_event_cb(int fd, int flags, void *context) { | |
status ); | |
} | |
#endif /* OPAL_ENABLE_FT_MPI */ | |
+#endif // PMIx | |
opal_event_del(&event->super); | |
free(event); | |
/* our default action is to abort */ | |
diff --git a/ompi/instance/instance.c b/ompi/instance/instance.c | |
index 8b67db9ccd..70b5d8c9b4 100644 | |
--- a/ompi/instance/instance.c | |
+++ b/ompi/instance/instance.c | |
@@ -71,12 +71,13 @@ enum { | |
opal_atomic_int32_t ompi_instance_count = 0; | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
static const char *ompi_instance_builtin_psets[] = { | |
"mpi://WORLD", | |
"mpi://SELF", | |
"mpix://SHARED", | |
}; | |
- | |
+#endif | |
static const int32_t ompi_instance_builtin_count = 3; | |
/** finalization functions that need to be called on teardown */ | |
@@ -432,6 +433,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv) | |
return ret; | |
} | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
/* Register the ULFM errhandler callback */ | |
/* we want to go first */ | |
PMIX_INFO_LOAD(&info[0], PMIX_EVENT_HDLR_PREPEND, NULL, PMIX_BOOL); | |
@@ -455,6 +457,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv) | |
ret = opal_pmix_convert_status(rc); | |
return ret; | |
} | |
+#endif | |
/* initialize MPI_INFO_ENV */ | |
if (OMPI_SUCCESS != (ret = ompi_mpiinfo_init_env(0, NULL, &ompi_mpi_info_env.info))) { | |
@@ -971,6 +974,7 @@ int ompi_mpi_instance_finalize (ompi_instance_t **instance) | |
return ret; | |
} | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
static void ompi_instance_get_num_psets_complete (pmix_status_t status, | |
pmix_info_t *info, | |
size_t ninfo, | |
@@ -1067,11 +1071,13 @@ static void ompi_instance_refresh_pmix_psets (const char *key) | |
opal_mutex_unlock (&instance_lock); | |
} | |
- | |
+#endif | |
int ompi_instance_get_num_psets (ompi_instance_t *instance, int *npset_names) | |
{ | |
+#if PMIX_NUMERIC_VERSION >= 0x00040000 | |
ompi_instance_refresh_pmix_psets (PMIX_QUERY_NUM_PSETS); | |
+#endif | |
*npset_names = ompi_instance_builtin_count + ompi_mpi_instance_num_pmix_psets; | |
return OMPI_SUCCESS; | |
@@ -1079,6 +1085,7 @@ int ompi_instance_get_num_psets (ompi_instance_t *instance, int *npset_names) | |
int ompi_instance_get_nth_pset (ompi_instance_t *instance, int n, int *len, char *pset_name) | |
{ | |
+#if PMIX_NUMERIC_VERSION >= 0x00040000 | |
if (NULL == ompi_mpi_instance_pmix_psets && n >= ompi_instance_builtin_count) { | |
ompi_instance_refresh_pmix_psets (PMIX_QUERY_PSET_NAMES); | |
} | |
@@ -1101,10 +1108,11 @@ int ompi_instance_get_nth_pset (ompi_instance_t *instance, int n, int *len, char | |
} else { | |
strncpy (pset_name, ompi_mpi_instance_pmix_psets[n - ompi_instance_builtin_count], *len); | |
} | |
- | |
+#endif | |
return OMPI_SUCCESS; | |
} | |
+#if PMIX_NUMERIC_VERSION >= 0x00040000 | |
static int ompi_instance_group_world (ompi_instance_t *instance, ompi_group_t **group_out) | |
{ | |
ompi_group_t *group; | |
@@ -1318,9 +1326,11 @@ static int ompi_instance_get_pmix_pset_size (ompi_instance_t *instance, const ch | |
return OMPI_SUCCESS; | |
} | |
+#endif | |
int ompi_group_from_pset (ompi_instance_t *instance, const char *pset_name, ompi_group_t **group_out) | |
{ | |
+#if PMIX_NUMERIC_VERSION >= 0x00040000 | |
if (NULL == group_out) { | |
return OMPI_ERR_BAD_PARAM; | |
} | |
@@ -1343,10 +1353,14 @@ int ompi_group_from_pset (ompi_instance_t *instance, const char *pset_name, ompi | |
} | |
return ompi_instance_group_pmix_pset (instance, pset_name, group_out); | |
+#else | |
+ return OMPI_ERR_BAD_PARAM; | |
+#endif | |
} | |
int ompi_instance_get_pset_info (ompi_instance_t *instance, const char *pset_name, opal_info_t **info_used) | |
{ | |
+#if PMIX_NUMERIC_VERSION >= 0x00040000 | |
ompi_info_t *info = ompi_info_allocate (); | |
char tmp[16]; | |
size_t size = 0UL; | |
@@ -1387,4 +1401,7 @@ int ompi_instance_get_pset_info (ompi_instance_t *instance, const char *pset_nam | |
} | |
return ret; | |
+#else | |
+ return OMPI_ERR_BAD_PARAM; | |
+#endif | |
} | |
diff --git a/ompi/runtime/ompi_rte.c b/ompi/runtime/ompi_rte.c | |
index 2a2d66bbc3..e491e6f0c7 100644 | |
--- a/ompi/runtime/ompi_rte.c | |
+++ b/ompi/runtime/ompi_rte.c | |
@@ -1080,9 +1080,10 @@ void ompi_rte_abort_peers(opal_process_name_t *procs, | |
return; | |
} | |
-static size_t handler = SIZE_MAX; | |
static volatile bool debugger_event_active = true; | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
+static size_t handler = SIZE_MAX; | |
static void _release_fn(size_t refid, pmix_status_t status, | |
const pmix_proc_t *source, | |
pmix_info_t info[], size_t ninfo, | |
@@ -1096,9 +1097,11 @@ static void _release_fn(size_t refid, pmix_status_t status, | |
} | |
debugger_event_active = false; | |
} | |
+#endif | |
void ompi_rte_breakpoint(char *name) | |
{ | |
+#if PMIX_NUMERIC_VERSION > 0x00040000 | |
pmix_info_t directive; | |
char *evar; | |
int rc, code = PMIX_DEBUGGER_RELEASE; | |
@@ -1141,6 +1144,7 @@ void ompi_rte_breakpoint(char *name) | |
/* deregister the event handler */ | |
PMIx_Deregister_event_handler(handler, NULL, NULL); | |
+#endif | |
} | |
/* | |
diff --git a/opal/mca/pmix/pmix-internal.h b/opal/mca/pmix/pmix-internal.h | |
index 4e10393f60..ab5503dfcd 100644 | |
--- a/opal/mca/pmix/pmix-internal.h | |
+++ b/opal/mca/pmix/pmix-internal.h | |
@@ -284,6 +284,36 @@ typedef struct { | |
* is to be returned | |
* t - the expected data type | |
*/ | |
+#if PMIX_NUMERIC_VERSION < 0x00040000 | |
+#define OPAL_MODEX_RECV_VALUE_OPTIONAL(r, s, p, d, t) \ | |
+ do { \ | |
+ pmix_proc_t _proc; \ | |
+ pmix_value_t *_kv = NULL; \ | |
+ pmix_info_t _info; \ | |
+ size_t _sz; \ | |
+ pmix_key_t _key; \ | |
+ PMIX_LOAD_KEY(_key, (s)); \ | |
+ OPAL_OUTPUT_VERBOSE((1, opal_pmix_verbose_output, \ | |
+ "%s[%s:%d] MODEX RECV VALUE OPTIONAL FOR PROC %s KEY %s", \ | |
+ OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), __FILE__, __LINE__, \ | |
+ OPAL_NAME_PRINT(*(p)), (s))); \ | |
+ OPAL_PMIX_CONVERT_NAME(&_proc, (p)); \ | |
+ PMIX_INFO_LOAD(&_info, PMIX_OPTIONAL, NULL, PMIX_BOOL); \ | |
+ (r) = PMIx_Get(&(_proc), _key, &(_info), 1, &(_kv)); \ | |
+ PMIX_INFO_DESTRUCT(&_info); \ | |
+ if (NULL == _kv) { \ | |
+ (r) = PMIX_ERR_NOT_FOUND; \ | |
+ } else if (_kv->type != (t)) { \ | |
+ (r) = PMIX_ERR_TYPE_MISMATCH; \ | |
+ } else if (PMIX_SUCCESS == (r) && NULL != (d)) { \ | |
+ PMIX_VALUE_UNLOAD((r), _kv, (void **) (d), &_sz); \ | |
+ } \ | |
+ if (NULL != _kv) { \ | |
+ PMIX_VALUE_RELEASE(_kv); \ | |
+ } \ | |
+ } while (0); | |
+ | |
+#else | |
#define OPAL_MODEX_RECV_VALUE_OPTIONAL(r, s, p, d, t) \ | |
do { \ | |
pmix_proc_t _proc; \ | |
@@ -310,6 +340,8 @@ typedef struct { | |
} \ | |
} while (0); | |
+#endif | |
+ | |
/** | |
* Provide a simplified macro for retrieving modex data | |
* from another process when we want the PMIx module | |
@@ -325,6 +357,36 @@ typedef struct { | |
* is to be returned | |
* t - the expected data type | |
*/ | |
+#if PMIX_NUMERIC_VERSION < 0x00040000 | |
+#define OPAL_MODEX_RECV_VALUE_IMMEDIATE(r, s, p, d, t) \ | |
+ do { \ | |
+ pmix_proc_t _proc; \ | |
+ pmix_value_t *_kv = NULL; \ | |
+ pmix_info_t _info; \ | |
+ size_t _sz; \ | |
+ pmix_key_t _key; \ | |
+ PMIX_LOAD_KEY(_key, (s)); \ | |
+ OPAL_OUTPUT_VERBOSE((1, opal_pmix_verbose_output, \ | |
+ "%s[%s:%d] MODEX RECV VALUE IMMEDIATE FOR PROC %s KEY %s", \ | |
+ OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), __FILE__, __LINE__, \ | |
+ OPAL_NAME_PRINT(*(p)), (s))); \ | |
+ OPAL_PMIX_CONVERT_NAME(&_proc, (p)); \ | |
+ PMIX_INFO_LOAD(&_info, PMIX_IMMEDIATE, NULL, PMIX_BOOL); \ | |
+ (r) = PMIx_Get(&(_proc), _key, &(_info), 1, &(_kv)); \ | |
+ PMIX_INFO_DESTRUCT(&_info); \ | |
+ if (NULL == _kv) { \ | |
+ (r) = PMIX_ERR_NOT_FOUND; \ | |
+ } else if (_kv->type != (t)) { \ | |
+ (r) = PMIX_ERR_TYPE_MISMATCH; \ | |
+ } else if (PMIX_SUCCESS == (r)) { \ | |
+ PMIX_VALUE_UNLOAD((r), _kv, (void **) (d), &_sz); \ | |
+ } \ | |
+ if (NULL != _kv) { \ | |
+ PMIX_VALUE_RELEASE(_kv); \ | |
+ } \ | |
+ } while (0); | |
+ | |
+#else | |
#define OPAL_MODEX_RECV_VALUE_IMMEDIATE(r, s, p, d, t) \ | |
do { \ | |
pmix_proc_t _proc; \ | |
@@ -351,6 +413,8 @@ typedef struct { | |
} \ | |
} while (0); | |
+#endif | |
+ | |
/** | |
* Provide a simplified macro for retrieving modex data | |
* from another process: | |
@@ -363,14 +427,34 @@ typedef struct { | |
* is to be returned | |
* t - the expected data type | |
*/ | |
+#if PMIX_NUMERIC_VERSION < 0x00040000 | |
+#define OPAL_MODEX_RECV_VALUE(r, s, p, d, t) \ | |
+ do { \ | |
+ pmix_proc_t _proc; \ | |
+ pmix_value_t *_kv = NULL; \ | |
+ size_t _sz; \ | |
+ pmix_key_t _key; \ | |
+ PMIX_LOAD_KEY(_key, (s)); \ | |
+ OPAL_PMIX_CONVERT_NAME(&_proc, (p)); \ | |
+ (r) = PMIx_Get(&(_proc), _key, NULL, 0, &(_kv)); \ | |
+ if (NULL == _kv) { \ | |
+ (r) = PMIX_ERR_NOT_FOUND; \ | |
+ } else if (_kv->type != (t)) { \ | |
+ (r) = PMIX_ERR_TYPE_MISMATCH; \ | |
+ } else if (PMIX_SUCCESS == (r)) { \ | |
+ PMIX_VALUE_UNLOAD((r), _kv, (void **) (d), &_sz); \ | |
+ } \ | |
+ if (NULL != _kv) { \ | |
+ PMIX_VALUE_RELEASE(_kv); \ | |
+ } \ | |
+ } while (0); | |
+ | |
+#else | |
#define OPAL_MODEX_RECV_VALUE(r, s, p, d, t) \ | |
do { \ | |
pmix_proc_t _proc; \ | |
pmix_value_t *_kv = NULL; \ | |
size_t _sz; \ | |
- OPAL_OUTPUT_VERBOSE( \ | |
- (1, opal_pmix_verbose_output, "%s[%s:%d] MODEX RECV VALUE FOR PROC %s KEY %s", \ | |
- OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), __FILE__, __LINE__, OPAL_NAME_PRINT(*(p)), (s))); \ | |
OPAL_PMIX_CONVERT_NAME(&_proc, (p)); \ | |
(r) = PMIx_Get(&(_proc), (s), NULL, 0, &(_kv)); \ | |
if (NULL == _kv) { \ | |
@@ -384,6 +468,7 @@ typedef struct { | |
PMIX_VALUE_RELEASE(_kv); \ | |
} \ | |
} while (0); | |
+#endif | |
/** | |
* Provide a simplified macro for retrieving modex data | |
@@ -398,6 +483,36 @@ typedef struct { | |
* sz - pointer to a location wherein the number of bytes | |
* in the data object can be returned (size_t) | |
*/ | |
+#if PMIX_NUMERIC_VERSION < 0x00040000 | |
+#define OPAL_MODEX_RECV_STRING_OPTIONAL(r, s, p, d, sz) \ | |
+ do { \ | |
+ pmix_proc_t _proc; \ | |
+ pmix_value_t *_kv = NULL; \ | |
+ pmix_info_t _info; \ | |
+ pmix_key_t _key; \ | |
+ PMIX_LOAD_KEY(_key, (s)); \ | |
+ OPAL_OUTPUT_VERBOSE((1, opal_pmix_verbose_output, \ | |
+ "%s[%s:%d] MODEX RECV STRING OPTIONAL FOR PROC %s KEY %s", \ | |
+ OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), __FILE__, __LINE__, \ | |
+ OPAL_NAME_PRINT(*(p)), (s))); \ | |
+ *(d) = NULL; \ | |
+ *(sz) = 0; \ | |
+ OPAL_PMIX_CONVERT_NAME(&_proc, (p)); \ | |
+ PMIX_INFO_LOAD(&_info, PMIX_OPTIONAL, NULL, PMIX_BOOL); \ | |
+ (r) = PMIx_Get(&(_proc), _key, &(_info), 1, &(_kv)); \ | |
+ if (NULL == _kv) { \ | |
+ (r) = PMIX_ERR_NOT_FOUND; \ | |
+ } else if (PMIX_SUCCESS == (r)) { \ | |
+ *(d) = (uint8_t *) _kv->data.bo.bytes; \ | |
+ *(sz) = _kv->data.bo.size; \ | |
+ _kv->data.bo.bytes = NULL; /* protect the data */ \ | |
+ } \ | |
+ if (NULL != _kv) { \ | |
+ PMIX_VALUE_RELEASE(_kv); \ | |
+ } \ | |
+ } while (0); | |
+ | |
+#else | |
#define OPAL_MODEX_RECV_STRING_OPTIONAL(r, s, p, d, sz) \ | |
do { \ | |
pmix_proc_t _proc; \ | |
@@ -424,6 +539,8 @@ typedef struct { | |
} \ | |
} while (0); | |
+#endif | |
+ | |
/** | |
* Provide a simplified macro for retrieving modex data | |
* from another process: | |
@@ -688,6 +805,7 @@ OPAL_DECLSPEC int opal_pmix_register_cleanup(char *path, bool directory, bool ig | |
/* protect against early versions of PMIx */ | |
#if PMIX_VERSION_MAJOR == 3 | |
+# define PMIX_ERR_PROC_TERM_WO_SYNC -200 | |
# if PMIX_VERSION_MINOR == 0 | |
# if PMIX_VERSION_RELEASE == 0 | |
# define PMIX_NUMERIC_VERSION 0x00030000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment