Skip to content

Commit 53a5759

Browse files
committed
Support backward compatibility with PMIx v6.0.0
Protect against some new definitions Signed-off-by: Ralph Castain <[email protected]>
1 parent ac36457 commit 53a5759

File tree

5 files changed

+52
-9
lines changed

5 files changed

+52
-9
lines changed

config/prte_setup_pmix.m4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ AC_DEFUN([PRTE_CHECK_PMIX],[
180180
PRTE_FLAGS_APPEND_UNIQ(LDFLAGS, $PRTE_FINAL_LDFLAGS)
181181
PRTE_FLAGS_APPEND_UNIQ(LIBS, $PRTE_FINAL_LIBS)
182182
183+
AC_MSG_CHECKING([for functional form of GET_NUMBER macro])
184+
PRTE_CHECK_PMIX_CAP([GET_NUMBER_FN],
185+
[AC_MSG_RESULT([yes])
186+
prte_get_number_macro=1],
187+
[AC_MSG_RESULT([no])
188+
prte_get_number_macro=0])
189+
AC_DEFINE_UNQUOTED([PRTE_PMIX_GET_NUMBER_FN],
190+
[$prte_get_number_macro],
191+
[Whether or not PMIx has the GET_NUMBER FN])
192+
183193
AC_MSG_CHECKING([for support of stop progress thread API])
184194
PRTE_CHECK_PMIX_CAP([STOP_PRGTHRD],
185195
[AC_MSG_RESULT([yes])

src/prted/pmix/pmix_server_gen.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ static void _client_conn(int sd, short args, void *cbdata)
109109
// check if the uid, gid, and pid match
110110
for (n=0; n < cd->ninfo; n++) {
111111
if (PMIx_Check_key(cd->info[n].key, PMIX_USERID)) {
112+
#if PRTE_PMIX_GET_NUMBER_FN
112113
rc = PMIx_Value_get_number(&cd->info[n].value, (void*)&euid, PMIX_UINT32);
114+
#else
115+
PMIX_VALUE_GET_NUMBER(rc, &cd->info[n].value, euid, uid_t);
116+
#endif
113117
if (PMIX_SUCCESS != rc) {
114118
PMIX_ERROR_LOG(rc);
115119
goto complete;
@@ -122,7 +126,11 @@ static void _client_conn(int sd, short args, void *cbdata)
122126
continue;
123127
}
124128
if (PMIx_Check_key(cd->info[n].key, PMIX_GRPID)) {
129+
#if PRTE_PMIX_GET_NUMBER_FN
125130
rc = PMIx_Value_get_number(&cd->info[n].value, (void*)&egid, PMIX_UINT32);
131+
#else
132+
PMIX_VALUE_GET_NUMBER(rc, &cd->info[n].value, egid, gid_t);
133+
#endif
126134
if (PMIX_SUCCESS != rc) {
127135
PMIX_ERROR_LOG(rc);
128136
goto complete;
@@ -136,7 +144,11 @@ static void _client_conn(int sd, short args, void *cbdata)
136144
}
137145
if (prte_pmix_server_globals.require_pid_match) {
138146
if (PMIx_Check_key(cd->info[n].key, PMIX_PROC_PID)) {
147+
#if PRTE_PMIX_GET_NUMBER_FN
139148
rc = PMIx_Value_get_number(&cd->info[n].value, (void*)&pid, PMIX_PID);
149+
#else
150+
PMIX_VALUE_GET_NUMBER(rc, &cd->info[n].value, pid, pid_t);
151+
#endif
140152
if (PMIX_SUCCESS != rc) {
141153
PMIX_ERROR_LOG(rc);
142154
goto complete;
@@ -435,13 +447,21 @@ static void _toolconn(int sd, short args, void *cbdata)
435447
/* we ignore this for now */
436448

437449
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_USERID)) {
450+
#if PRTE_PMIX_GET_NUMBER_FN
451+
trc = PMIx_Value_get_number(&cd->info[n].value, (void*)&cd->uid, PMIX_UINT32);
452+
#else
438453
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->uid, uid_t);
454+
#endif
439455
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
440456
xrc = trc;
441457
}
442458

443459
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_GRPID)) {
460+
#if PRTE_PMIX_GET_NUMBER_FN
461+
trc = PMIx_Value_get_number(&cd->info[n].value, (void*)&cd->gid, PMIX_UINT32);
462+
#else
444463
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->gid, gid_t);
464+
#endif
445465
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
446466
xrc = trc;
447467
}
@@ -470,7 +490,11 @@ static void _toolconn(int sd, short args, void *cbdata)
470490
primary = PMIX_INFO_TRUE(&cd->info[n]);
471491

472492
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_PROC_PID)) {
493+
#if PRTE_PMIX_GET_NUMBER_FN
494+
trc = PMIx_Value_get_number(&cd->info[n].value, (void*)&cd->pid, PMIX_PID);
495+
#else
473496
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->pid, pid_t);
497+
#endif
474498
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
475499
xrc = trc;
476500
}

src/prted/pmix/pmix_server_monitor.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Copyright (c) 2014-2019 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* Copyright (c) 2020 IBM Corporation. All rights reserved.
22-
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
22+
* Copyright (c) 2021-2026 Nanook Consulting All rights reserved.
2323
* $COPYRIGHT$
2424
*
2525
* Additional copyrights may follow
@@ -197,6 +197,7 @@ pmix_status_t pmix_server_monitor_fn(const pmix_proc_t *requestor,
197197
return PMIX_SUCCESS;
198198
}
199199

200+
#ifdef PMIX_MONITOR_LOCAL_ONLY
200201
static void mycbfn(int sd, short args, void *cbdata)
201202
{
202203
prte_pmix_server_req_t *rq2 = (prte_pmix_server_req_t*)cbdata;
@@ -290,21 +291,25 @@ static void mycb(pmix_status_t status, pmix_info_t *info, size_t ninfo, void *cb
290291
PMIX_POST_OBJECT(rq2);
291292
prte_event_active(&(rq2->ev), PRTE_EV_WRITE, 1);
292293
}
294+
#endif
293295

294296
void pmix_server_monitor_request(int status, pmix_proc_t *sender,
295297
pmix_data_buffer_t *buffer, prte_rml_tag_t tg,
296298
void *cbdata)
297299
{
298-
pmix_status_t rc, event, ret;
300+
pmix_status_t rc, ret;
299301
pmix_rank_t dvpid;
300302
int32_t cnt;
301303
int remote_index;
304+
pmix_data_buffer_t *msg;
305+
#ifdef PMIX_MONITOR_LOCAL_ONLY
306+
pmix_status_t event;
302307
pmix_info_t *monitor;
303308
size_t ndirs;
304309
pmix_info_t *directives = NULL;
305310
prte_pmix_server_req_t *req;
306-
pmix_data_buffer_t *msg;
307311
pmix_proc_t requestor;
312+
#endif
308313
PRTE_HIDE_UNUSED_PARAMS(status, sender, tg, cbdata);
309314

310315
// unpack the requesting daemon's vpid
@@ -328,6 +333,7 @@ void pmix_server_monitor_request(int status, pmix_proc_t *sender,
328333
return;
329334
}
330335

336+
#ifdef PMIX_MONITOR_LOCAL_ONLY
331337
// unpack the requestor
332338
cnt = 1;
333339
rc = PMIx_Data_unpack(NULL, buffer, &requestor, &cnt, PMIX_PROC);
@@ -407,6 +413,9 @@ void pmix_server_monitor_request(int status, pmix_proc_t *sender,
407413
return;
408414

409415
errorout:
416+
#else
417+
rc = PMIX_ERR_NOT_SUPPORTED;
418+
#endif
410419
// cannot allow the collective to hang
411420
PMIX_DATA_BUFFER_CREATE(msg);
412421

@@ -438,7 +447,7 @@ void pmix_server_monitor_request(int status, pmix_proc_t *sender,
438447
if (PRTE_SUCCESS != ret) {
439448
PRTE_ERROR_LOG(ret);
440449
PMIX_DATA_BUFFER_RELEASE(msg);
441-
}
450+
}
442451
}
443452

444453
void pmix_server_monitor_resp(int status, pmix_proc_t *sender,

src/prted/prte.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static void shutdown_callback(int fd, short flags, void *arg)
233233
prte_odls.kill_local_procs(NULL);
234234
// mark that we are finalizing so the session directory will cleanup
235235
prte_finalizing = true;
236-
#ifdef PRTE_PMIX_STOP_PRGTHRD
236+
#if PRTE_PMIX_STOP_PRGTHRD
237237
PMIx_Progress_thread_stop(NULL, 0);
238238
#endif
239239
prte_job_session_dir_finalize(NULL);
@@ -1227,7 +1227,7 @@ int prte(int argc, char *argv[])
12271227
* the local session_dir tree and exit
12281228
*/
12291229
prte_finalizing = true;
1230-
#ifdef PRTE_PMIX_STOP_PRGTHRD
1230+
#if PRTE_PMIX_STOP_PRGTHRD
12311231
PMIx_Progress_thread_stop(NULL, 0);
12321232
#endif
12331233
prte_job_session_dir_finalize(NULL);
@@ -1496,7 +1496,7 @@ static void clean_abort(int fd, short flags, void *arg)
14961496
fflush(stderr);
14971497
prte_finalizing = true;
14981498
/* ensure we exit with a non-zero status */
1499-
#ifdef PRTE_PMIX_STOP_PRGTHRD
1499+
#if PRTE_PMIX_STOP_PRGTHRD
15001500
PMIx_Progress_thread_stop(NULL, 0);
15011501
#endif
15021502
surekill(); // ensure we attempt to kill everything
@@ -1536,7 +1536,7 @@ static void abort_signal_callback(int fd)
15361536
} else {
15371537
surekill(); // ensure we attempt to kill everything
15381538
prte_finalizing = true;
1539-
#ifdef PRTE_PMIX_STOP_PRGTHRD
1539+
#if PRTE_PMIX_STOP_PRGTHRD
15401540
PMIx_Progress_thread_stop(NULL, 0);
15411541
#endif
15421542
prte_job_session_dir_finalize(NULL);

src/runtime/prte_finalize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int prte_finalize(void)
7171
return PRTE_SUCCESS;
7272
}
7373

74-
#ifdef PRTE_PMIX_STOP_PRGTHRD
74+
#if PRTE_PMIX_STOP_PRGTHRD
7575
/* Stop the PMIx server's internal progress thread and wait here
7676
* until all active events have been processed */
7777
PMIx_Progress_thread_stop(NULL, 0);

0 commit comments

Comments
 (0)