Skip to content

Commit

Permalink
Support fix for OMPI Github issue #11532
Browse files Browse the repository at this point in the history
Refactor parameter translation routine into a separate routine to make it
easier to copy into OMPI and maintain concurrently in both packages.

Signed-off-by: Quincey Koziol <qkoziol@amazon.com>
  • Loading branch information
qkoziol authored and rhc54 committed Aug 21, 2023
1 parent 9ef7478 commit d8c4c9e
Showing 1 changed file with 38 additions and 30 deletions.
68 changes: 38 additions & 30 deletions src/mca/schizo/ompi/schizo_ompi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,11 @@ static bool check_pmix_overlap(char *var, char *value)
return false;
}

static int detect_proxy(char *personalities)
// NOTE: This code is fundamentally the same (module PMIX <-> OPAL)
// as the translate_params() routine in the OMPI repo's
// opal/mca/pmix/base/pmix_base_fns.c file. If there are
// changes here, there are likely to be changes there.
static int translate_params(void)
{
char *evar, *tmp, *e2;
char *file;
Expand All @@ -1859,35 +1863,6 @@ static int detect_proxy(char *personalities)
uid_t uid;
int n, len;

pmix_output_verbose(2, prte_schizo_base_framework.framework_output,
"%s[%s]: detect proxy with %s (%s)",
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), __FILE__,
(NULL == personalities) ? "NULL" : personalities,
prte_tool_basename);

/* COMMAND-LINE OVERRIDES ALL */
if (NULL != personalities) {
/* this is a list of personalities we need to check -
* if it contains "ompi", then we are available */
if (NULL != strstr(personalities, "ompi")) {
goto weareit;
}
return 0;
}

/* if we were told the proxy, then use it */
if (NULL != (evar = getenv("PRTE_MCA_schizo_proxy"))) {
if (0 == strcmp(evar, "ompi")) {
goto weareit;
} else {
return 0;
}
}

/* if neither of those were true, then it cannot be us */
return 0;

weareit:
/* since we are the proxy, we need to check the OMPI default
* MCA params to see if there is something relating to PRRTE
* in them - this would be "old" references to things from
Expand Down Expand Up @@ -2001,6 +1976,39 @@ static int detect_proxy(char *personalities)
return 100;
}

static int detect_proxy(char *personalities)
{
char *evar;

pmix_output_verbose(2, prte_schizo_base_framework.framework_output,
"%s[%s]: detect proxy with %s (%s)",
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), __FILE__,
(NULL == personalities) ? "NULL" : personalities,
prte_tool_basename);

/* COMMAND-LINE OVERRIDES ALL */
if (NULL != personalities) {
/* this is a list of personalities we need to check -
* if it contains "ompi", then we are available */
if (NULL != strstr(personalities, "ompi")) {
return translate_params();
}
return 0;
}

/* if we were told the proxy, then use it */
if (NULL != (evar = getenv("PRTE_MCA_schizo_proxy"))) {
if (0 == strcmp(evar, "ompi")) {
return translate_params();
} else {
return 0;
}
}

/* if neither of those were true, then it cannot be us */
return 0;
}

static void allow_run_as_root(pmix_cli_result_t *results)
{
/* we always run last */
Expand Down

0 comments on commit d8c4c9e

Please sign in to comment.