From 616e7964a245085e3d38ffcabc987cc7c9111bb4 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 9 Oct 2024 09:47:35 -0600 Subject: [PATCH] Fix deprecation warnings for ppr on socket objects We have deprecated the "socket" object in favor of "package", so we need to extend that treatment to the resource qualifier in the `--map-by ppr` directive. Detect both "socket" and the "skt" shorthand for backward-compatibility reasons. Signed-off-by: Ralph Castain (cherry picked from commit 7f507dfe5fc4e571bc1db8c3efb1db8f521209cd) --- src/mca/rmaps/base/rmaps_base_map_job.c | 3 ++- src/mca/schizo/base/schizo_base_frame.c | 4 +++- src/mca/schizo/ompi/schizo_ompi.c | 25 +++++++++++++++++++++++++ src/mca/schizo/prte/schizo_prte.c | 25 +++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/mca/rmaps/base/rmaps_base_map_job.c b/src/mca/rmaps/base/rmaps_base_map_job.c index ba2fc9b993..51706ab267 100644 --- a/src/mca/rmaps/base/rmaps_base_map_job.c +++ b/src/mca/rmaps/base/rmaps_base_map_job.c @@ -388,7 +388,8 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata) options.maptype = HWLOC_OBJ_CORE; options.mapdepth = PRTE_BIND_TO_CORE; } else if (0 == strncasecmp(ck[1], "package", len) || - 0 == strncasecmp(ck[1], "skt", len)) { + 0 == strncasecmp(ck[1], "skt", len) || + 0 == strncasecmp(ck[1], "socket", len)) { options.maptype = HWLOC_OBJ_PACKAGE; options.mapdepth = PRTE_BIND_TO_PACKAGE; } else if (0 == strncasecmp(ck[1], "numa", len) || diff --git a/src/mca/schizo/base/schizo_base_frame.c b/src/mca/schizo/base/schizo_base_frame.c index da70c1cd65..56a657ef7f 100644 --- a/src/mca/schizo/base/schizo_base_frame.c +++ b/src/mca/schizo/base/schizo_base_frame.c @@ -3,7 +3,7 @@ * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2021-2023 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2024 Nanook Consulting All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -140,6 +140,8 @@ bool prte_schizo_base_check_directives(char *directive, PRTE_CLI_L3CACHE, PRTE_CLI_NUMA, PRTE_CLI_PACKAGE, + "socket", // dealt with elsewhere + "skt", // dealt with elsewhere PRTE_CLI_NODE, NULL }; diff --git a/src/mca/schizo/ompi/schizo_ompi.c b/src/mca/schizo/ompi/schizo_ompi.c index f8804a5ec6..ac926f3ea1 100644 --- a/src/mca/schizo/ompi/schizo_ompi.c +++ b/src/mca/schizo/ompi/schizo_ompi.c @@ -929,6 +929,31 @@ static int convert_deprecated_cli(pmix_cli_result_t *results, free(p1); free(opt->values[0]); opt->values[0] = tmp; + } else if (0 == strncasecmp(opt->values[0], "ppr", strlen("ppr"))) { + // see if they specified "socket" as the resource + p1 = strdup(opt->values[0]); + p2 = strrchr(p1, ':'); + ++p2; + if (0 == strncasecmp(p2, "socket", strlen("socket")) || + 0 == strncasecmp(p2, "skt", strlen("skt"))) { + *p2 = '\0'; + pmix_asprintf(&p2, "%spackage", p1); + if (warn) { + pmix_asprintf(&tmp, "%s %s", option, opt->values[0]); + pmix_asprintf(&tmp2, "%s %s", option, p2); + /* can't just call show_help as we want every instance to be reported */ + output = pmix_show_help_string("help-schizo-base.txt", + "deprecated-converted", true, + tmp, tmp2); + fprintf(stderr, "%s\n", output); + free(output); + free(tmp); + free(tmp2); + } + free(opt->values[0]); + opt->values[0] = p2; + } + free(p1); } } /* --rank-by socket -> --rank-by package */ diff --git a/src/mca/schizo/prte/schizo_prte.c b/src/mca/schizo/prte/schizo_prte.c index 654666a74a..3c4ac5ea31 100644 --- a/src/mca/schizo/prte/schizo_prte.c +++ b/src/mca/schizo/prte/schizo_prte.c @@ -821,6 +821,31 @@ static int convert_deprecated_cli(pmix_cli_result_t *results, free(p1); free(opt->values[0]); opt->values[0] = tmp; + } else if (0 == strncasecmp(opt->values[0], "ppr", strlen("ppr"))) { + // see if they specified "socket" as the resource + p1 = strdup(opt->values[0]); + p2 = strrchr(p1, ':'); + ++p2; + if (0 == strncasecmp(p2, "socket", strlen("socket")) || + 0 == strncasecmp(p2, "skt", strlen("skt"))) { + *p2 = '\0'; + pmix_asprintf(&p2, "%spackage", p1); + if (warn) { + pmix_asprintf(&tmp, "%s %s", option, opt->values[0]); + pmix_asprintf(&tmp2, "%s %s", option, p2); + /* can't just call show_help as we want every instance to be reported */ + output = pmix_show_help_string("help-schizo-base.txt", + "deprecated-converted", true, + tmp, tmp2); + fprintf(stderr, "%s\n", output); + free(output); + free(tmp); + free(tmp2); + } + free(opt->values[0]); + opt->values[0] = p2; + } + free(p1); } } /* --rank-by */