Skip to content

Commit

Permalink
Protect against old PMIx versions
Browse files Browse the repository at this point in the history
We technically support back to PMIx v4.2.4, so protect a few
spots that depend on newer versions.

Signed-off-by: Ralph Castain <[email protected]>
  • Loading branch information
rhc54 committed Oct 29, 2024
1 parent c515f92 commit 8ebe44a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
9 changes: 9 additions & 0 deletions examples/dynamic-dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ static pmix_proc_t myproc;

int main(int argc, char **argv)
{

#ifndef PMIX_SPAWN_CHILD_SEP
EXAMPLES_HIDE_UNUSED_PARAMS(argc, argv);

fprintf(stderr, "PMIX_SPAWN_CHILD_SEP is not available - this example is not supported\n");
return -1;
#else

int rc, exitcode;
char nsp2[PMIX_MAX_NSLEN + 1];
pmix_proc_t proc;
Expand Down Expand Up @@ -97,4 +105,5 @@ int main(int argc, char **argv)

fflush(stderr);
return (0);
#endif
}
16 changes: 16 additions & 0 deletions src/mca/grpcomm/direct/grpcomm_direct_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@
#include "grpcomm_direct.h"
#include "src/mca/grpcomm/base/base.h"

#if PMIX_NUMERIC_VERSION < 0x00060000

int prte_grpcomm_direct_group(pmix_group_operation_t op, char *grpid,
const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t directives[], size_t ndirs,
pmix_info_cbfunc_t cbfunc, void *cbdata)
{
PRTE_HIDE_UNUSED_PARAMS(op, grpid, procs, nprocs, directives, ndirs, cbfunc, cbdata);

return PRTE_ERR_NOT_SUPPORTED;
}

#else

static void group(int sd, short args, void *cbdata);

static prte_grpcomm_group_t *get_tracker(prte_grpcomm_direct_group_signature_t *sig, bool create);
Expand Down Expand Up @@ -1397,3 +1411,5 @@ static int unpack_signature(pmix_data_buffer_t *buffer,
*sig = s;
return PRTE_SUCCESS;
}

#endif
6 changes: 5 additions & 1 deletion src/pmix/pmix-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -349,6 +349,10 @@ PRTE_EXPORT int prte_pmix_register_cleanup(char *path, bool directory, bool igno
PMIx_Setenv(a, b, c, d)
#endif

#ifndef PMIX_GROUP_NONE
#define PMIX_GROUP_NONE 2
#endif

END_C_DECLS

#endif
2 changes: 2 additions & 0 deletions src/prted/pmix/pmix_server_dyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,13 @@ int prte_pmix_xfer_job_info(prte_job_t *jdata,
prte_set_attribute(&jdata->attributes, PRTE_JOB_CONTINUOUS, PRTE_ATTR_GLOBAL,
&flag, PMIX_BOOL);

#ifdef PMIX_SPAWN_CHILD_SEP
/*** CHILD INDEPENDENCE ***/
} else if (PMIX_CHECK_KEY(info, PMIX_SPAWN_CHILD_SEP)) {
flag = PMIX_INFO_TRUE(info);
prte_set_attribute(&jdata->attributes, PRTE_JOB_CHILD_SEP, PRTE_ATTR_GLOBAL,
&flag, PMIX_BOOL);
#endif

/*** MAX RESTARTS ***/
} else if (PMIX_CHECK_KEY(info, PMIX_MAX_RESTARTS)) {
Expand Down
16 changes: 16 additions & 0 deletions src/prted/pmix/pmix_server_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@

#include "src/prted/pmix/pmix_server_internal.h"

#if PMIX_NUMERIC_VERSION < 0x00060000

pmix_status_t pmix_server_group_fn(pmix_group_operation_t op, char *grpid,
const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t directives[], size_t ndirs,
pmix_info_cbfunc_t cbfunc, void *cbdata)
{
PRTE_HIDE_UNUSED_PARAMS(op, grpid, procs, nprocs, directives, ndirs, cbfunc, cbdata);

return PMIX_ERR_NOT_SUPPORTED;
}

#else

static void relcb(void *cbdata)
{
prte_pmix_grp_caddy_t *cd = (prte_pmix_grp_caddy_t*)cbdata;
Expand Down Expand Up @@ -275,3 +289,5 @@ pmix_status_t pmix_server_group_fn(pmix_group_operation_t op, char *grpid,
}
return rc;
}

#endif

0 comments on commit 8ebe44a

Please sign in to comment.