Skip to content

Commit 4bdb5a8

Browse files
authored
Merge pull request #7402 from rhc54/topic/up3
Resolve the PMIx v3 incompatibility
2 parents 77df94d + 133e8eb commit 4bdb5a8

File tree

5 files changed

+41
-11
lines changed

5 files changed

+41
-11
lines changed

ompi/communicator/comm_cid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
1818
* reserved.
1919
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
20-
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
20+
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
2121
* Copyright (c) 2014-2016 Research Organization for Information Science
2222
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2016 IBM Corporation. All rights reserved.
@@ -923,7 +923,7 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
923923
cid_context->port_string,
924924
cid_context->pmix_tag,
925925
cid_context->iter);
926-
PMIX_LOAD_KEY(&info, key);
926+
PMIX_LOAD_KEY(info.key, key);
927927
free(key);
928928
if (bytes_written == -1) {
929929
opal_output_verbose (verbosity_level, output_id, "writing info.key failed\n");
@@ -934,7 +934,7 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
934934
cid_context->port_string,
935935
cid_context->pmix_tag,
936936
cid_context->iter);
937-
PMIX_LOAD_KEY(&pdat.key, key);
937+
PMIX_LOAD_KEY((char*)pdat.key, key);
938938
free(key);
939939
if (bytes_written == -1) {
940940
opal_output_verbose (verbosity_level, output_id, "writing pdat.value.key failed\n");

ompi/interlib/interlib.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2015 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17-
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2015-2020 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1919
* $COPYRIGHT$
2020
*
@@ -68,12 +68,23 @@ static void model_callback(size_t refid, pmix_status_t status,
6868
}
6969
}
7070

71+
static void evhandler_reg_callbk(pmix_status_t status,
72+
size_t evhandler_ref,
73+
void *cbdata)
74+
{
75+
opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata;
76+
77+
lock->status = status;
78+
OPAL_PMIX_WAKEUP_THREAD(lock);
79+
}
80+
7181
int ompi_interlib_declare(int threadlevel, char *version)
7282
{
7383
pmix_info_t info[4], directives;
7484
int ret;
7585
pmix_status_t rc;
7686
pmix_status_t code = PMIX_MODEL_DECLARED;
87+
opal_pmix_lock_t mylock;
7788

7889
/* Register an event handler for library model declarations */
7990
/* give it a name so we can distinguish it */
@@ -82,10 +93,13 @@ int ompi_interlib_declare(int threadlevel, char *version)
8293
* isn't required so long as the code that generates
8394
* the event stipulates its range as proc_local. We rely
8495
* on that here */
85-
rc = PMIx_Register_event_handler(&code, 1, &directives, 1, model_callback, NULL, NULL);
96+
OPAL_PMIX_CONSTRUCT_LOCK(&mylock);
97+
PMIx_Register_event_handler(&code, 1, &directives, 1, model_callback, evhandler_reg_callbk, (void*)&mylock);
98+
OPAL_PMIX_WAIT_THREAD(&mylock);
8699
PMIX_INFO_DESTRUCT(&directives);
87-
if (rc < 0) {
88-
PMIX_INFO_DESTRUCT(&directives);
100+
rc = mylock.status;
101+
OPAL_PMIX_DESTRUCT_LOCK(&mylock);
102+
if (PMIX_SUCCESS != rc) {
89103
return OMPI_ERROR;
90104
}
91105

ompi/runtime/ompi_mpi_init.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,17 @@ static void fence_release(pmix_status_t status, void *cbdata)
370370
OPAL_POST_OBJECT(active);
371371
}
372372

373+
static void evhandler_reg_callbk(pmix_status_t status,
374+
size_t evhandler_ref,
375+
void *cbdata)
376+
{
377+
opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata;
378+
379+
lock->status = status;
380+
OPAL_PMIX_WAKEUP_THREAD(lock);
381+
}
382+
383+
373384
int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
374385
bool reinit_ok)
375386
{
@@ -382,6 +393,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
382393
pmix_info_t info[2];
383394
pmix_status_t rc;
384395
OMPI_TIMING_INIT(64);
396+
opal_pmix_lock_t mylock;
385397

386398
ompi_hook_base_mpi_init_top(argc, argv, requested, provided);
387399

@@ -523,10 +535,14 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
523535
PMIX_INFO_LOAD(&info[0], PMIX_EVENT_HDLR_PREPEND, NULL, PMIX_BOOL);
524536
/* give it a name so we can distinguish it */
525537
PMIX_INFO_LOAD(&info[1], PMIX_EVENT_HDLR_NAME, "MPI-Default", PMIX_STRING);
526-
rc = PMIx_Register_event_handler(NULL, 0, info, 2, ompi_errhandler_callback, NULL, NULL);
538+
OPAL_PMIX_CONSTRUCT_LOCK(&mylock);
539+
PMIx_Register_event_handler(NULL, 0, info, 2, ompi_errhandler_callback, evhandler_reg_callbk, (void*)&mylock);
540+
OPAL_PMIX_WAIT_THREAD(&mylock);
541+
rc = mylock.status;
542+
OPAL_PMIX_DESTRUCT_LOCK(&mylock);
527543
PMIX_INFO_DESTRUCT(&info[0]);
528544
PMIX_INFO_DESTRUCT(&info[1]);
529-
if (0 > rc) {
545+
if (PMIX_SUCCESS != rc) {
530546
error = "Error handler registration";
531547
ret = opal_pmix_convert_status(rc);
532548
goto error;

0 commit comments

Comments
 (0)