From 0a76a82cec5363c513e7de0bee1a51c4088bdddc Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 27 Jan 2022 12:45:34 -0800 Subject: [PATCH 1/5] Cleanup handling of allocated node names Some systems absolutely require the node name used in an ssh launch to exactly match that provided in an allocation. Add the ability to track that name (as opposed to a version that has the FQDN stripped) and use it in the ssh launcher. Signed-off-by: Ralph Castain (cherry picked from commit 2482abbd86686f0fa49c01e6da168caa05012e8f) --- src/mca/plm/base/plm_base_launch_support.c | 8 ++++---- src/mca/plm/ssh/plm_ssh_module.c | 15 ++++++++++----- src/mca/ras/base/ras_base_allocate.c | 3 ++- src/mca/ras/base/ras_base_node.c | 8 +++++++- src/runtime/prte_globals.c | 7 ++++++- src/runtime/prte_globals.h | 1 + src/runtime/prte_progress_threads.c | 1 + src/util/dash_host/dash_host.c | 19 ++++++++++++++++++- src/util/hostfile/hostfile.c | 6 +++++- 9 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/mca/plm/base/plm_base_launch_support.c b/src/mca/plm/base/plm_base_launch_support.c index b8ec48d667..270fb114d6 100644 --- a/src/mca/plm/base/plm_base_launch_support.c +++ b/src/mca/plm/base/plm_base_launch_support.c @@ -17,7 +17,7 @@ * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -2340,11 +2340,11 @@ int prte_plm_base_setup_virtual_machine(prte_job_t *jdata) PRTE_OUTPUT_VERBOSE((5, prte_plm_base_framework.framework_output, "%s checking node %s", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), nptr->name)); for (i = 0; i < prte_node_pool->size; i++) { - if (NULL - == (node = (prte_node_t *) prte_pointer_array_get_item(prte_node_pool, i))) { + node = (prte_node_t *) prte_pointer_array_get_item(prte_node_pool, i); + if (NULL == node) { continue; } - if (0 != strcmp(node->name, nptr->name)) { + if (!prte_nptr_match(node, nptr)) { continue; } /* have a match - now see if we want this node */ diff --git a/src/mca/plm/ssh/plm_ssh_module.c b/src/mca/plm/ssh/plm_ssh_module.c index 527032dfbb..1b0cfd7289 100644 --- a/src/mca/plm/ssh/plm_ssh_module.c +++ b/src/mca/plm/ssh/plm_ssh_module.c @@ -17,7 +17,7 @@ * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -998,7 +998,7 @@ static void launch_daemons(int fd, short args, void *cbdata) prte_state_caddy_t *state = (prte_state_caddy_t *) cbdata; prte_plm_ssh_caddy_t *caddy; prte_list_t coll; - char *username; + char *username, *nname; int port, *portptr; prte_namelist_t *child; @@ -1117,7 +1117,7 @@ static void launch_daemons(int fd, short args, void *cbdata) * prefer to find some other node so we can tell what the remote * shell is, if necessary */ - if (0 != strcmp(node->name, prte_process_info.nodename)) { + if (!prte_check_host_is_local(node->name)) { break; } } @@ -1190,13 +1190,18 @@ static void launch_daemons(int fd, short args, void *cbdata) /* setup node name */ free(argv[node_name_index1]); + if (NULL == node->rawname) { + nname = node->name; + } else { + nname = node->rawname; + } username = NULL; if (prte_get_attribute(&node->attributes, PRTE_NODE_USERNAME, (void **) &username, PMIX_STRING)) { - prte_asprintf(&argv[node_name_index1], "%s@%s", username, node->name); + prte_asprintf(&argv[node_name_index1], "%s@%s", username, nname); free(username); } else { - argv[node_name_index1] = strdup(node->name); + argv[node_name_index1] = strdup(nname); } /* pass the vpid */ diff --git a/src/mca/ras/base/ras_base_allocate.c b/src/mca/ras/base/ras_base_allocate.c index 71633ea3f2..5d3a0f0585 100644 --- a/src/mca/ras/base/ras_base_allocate.c +++ b/src/mca/ras/base/ras_base_allocate.c @@ -15,7 +15,7 @@ * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -282,6 +282,7 @@ void prte_ras_base_allocate(int fd, short args, void *cbdata) PRTE_LIST_FOREACH(node, &nodes, prte_node_t) { if (!prte_net_isaddr(node->name) && NULL != (ptr = strchr(node->name, '.'))) { + node->rawname = strdup(node->name); if (prte_keep_fqdn_hostnames) { /* retain the non-fqdn name as an alias */ *ptr = '\0'; diff --git a/src/mca/ras/base/ras_base_node.c b/src/mca/ras/base/ras_base_node.c index 2b00fd39c4..46fc5bce17 100644 --- a/src/mca/ras/base/ras_base_node.c +++ b/src/mca/ras/base/ras_base_node.c @@ -15,7 +15,7 @@ * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -149,6 +149,12 @@ int prte_ras_base_node_insert(prte_list_t *nodes, prte_job_t *jdata) } /* if the node name is different, store it as an alias */ prte_argv_append_unique_nosize(&hnp_node->aliases, node->name); + if (NULL != node->rawname) { + if (NULL != hnp_node->rawname) { + free(hnp_node->rawname); + } + hnp_node->rawname = strdup(node->rawname); + } /* don't keep duplicate copy */ PRTE_RELEASE(node); /* create copies, if required */ diff --git a/src/runtime/prte_globals.c b/src/runtime/prte_globals.c index 79804f7be0..dc066c8e6d 100644 --- a/src/runtime/prte_globals.c +++ b/src/runtime/prte_globals.c @@ -17,7 +17,7 @@ * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017-2020 IBM Corporation. All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -589,6 +589,7 @@ static void prte_node_construct(prte_node_t *node) { node->index = -1; node->name = NULL; + node->rawname = NULL; node->aliases = NULL; node->daemon = NULL; @@ -618,6 +619,10 @@ static void prte_node_destruct(prte_node_t *node) free(node->name); node->name = NULL; } + if (NULL != node->rawname) { + free(node->rawname); + node->rawname = NULL; + } if (NULL != node->aliases) { prte_argv_free(node->aliases); node->aliases = NULL; diff --git a/src/runtime/prte_globals.h b/src/runtime/prte_globals.h index 920cacb3e6..8c9c1e66ba 100644 --- a/src/runtime/prte_globals.h +++ b/src/runtime/prte_globals.h @@ -258,6 +258,7 @@ typedef struct { int32_t index; /** String node name */ char *name; + char *rawname; // name originally given in allocation, if different from name /** aliases */ char **aliases; /* daemon on this node */ diff --git a/src/runtime/prte_progress_threads.c b/src/runtime/prte_progress_threads.c index 83060fae80..6c5a33d6c8 100644 --- a/src/runtime/prte_progress_threads.c +++ b/src/runtime/prte_progress_threads.c @@ -21,6 +21,7 @@ #include "src/event/event-internal.h" #include "src/runtime/prte_globals.h" #include "src/threads/threads.h" +#include "src/util/argv.h" #include "src/util/error.h" #include "src/util/fd.h" diff --git a/src/util/dash_host/dash_host.c b/src/util/dash_host/dash_host.c index 1cba20c794..9ec9e5143f 100644 --- a/src/util/dash_host/dash_host.c +++ b/src/util/dash_host/dash_host.c @@ -14,7 +14,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -116,6 +116,7 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati bool slots_given; char *cptr; char *shortname; + char *rawname; PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, "%s dashhost: parsing args %s", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), @@ -268,6 +269,7 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati /* check for local name and compute non-fqdn name */ shortname = NULL; + rawname = NULL; if (prte_check_host_is_local(mini_map[i])) { ndname = prte_process_info.nodename; } else { @@ -277,6 +279,7 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati !prte_net_isaddr(ndname)) { cptr = strchr(ndname, '.'); if (NULL != cptr) { + rawname = strdup(ndname); *cptr = '\0'; shortname = strdup(ndname); *cptr = '.'; @@ -306,6 +309,10 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati free(shortname); shortname = NULL; } + if (NULL != rawname) { + node->rawname = rawname; + rawname = NULL; + } } else { /* if we didn't find it, add it to the list */ node = PRTE_NEW(prte_node_t); @@ -314,6 +321,9 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati if (NULL != shortname) { free(shortname); } + if (NULL != rawname) { + free(rawname); + } return PRTE_ERR_OUT_OF_RESOURCE; } if (prte_keep_fqdn_hostnames || NULL == shortname) { @@ -321,6 +331,10 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati } else { node->name = strdup(shortname); } + if (NULL != rawname) { + node->rawname = rawname; + rawname = NULL; + } PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, "%s dashhost: added node %s to list - slots %d", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), node->name, slots)); @@ -350,6 +364,9 @@ int prte_util_add_dash_host_nodes(prte_list_t *nodes, char *hosts, bool allocati if (NULL != shortname) { free(shortname); } + if (NULL != rawname) { + free(rawname); + } } prte_argv_free(mini_map); diff --git a/src/util/hostfile/hostfile.c b/src/util/hostfile/hostfile.c index 3d6ea0af72..ebd79fc97c 100644 --- a/src/util/hostfile/hostfile.c +++ b/src/util/hostfile/hostfile.c @@ -16,7 +16,7 @@ * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -180,6 +180,7 @@ static int hostfile_parse_line(int token, prte_list_t *updates, prte_list_t *exc node->name = strdup(node_name); } else { node->name = strdup(alias); + node->rawname = strdup(node_name); } if (NULL != username) { prte_set_attribute(&node->attributes, PRTE_NODE_USERNAME, PRTE_ATTR_LOCAL, @@ -223,6 +224,7 @@ static int hostfile_parse_line(int token, prte_list_t *updates, prte_list_t *exc node->name = strdup(node_name); } else { node->name = strdup(alias); + node->rawname = strdup(node_name); } node->slots = 1; if (NULL != username) { @@ -266,6 +268,7 @@ static int hostfile_parse_line(int token, prte_list_t *updates, prte_list_t *exc node->name = strdup(prte_util_hostfile_value.sval); } else { node->name = strdup(alias); + node->rawname = strdup(prte_util_hostfile_value.sval); } if (NULL != alias && 0 != strcmp(alias, node->name)) { // new node object, so alias must be unique @@ -339,6 +342,7 @@ static int hostfile_parse_line(int token, prte_list_t *updates, prte_list_t *exc if (NULL != alias) { prte_argv_append_unique_nosize(&node->aliases, alias); free(alias); + node->rawname = strdup(node_name); } PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, "%s hostfile: node %s slots %d nodes-given %s", From 1cfcc7b8ce2aa575b5ae3b196cb1eab9d8cb922a Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 27 Jan 2022 13:48:18 -0800 Subject: [PATCH 2/5] Always build the PBS scheduler support Unless directed not to do so. Note this is separate from the Torque launcher, which still only builds if the TM libraries are found. Signed-off-by: Ralph Castain (cherry picked from commit 440e188dca9f8b3f750bd73b7f5ea38e05778d00) --- src/mca/ras/{tm => pbs}/Makefile.am | 28 ++++---- src/mca/ras/pbs/configure.m4 | 65 +++++++++++++++++++ .../help-ras-tm.txt => pbs/help-ras-pbs.txt} | 4 ++ src/mca/ras/{tm => pbs}/owner.txt | 0 src/mca/ras/{tm/ras_tm.h => pbs/ras_pbs.h} | 17 +++-- .../ras_pbs_component.c} | 60 ++++++----------- .../ras_tm_module.c => pbs/ras_pbs_module.c} | 60 +++++++++-------- src/mca/ras/tm/configure.m4 | 41 ------------ 8 files changed, 144 insertions(+), 131 deletions(-) rename src/mca/ras/{tm => pbs}/Makefile.am (70%) create mode 100644 src/mca/ras/pbs/configure.m4 rename src/mca/ras/{tm/help-ras-tm.txt => pbs/help-ras-pbs.txt} (90%) rename src/mca/ras/{tm => pbs}/owner.txt (100%) rename src/mca/ras/{tm/ras_tm.h => pbs/ras_pbs.h} (75%) rename src/mca/ras/{tm/ras_tm_component.c => pbs/ras_pbs_component.c} (62%) rename src/mca/ras/{tm/ras_tm_module.c => pbs/ras_pbs_module.c} (77%) delete mode 100644 src/mca/ras/tm/configure.m4 diff --git a/src/mca/ras/tm/Makefile.am b/src/mca/ras/pbs/Makefile.am similarity index 70% rename from src/mca/ras/tm/Makefile.am rename to src/mca/ras/pbs/Makefile.am index e01ec1a539..a3e57ffd94 100644 --- a/src/mca/ras/tm/Makefile.am +++ b/src/mca/ras/pbs/Makefile.am @@ -12,38 +12,38 @@ # Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 IBM Corporation. All rights reserved. # Copyright (c) 2017-2020 Intel, Inc. All rights reserved. -# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ # -# The TM plugin does not call any Torque/PBS functions - it therefore +# The PBS plugin does not call any Torque/PBS functions - it therefore # does NOT need to link against any Torque/PBS libraries # Use the top-level Makefile.options -dist_prtedata_DATA = help-ras-tm.txt +dist_prtedata_DATA = help-ras-pbs.txt sources = \ - ras_tm.h \ - ras_tm_component.c \ - ras_tm_module.c + ras_pbs.h \ + ras_pbs_component.c \ + ras_pbs_module.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la # (for static builds). -if MCA_BUILD_prte_ras_tm_DSO +if MCA_BUILD_prte_ras_pbs_DSO lib = lib_sources = -component = mca_ras_tm.la +component = mca_ras_pbs.la component_sources = $(sources) else -lib = libmca_ras_tm.la +lib = libmca_ras_pbs.la lib_sources = $(sources) component = component_sources = @@ -51,10 +51,10 @@ endif mcacomponentdir = $(prtelibdir) mcacomponent_LTLIBRARIES = $(component) -mca_ras_tm_la_SOURCES = $(component_sources) -mca_ras_tm_la_LDFLAGS = -module -avoid-version -mca_ras_tm_la_LIBADD = $(top_builddir)/src/libprrte.la +mca_ras_pbs_la_SOURCES = $(component_sources) +mca_ras_pbs_la_LDFLAGS = -module -avoid-version +mca_ras_pbs_la_LIBADD = $(top_builddir)/src/libprrte.la noinst_LTLIBRARIES = $(lib) -libmca_ras_tm_la_SOURCES = $(lib_sources) -libmca_ras_tm_la_LDFLAGS = -module -avoid-version +libmca_ras_pbs_la_SOURCES = $(lib_sources) +libmca_ras_pbs_la_LDFLAGS = -module -avoid-version diff --git a/src/mca/ras/pbs/configure.m4 b/src/mca/ras/pbs/configure.m4 new file mode 100644 index 0000000000..d390fe637f --- /dev/null +++ b/src/mca/ras/pbs/configure.m4 @@ -0,0 +1,65 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2011-2013 Los Alamos National Security, LLC. +# All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# Copyright (c) 2022 Nanook Consulting. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_ras_pbs_CONFIG([action-if-found], [action-if-not-found]) +# ----------------------------------------------------------- +AC_DEFUN([MCA_prte_ras_pbs_CONFIG],[ + AC_CONFIG_FILES([src/mca/ras/pbs/Makefile]) + + AC_ARG_WITH([pbs], + [AS_HELP_STRING([--with-pbs], + [Build PBS scheduler component (default: yes)])]) + + if test "$with_pbs" = "no" ; then + prte_check_pbs_happy="no" + elif test "$with_pbs" = "" ; then + # unless user asked, only build pbs component on linux, AIX, + # and OS X systems (these are the platforms that PBS + # supports) + case $host in + *-linux*|*-aix*|*-apple-darwin*) + prte_check_pbs_happy="yes" + ;; + *) + AC_MSG_CHECKING([for pbsdash in PATH]) + PRTE_WHICH([pbsdash], [PRTE_CHECK_PBSDASH]) + if test "$PRTE_CHECK_PBSDASH" = ""; then + prte_check_pbs_happy="no" + else + prte_check_pbs_happy="yes" + fi + AC_MSG_RESULT([$prte_check_pbs_happy]) + ;; + esac + else + prte_check_pbs_happy="yes" + fi + + PRTE_SUMMARY_ADD([[Resource Managers]],[[PBS]],[$1],[$prte_check_pbs_happy (scheduler)]) + + AS_IF([test "$prte_check_pbs_happy" = "yes"], + [$2], + [$3]) + +])dnl diff --git a/src/mca/ras/tm/help-ras-tm.txt b/src/mca/ras/pbs/help-ras-pbs.txt similarity index 90% rename from src/mca/ras/tm/help-ras-tm.txt rename to src/mca/ras/pbs/help-ras-pbs.txt index a6f9e9278a..8d85788dd2 100644 --- a/src/mca/ras/tm/help-ras-tm.txt +++ b/src/mca/ras/pbs/help-ras-pbs.txt @@ -13,12 +13,16 @@ # Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2022 Nanook Consulting. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ # +[no-nodefile] +The PBS_NODEFILE environmental variable was +not found - no nodes can be allocated [no-nodes-found] No nodes were found in the PBS_NODEFILE: diff --git a/src/mca/ras/tm/owner.txt b/src/mca/ras/pbs/owner.txt similarity index 100% rename from src/mca/ras/tm/owner.txt rename to src/mca/ras/pbs/owner.txt diff --git a/src/mca/ras/tm/ras_tm.h b/src/mca/ras/pbs/ras_pbs.h similarity index 75% rename from src/mca/ras/tm/ras_tm.h rename to src/mca/ras/pbs/ras_pbs.h index 3557489767..f396e8ec37 100644 --- a/src/mca/ras/tm/ras_tm.h +++ b/src/mca/ras/pbs/ras_pbs.h @@ -13,7 +13,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 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,10 +23,10 @@ /** * @file * - * Resource Allocation (TM) + * Resource Allocation (PBS) */ -#ifndef PRTE_RAS_TM_H -#define PRTE_RAS_TM_H +#ifndef PRTE_RAS_PBS_H +#define PRTE_RAS_PBS_H #include "prte_config.h" #include "src/mca/ras/base/base.h" @@ -34,15 +34,14 @@ BEGIN_C_DECLS -struct prte_ras_tm_component_t { +struct prte_ras_pbs_component_t { prte_ras_base_component_t super; - char *nodefile_dir; bool smp_mode; }; -typedef struct prte_ras_tm_component_t prte_ras_tm_component_t; +typedef struct prte_ras_pbs_component_t prte_ras_pbs_component_t; -PRTE_EXPORT extern prte_ras_tm_component_t prte_ras_tm_component; -PRTE_EXPORT extern prte_ras_base_module_t prte_ras_tm_module; +PRTE_EXPORT extern prte_ras_pbs_component_t prte_ras_pbs_component; +PRTE_EXPORT extern prte_ras_base_module_t prte_ras_pbs_module; END_C_DECLS diff --git a/src/mca/ras/tm/ras_tm_component.c b/src/mca/ras/pbs/ras_pbs_component.c similarity index 62% rename from src/mca/ras/tm/ras_tm_component.c rename to src/mca/ras/pbs/ras_pbs_component.c index d7059ec04a..528c0b8325 100644 --- a/src/mca/ras/tm/ras_tm_component.c +++ b/src/mca/ras/pbs/ras_pbs_component.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +31,7 @@ #include "src/mca/base/prte_mca_base_var.h" #include "src/util/basename.h" -#include "ras_tm.h" +#include "ras_pbs.h" #include "src/mca/ras/base/ras_private.h" /* @@ -42,11 +42,11 @@ static int param_priority; /* * Local functions */ -static int ras_tm_register(void); -static int ras_tm_open(void); -static int prte_ras_tm_component_query(prte_mca_base_module_t **module, int *priority); +static int ras_pbs_register(void); +static int ras_pbs_open(void); +static int prte_ras_pbs_component_query(prte_mca_base_module_t **module, int *priority); -prte_ras_tm_component_t prte_ras_tm_component = { +prte_ras_pbs_component_t prte_ras_pbs_component = { { /* First, the prte_mca_base_component_t struct containing meta information about the component itself */ @@ -55,14 +55,14 @@ prte_ras_tm_component_t prte_ras_tm_component = { PRTE_RAS_BASE_VERSION_2_0_0, /* Component name and version */ - .mca_component_name = "tm", + .mca_component_name = "pbs", PRTE_MCA_BASE_MAKE_VERSION(component, PRTE_MAJOR_VERSION, PRTE_MINOR_VERSION, PRTE_RELEASE_VERSION), /* Component open and close functions */ - .mca_open_component = ras_tm_open, - .mca_query_component = prte_ras_tm_component_query, - .mca_register_component_params = ras_tm_register, + .mca_open_component = ras_pbs_open, + .mca_query_component = prte_ras_pbs_component_query, + .mca_register_component_params = ras_pbs_register, }, .base_data = { /* The component is checkpoint ready */ @@ -71,64 +71,44 @@ prte_ras_tm_component_t prte_ras_tm_component = { } }; -static int ras_tm_register(void) +static int ras_pbs_register(void) { - prte_mca_base_component_t *c = &prte_ras_tm_component.super.base_version; - char *pbs_nodefile_env = NULL; + prte_mca_base_component_t *c = &prte_ras_pbs_component.super.base_version; param_priority = 100; - (void) prte_mca_base_component_var_register(c, "priority", "Priority of the tm ras component", + (void) prte_mca_base_component_var_register(c, "priority", "Priority of the pbs ras component", PRTE_MCA_BASE_VAR_TYPE_INT, NULL, 0, PRTE_MCA_BASE_VAR_FLAG_NONE, PRTE_INFO_LVL_9, PRTE_MCA_BASE_VAR_SCOPE_READONLY, ¶m_priority); - prte_ras_tm_component.nodefile_dir = NULL; - - /* try to detect the default directory */ - pbs_nodefile_env = getenv("PBS_NODEFILE"); - if (NULL != pbs_nodefile_env) { - prte_ras_tm_component.nodefile_dir = prte_dirname(pbs_nodefile_env); - } - - if (NULL == prte_ras_tm_component.nodefile_dir) { - prte_ras_tm_component.nodefile_dir = strdup("/var/torque/aux"); - } - - (void) prte_mca_base_component_var_register(c, "nodefile_dir", - "The directory where the PBS nodefile can be found", - PRTE_MCA_BASE_VAR_TYPE_STRING, NULL, 0, - PRTE_MCA_BASE_VAR_FLAG_NONE, PRTE_INFO_LVL_9, - PRTE_MCA_BASE_VAR_SCOPE_READONLY, - &prte_ras_tm_component.nodefile_dir); - /* for big SMP machines (e.g., those from SGI), listing the nodes * once/slot in the nodefile is extreme. In those cases, they may * choose to list each node once, but then provide an envar that * tells us how many cpus/node were allocated. Allow the user to * inform us that we are in such an environment */ - prte_ras_tm_component.smp_mode = false; + prte_ras_pbs_component.smp_mode = false; (void) prte_mca_base_component_var_register( c, "smp", - "The Torque system is configured in SMP mode " + "The PBS system is configured in SMP mode " "with the number of cpus/node given in the environment", PRTE_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, PRTE_MCA_BASE_VAR_FLAG_NONE, PRTE_INFO_LVL_9, - PRTE_MCA_BASE_VAR_SCOPE_READONLY, &prte_ras_tm_component.smp_mode); + PRTE_MCA_BASE_VAR_SCOPE_READONLY, &prte_ras_pbs_component.smp_mode); return PRTE_SUCCESS; } -static int ras_tm_open(void) +static int ras_pbs_open(void) { return PRTE_SUCCESS; } -static int prte_ras_tm_component_query(prte_mca_base_module_t **module, int *priority) +static int prte_ras_pbs_component_query(prte_mca_base_module_t **module, int *priority) { - /* Are we running under a TM job? */ + /* Are we running under a PBS job? */ if (NULL != getenv("PBS_ENVIRONMENT") && NULL != getenv("PBS_JOBID")) { *priority = param_priority; - *module = (prte_mca_base_module_t *) &prte_ras_tm_module; + *module = (prte_mca_base_module_t *) &prte_ras_pbs_module; return PRTE_SUCCESS; } diff --git a/src/mca/ras/tm/ras_tm_module.c b/src/mca/ras/pbs/ras_pbs_module.c similarity index 77% rename from src/mca/ras/tm/ras_tm_module.c rename to src/mca/ras/pbs/ras_pbs_module.c index bb5f3326f6..caf7834c19 100644 --- a/src/mca/ras/tm/ras_tm_module.c +++ b/src/mca/ras/pbs/ras_pbs_module.c @@ -14,7 +14,7 @@ * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,7 +37,7 @@ #include "src/runtime/prte_globals.h" #include "src/util/name_fns.h" -#include "ras_tm.h" +#include "ras_pbs.h" #include "src/mca/ras/base/ras_private.h" /* @@ -47,16 +47,16 @@ static int allocate(prte_job_t *jdata, prte_list_t *nodes); static int finalize(void); static int discover(prte_list_t *nodelist, char *pbs_jobid); -static char *tm_getline(FILE *fp); +static char *pbs_getline(FILE *fp); -#define TM_FILE_MAX_LINE_LENGTH 512 +#define PBS_FILE_MAX_LINE_LENGTH 512 static char *filename; /* * Global variable */ -prte_ras_base_module_t prte_ras_tm_module = {NULL, allocate, NULL, finalize}; +prte_ras_base_module_t prte_ras_pbs_module = {NULL, allocate, NULL, finalize}; /** * Discover available (pre-allocated) nodes and report @@ -84,14 +84,17 @@ static int allocate(prte_job_t *jdata, prte_list_t *nodes) return ret; } - /* in the TM world, if we didn't find anything, then this + /* in the PBS world, if we didn't find anything, then this * is an unrecoverable error - report it */ if (prte_list_is_empty(nodes)) { - prte_show_help("help-ras-tm.txt", "no-nodes-found", true, filename); + prte_show_help("help-ras-pbs.txt", "no-nodes-found", true, filename); return PRTE_ERR_NOT_FOUND; } + /* record the number of allocated nodes */ + prte_num_allocated_nodes = prte_list_get_size(nodes); + /* All done */ return PRTE_SUCCESS; } @@ -102,13 +105,13 @@ static int allocate(prte_job_t *jdata, prte_list_t *nodes) static int finalize(void) { PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, - "%s ras:tm:finalize: success (nothing to do)", + "%s ras:pbs:finalize: success (nothing to do)", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME))); return PRTE_SUCCESS; } /** - * Discover the available resources. Obtain directly from TM (and + * Discover the available resources. Obtain directly from PBS (and * therefore have no need to validate) -- ignore hostfile or any other * user-specified parameters. * @@ -126,10 +129,10 @@ static int discover(prte_list_t *nodelist, char *pbs_jobid) bool found; /* Ignore anything that the user already specified -- we're - getting nodes only from TM. */ + getting nodes only from PBS. */ - /* TM "nodes" may actually correspond to PBS "VCPUs", which means - there may be multiple "TM nodes" that correspond to the same + /* PBS "nodes" may actually correspond to PBS "VCPUs", which means + there may be multiple "PBS nodes" that correspond to the same physical node. This doesn't really affect what we're doing here (we actually ignore the fact that they're duplicates -- slightly inefficient, but no big deal); just mentioned for @@ -138,9 +141,9 @@ static int discover(prte_list_t *nodelist, char *pbs_jobid) /* if we are in SMP mode, then read the environment to get the * number of cpus for each node read in the file */ - if (prte_ras_tm_component.smp_mode) { + if (prte_ras_pbs_component.smp_mode) { if (NULL == (cppn = getenv("PBS_PPN"))) { - prte_show_help("help-ras-tm.txt", "smp-error", true); + prte_show_help("help-ras-pbs.txt", "smp-error", true); return PRTE_ERR_NOT_FOUND; } ppn = strtol(cppn, NULL, 10); @@ -149,40 +152,43 @@ static int discover(prte_list_t *nodelist, char *pbs_jobid) } /* setup the full path to the PBS file */ - filename = prte_os_path(false, prte_ras_tm_component.nodefile_dir, pbs_jobid, NULL); + filename = getenv("PBS_NODEFILE"); + if (NULL == filename) { + prte_show_help("help-ras-pbs.txt", "no-nodefile", true); + return PRTE_ERR_NOT_FOUND; + } fp = fopen(filename, "r"); if (NULL == fp) { PRTE_ERROR_LOG(PRTE_ERR_FILE_OPEN_FAILURE); - free(filename); return PRTE_ERR_FILE_OPEN_FAILURE; } - /* Iterate through all the nodes and make an entry for each. TM + /* Iterate through all the nodes and make an entry for each. PBS node ID's will never be duplicated, but they may end up resolving to the same hostname (i.e., vcpu's on a single host). */ nodeid = 0; - while (NULL != (hostname = tm_getline(fp))) { + while (NULL != (hostname = pbs_getline(fp))) { PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, - "%s ras:tm:allocate:discover: got hostname %s", + "%s ras:pbs:allocate:discover: got hostname %s", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), hostname)); - /* Remember that TM may list the same node more than once. So + /* Remember that PBS may list the same node more than once. So we have to check for duplicates. */ found = false; PRTE_LIST_FOREACH(node, nodelist, prte_node_t) { if (0 == strcmp(node->name, hostname)) { - if (prte_ras_tm_component.smp_mode) { + if (prte_ras_pbs_component.smp_mode) { /* this cannot happen in smp mode */ - prte_show_help("help-ras-tm.txt", "smp-multi", true); + prte_show_help("help-ras-pbs.txt", "smp-multi", true); return PRTE_ERR_BAD_PARAM; } ++node->slots; PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, - "%s ras:tm:allocate:discover: found -- bumped slots to %d", + "%s ras:pbs:allocate:discover: found -- bumped slots to %d", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), node->slots)); found = true; break; @@ -196,7 +202,7 @@ static int discover(prte_list_t *nodelist, char *pbs_jobid) /* Nope -- didn't find it, so add a new item to the list */ PRTE_OUTPUT_VERBOSE((1, prte_ras_base_framework.framework_output, - "%s ras:tm:allocate:discover: not found -- added to list", + "%s ras:pbs:allocate:discover: not found -- added to list", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME))); node = PRTE_NEW(prte_node_t); @@ -222,12 +228,12 @@ static int discover(prte_list_t *nodelist, char *pbs_jobid) return PRTE_SUCCESS; } -static char *tm_getline(FILE *fp) +static char *pbs_getline(FILE *fp) { char *ret, *buff; - char input[TM_FILE_MAX_LINE_LENGTH]; + char input[PBS_FILE_MAX_LINE_LENGTH]; - ret = fgets(input, TM_FILE_MAX_LINE_LENGTH, fp); + ret = fgets(input, PBS_FILE_MAX_LINE_LENGTH, fp); if (NULL != ret) { input[strlen(input) - 1] = '\0'; /* remove newline */ buff = strdup(input); diff --git a/src/mca/ras/tm/configure.m4 b/src/mca/ras/tm/configure.m4 deleted file mode 100644 index abe03ed842..0000000000 --- a/src/mca/ras/tm/configure.m4 +++ /dev/null @@ -1,41 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. -# All rights reserved. -# Copyright (c) 2019 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_ras_tm_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_prte_ras_tm_CONFIG],[ - AC_CONFIG_FILES([src/mca/ras/tm/Makefile]) - - PRTE_CHECK_TM([ras_tm], [ras_tm_good=1], [ras_tm_good=0]) - - # if check worked, set wrapper flags if so. - # Evaluate succeed / fail - AS_IF([test "$ras_tm_good" = "1"], - [$1], - [$2]) - - # set build flags to use in makefile - AC_SUBST([ras_tm_CPPFLAGS]) - AC_SUBST([ras_tm_LDFLAGS]) - AC_SUBST([ras_tm_LIBS]) -])dnl From 974828b87ae8dbbd37d563075795c449abaf5eff Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 28 Jan 2022 12:19:25 -0800 Subject: [PATCH 3/5] Protect against HWLOC issues Blacklist all HWLOC releases 2.5.0 and above Signed-off-by: Ralph Castain (cherry picked from commit 165f4b01c69296c4d49a110f6a8f537917911e6c) --- config/prte_setup_hwloc.m4 | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/config/prte_setup_hwloc.m4 b/config/prte_setup_hwloc.m4 index 1f462ce93f..1c2bb27f96 100644 --- a/config/prte_setup_hwloc.m4 +++ b/config/prte_setup_hwloc.m4 @@ -3,7 +3,7 @@ # Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. # Copyright (c) 2013-2020 Intel, Inc. All rights reserved. -# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. # Copyright (c) 2021 Amazon.com, Inc. or its affiliates. # All Rights reserved. # $COPYRIGHT$ @@ -94,6 +94,26 @@ AC_DEFUN([PRTE_SETUP_HWLOC],[ PRTE_FLAGS_PREPEND_UNIQ([LDFLAGS], [$prte_hwloc_LDFLAGS]) PRTE_FLAGS_PREPEND_UNIQ([LIBS], [$prte_hwloc_LIBS]) + AC_MSG_CHECKING([if hwloc version is 2.5 or greater]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + #if HWLOC_API_VERSION < 0x00020500 + #error "hwloc API version is less than 0x00020500" + #endif + ]])], + [AC_MSG_RESULT([yes]) + AC_MSG_WARN([***********************************************************]) + AC_MSG_WARN([PRRTE is not compatible with HWLOC versions 2.5.0 or greater]) + AC_MSG_WARN([due to a bug in HWLOC's setting of environmental variables]) + AC_MSG_WARN([and due to introduction of dependency on third-party libraries.]) + AC_MSG_WARN([It is unclear when these issues will be resolved in new HWLOC.]) + AC_MSG_WARN([Support for future releases will resume once that has occurred.]) + AC_MSG_WARN([For now, please downgrade the HWLOC installation to v2.4.x or]) + AC_MSG_WARN([earlier.]) + AC_MSG_WARN([***********************************************************]) + AC_MSG_ERROR([Cannot continue])]) + AC_MSG_CHECKING([if hwloc version is 1.5 or greater]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], From 798ac0b85b57386e293d124c4fd5174db8ee3648 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 1 Feb 2022 10:38:09 -0800 Subject: [PATCH 4/5] Update the hwloc version checking Exclude 2.5.0-2.7.0, inclusive Signed-off-by: Ralph Castain (cherry picked from commit 1e88cd28d1a5542d68fa3a303690b63151ad884b) --- config/prte_setup_hwloc.m4 | 44 +++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/config/prte_setup_hwloc.m4 b/config/prte_setup_hwloc.m4 index 1c2bb27f96..1e73421201 100644 --- a/config/prte_setup_hwloc.m4 +++ b/config/prte_setup_hwloc.m4 @@ -94,32 +94,33 @@ AC_DEFUN([PRTE_SETUP_HWLOC],[ PRTE_FLAGS_PREPEND_UNIQ([LDFLAGS], [$prte_hwloc_LDFLAGS]) PRTE_FLAGS_PREPEND_UNIQ([LIBS], [$prte_hwloc_LIBS]) - AC_MSG_CHECKING([if hwloc version is 2.5 or greater]) + AC_MSG_CHECKING([if hwloc version is in 2.5.0-2.7.0 range]) AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], + [AC_LANG_PROGRAM([#include ], [[ - #if HWLOC_API_VERSION < 0x00020500 - #error "hwloc API version is less than 0x00020500" + #if HWLOC_VERSION_MAJOR == 2 + #if (HWLOC_VERSION_MINOR == 7 && HWLOC_VERSION_RELEASE == 0) || HWLOC_VERSION_MINOR == 6 || HWLOC_VERSION_MINOR == 5 + #error "hwloc version is in blocklist range" + #endif #endif ]])], + [AC_MSG_RESULT([no])], [AC_MSG_RESULT([yes]) AC_MSG_WARN([***********************************************************]) - AC_MSG_WARN([PRRTE is not compatible with HWLOC versions 2.5.0 or greater]) - AC_MSG_WARN([due to a bug in HWLOC's setting of environmental variables]) - AC_MSG_WARN([and due to introduction of dependency on third-party libraries.]) - AC_MSG_WARN([It is unclear when these issues will be resolved in new HWLOC.]) - AC_MSG_WARN([Support for future releases will resume once that has occurred.]) - AC_MSG_WARN([For now, please downgrade the HWLOC installation to v2.4.x or]) - AC_MSG_WARN([earlier.]) + AC_MSG_WARN([PRRTE is not compatible with HWLOC versions 2.5.0-2.7.0 (inclusive)]) + AC_MSG_WARN([due to a bug in HWLOC's setting of environmental variables.]) + AC_MSG_WARN([Please switch the HWLOC installation to a version outside]) + AC_MSG_WARN([of that range.]) AC_MSG_WARN([***********************************************************]) AC_MSG_ERROR([Cannot continue])]) + AC_MSG_CHECKING([if hwloc version is 1.5 or greater]) AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], + [AC_LANG_PROGRAM([#include ], [[ #if HWLOC_API_VERSION < 0x00010500 - #error "hwloc API version is less than 0x00010500" + #error "hwloc version is less than 0x00010500" #endif ]])], [AC_MSG_RESULT([yes])], @@ -128,16 +129,29 @@ AC_DEFUN([PRTE_SETUP_HWLOC],[ AC_MSG_CHECKING([if hwloc version is 1.8 or greater]) AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], + [AC_LANG_PROGRAM([#include ], [[ #if HWLOC_API_VERSION < 0x00010800 - #error "hwloc API version is less than 0x00010800" + #error "hwloc version is less than 0x00010800" #endif ]])], [AC_MSG_RESULT([yes]) prte_have_topology_dup=1], [AC_MSG_RESULT([no])]) + AC_MSG_CHECKING([if hwloc version is 2.0 or greater]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include ], + [[ + #if HWLOC_VERSION_MAJOR < 2 + #error "hwloc version is less than 2.x" + #endif + ]])], + [AC_MSG_RESULT([yes]) + prte_version_high=1], + [AC_MSG_RESULT([no]) + prte_version_high=0]) + CPPFLAGS=$prte_check_hwloc_save_CPPFLAGS LDFLAGS=$prte_check_hwloc_save_LDFLAGS LIBS=$prte_check_hwloc_save_LIBS From 417d6f71b2659a878a43acc0f7b5fb22adffccc9 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 1 Feb 2022 13:06:55 -0800 Subject: [PATCH 5/5] Update NEWS to track commits Signed-off-by: Ralph Castain --- NEWS | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4c7016d6c6..337eb09191 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,7 @@ Copyright (c) 2013 NVIDIA Corporation. All rights reserved. Copyright (c) 2013-2019 Intel, Inc. All rights reserved. Copyright (c) 2018-2001 Amazon.com, Inc. or its affiliates. All Rights reserved. -Copyright (c) 2021 Nanook Consulting. All rights reserved. +Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -35,11 +35,23 @@ This file contains the main features as well as overviews of specific bug fixes (and other actions) for each version of PRRTE since version 1.0. -2.0.1: TBD +2.0.1: 1 Feb 2022 ------------------------------------ +**** NOTE: As of v2.0.1, PRRTE no longer has a dependency on "pandoc" +**** for building and installing man pages. +**** NOTE: PRRTE has identified a bug in HWLOC versions 2.5.0 thru +**** 2.7.0 (inclusive) that causes PMIx to segfault during certain +**** operations. We have worked with the HWLOC developers to fix +**** that problem, and the fix will be included beginning in HWLOC +**** version 2.7.1. Accordingly, PRRTE now checks for the problem +**** HWLOC versions and will error out of configure if they are +**** encountered. + +PR #1185 and 1186: Update HWLOC version detection + - Reject versions 2.5.0-2.7.0, inclusive +PR #1183: Always build the PBS scheduler support +PR #1182: Cleanup handling of allocated node names PR #1169: Updates for rc5 - Enable support for PMIX_IOF_OUTPUT_RAW attribute - Update NEWS