From 80f27b5d87f6ee0b7aedd1cb14bead82a3b31ac4 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 19 Aug 2005 14:46:11 +0000 Subject: [PATCH] * fix some bit rot in tm pls/ras * remove src/ directory for tm pls/ras This commit was SVN r6937. --- orte/mca/pls/base/Makefile.am | 3 +- orte/mca/pls/base/base.h | 11 + orte/mca/pls/base/pls_base_proxy.c | 216 +++++++++++++++++++ orte/mca/pls/rsh/pls_rsh_module.c | 180 +--------------- orte/mca/pls/tm/.ompi_unignore | 1 + orte/mca/pls/tm/Makefile.am | 10 +- orte/mca/pls/tm/{src => }/pls_tm.h | 0 orte/mca/pls/tm/{src => }/pls_tm_child.c | 2 +- orte/mca/pls/tm/{src => }/pls_tm_component.c | 0 orte/mca/pls/tm/{src => }/pls_tm_module.c | 2 +- orte/mca/pls/tm/{src => }/pls_tm_registry.c | 0 orte/mca/pls/tm/src/Makefile.extra | 27 --- orte/mca/ras/tm/.ompi_unignore | 1 + orte/mca/ras/tm/Makefile.am | 9 +- orte/mca/ras/tm/{src => }/ras_tm.h | 0 orte/mca/ras/tm/{src => }/ras_tm_component.c | 0 orte/mca/ras/tm/{src => }/ras_tm_module.c | 0 orte/mca/ras/tm/src/Makefile.am | 26 --- orte/mca/ras/tm/src/Makefile.extra | 26 --- 19 files changed, 252 insertions(+), 262 deletions(-) create mode 100644 orte/mca/pls/base/pls_base_proxy.c rename orte/mca/pls/tm/{src => }/pls_tm.h (100%) rename orte/mca/pls/tm/{src => }/pls_tm_child.c (99%) rename orte/mca/pls/tm/{src => }/pls_tm_component.c (100%) rename orte/mca/pls/tm/{src => }/pls_tm_module.c (99%) rename orte/mca/pls/tm/{src => }/pls_tm_registry.c (100%) delete mode 100644 orte/mca/pls/tm/src/Makefile.extra rename orte/mca/ras/tm/{src => }/ras_tm.h (100%) rename orte/mca/ras/tm/{src => }/ras_tm_component.c (100%) rename orte/mca/ras/tm/{src => }/ras_tm_module.c (100%) delete mode 100644 orte/mca/ras/tm/src/Makefile.am delete mode 100644 orte/mca/ras/tm/src/Makefile.extra diff --git a/orte/mca/pls/base/Makefile.am b/orte/mca/pls/base/Makefile.am index bd1ed166eb..190a7c8f0b 100644 --- a/orte/mca/pls/base/Makefile.am +++ b/orte/mca/pls/base/Makefile.am @@ -32,7 +32,8 @@ libmca_pls_base_la_SOURCES = \ pls_base_close.c \ pls_base_open.c \ pls_base_select.c \ - pls_base_state.c + pls_base_state.c \ + pls_base_proxy.c # Conditionally install the header files diff --git a/orte/mca/pls/base/base.h b/orte/mca/pls/base/base.h index 9680e427da..138213661f 100644 --- a/orte/mca/pls/base/base.h +++ b/orte/mca/pls/base/base.h @@ -25,6 +25,7 @@ #include "ompi_config.h" #include "mca/mca.h" #include "mca/pls/pls.h" +#include "orte/mca/ras/base/ras_base_node.h" #if defined(c_plusplus) || defined(__cplusplus) @@ -107,6 +108,16 @@ extern "C" { */ OMPI_DECLSPEC int orte_pls_base_set_progress_sched(int sched); + + /** + * Utilities for pls components that use proxy daemons + */ + int orte_pls_base_proxy_set_node_name(orte_ras_node_t* node, + orte_jobid_t jobid, + orte_process_name_t* name); + int orte_pls_base_proxy_terminate_job(orte_jobid_t jobid); + int orte_pls_base_proxy_terminate_proc(const orte_process_name_t *proc); + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/orte/mca/pls/base/pls_base_proxy.c b/orte/mca/pls/base/pls_base_proxy.c new file mode 100644 index 0000000000..940c536a2d --- /dev/null +++ b/orte/mca/pls/base/pls_base_proxy.c @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. + * 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$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include "orte_config.h" + +#include "orte/mca/pls/base/base.h" +#include "orte/include/orte_constants.h" +#include "orte/mca/ns/ns.h" +#include "orte/mca/pls/pls.h" +#include "orte/mca/rml/rml.h" +#include "orte/mca/gpr/gpr.h" +#include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/ras/base/ras_base_node.h" +#include "orte/mca/rmgr/base/base.h" +#include "opal/util/output.h" + + +int +orte_pls_base_proxy_set_node_name(orte_ras_node_t* node, + orte_jobid_t jobid, + orte_process_name_t* name) +{ + orte_gpr_value_t* values[1]; + orte_gpr_value_t value; + orte_gpr_keyval_t kv_name = {{OBJ_CLASS(orte_gpr_keyval_t),0},ORTE_NODE_BOOTPROXY_KEY,ORTE_NAME}; + orte_gpr_keyval_t* keyvals[1]; + char* jobid_string; + size_t i; + int rc; + + if (ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) { + ORTE_ERROR_LOG(rc); + return rc; + } + + if (ORTE_SUCCESS != (rc = orte_schema.get_node_tokens(&value.tokens, &value.num_tokens, + node->node_cellid, node->node_name))) { + ORTE_ERROR_LOG(rc); + free(jobid_string); + return rc; + } + + asprintf(&kv_name.key, "%s-%s", ORTE_NODE_BOOTPROXY_KEY, jobid_string); + kv_name.value.proc = *name; + keyvals[0] = &kv_name; + value.keyvals = keyvals; + value.cnt = 1; + value.addr_mode = ORTE_GPR_OVERWRITE; + value.segment = ORTE_NODE_SEGMENT; + values[0] = &value; + + rc = orte_gpr.put(1, values); + if (ORTE_SUCCESS != rc) { + ORTE_ERROR_LOG(rc); + } + + free(kv_name.key); + free(jobid_string); + for(i=0; i (rc = orte_rml.recv_buffer_nb(peer, ORTE_RML_TAG_RMGR_CLNT, 0, orte_pls_rsh_terminate_job_rsp, NULL))) { + ORTE_ERROR_LOG(rc); + } + OBJ_RELEASE(req); +} + + +int +orte_pls_base_proxy_terminate_job(orte_jobid_t jobid) +{ + char *keys[2]; + char *jobid_string; + orte_gpr_value_t** values = NULL; + size_t i, j, num_values = 0; + int rc; + + if (ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) { + ORTE_ERROR_LOG(rc); + return rc; + } + + asprintf(&keys[0], "%s-%s", ORTE_NODE_BOOTPROXY_KEY, jobid_string); + keys[1] = NULL; + + rc = orte_gpr.get( + ORTE_GPR_KEYS_OR|ORTE_GPR_TOKENS_OR, + ORTE_NODE_SEGMENT, + NULL, + keys, + &num_values, + &values + ); + if (rc != ORTE_SUCCESS) { + free(jobid_string); + return rc; + } + if (0 == num_values) { + rc = ORTE_ERR_NOT_FOUND; + ORTE_ERROR_LOG(rc); + goto cleanup; + } + + for(i=0; icnt; j++) { + orte_gpr_keyval_t* keyval = value->keyvals[j]; + orte_buffer_t *cmd = OBJ_NEW(orte_buffer_t); + int ret; + if (cmd == NULL) { + rc = ORTE_ERR_OUT_OF_RESOURCE; + ORTE_ERROR_LOG(rc); + goto cleanup; + } + if (strcmp(keyval->key, keys[0]) != 0) + continue; + + /* construct command */ + ret = orte_rmgr_base_pack_cmd(cmd, ORTE_RMGR_CMD_TERM_JOB, jobid); + if (ORTE_SUCCESS != ret) { + ORTE_ERROR_LOG(ret); + OBJ_RELEASE(cmd); + rc = ret; + continue; + } + + /* send a terminate message to the bootproxy on each node */ + if (0 > (ret = orte_rml.send_buffer_nb( + &keyval->value.proc, + cmd, + ORTE_RML_TAG_RMGR_SVC, + 0, + orte_pls_rsh_terminate_job_cb, + NULL))) { + + ORTE_ERROR_LOG(ret); + OBJ_RELEASE(cmd); + rc = ret; + continue; + } + } + } + +cleanup: + + free(jobid_string); + free(keys[0]); + + if (NULL != values) { + for(i=0; inode_cellid, node->node_name))) { - ORTE_ERROR_LOG(rc); - free(jobid_string); - return rc; - } - - asprintf(&kv_name.key, "%s-%s", ORTE_NODE_BOOTPROXY_KEY, jobid_string); - kv_name.value.proc = *name; - keyvals[0] = &kv_name; - value.keyvals = keyvals; - value.cnt = 1; - value.addr_mode = ORTE_GPR_OVERWRITE; - value.segment = ORTE_NODE_SEGMENT; - values[0] = &value; - - rc = orte_gpr.put(1, values); - if (ORTE_SUCCESS != rc) { - ORTE_ERROR_LOG(rc); - } - - free(kv_name.key); - free(jobid_string); - for(i=0; i (rc = orte_rml.recv_buffer_nb(peer, ORTE_RML_TAG_RMGR_CLNT, 0, orte_pls_rsh_terminate_job_rsp, NULL))) { - ORTE_ERROR_LOG(rc); - } - OBJ_RELEASE(req); -} - - /** * Query the registry for all nodes participating in the job */ int orte_pls_rsh_terminate_job(orte_jobid_t jobid) { - char *keys[2]; - char *jobid_string; - orte_gpr_value_t** values = NULL; - size_t i, j, num_values = 0; - int rc; - - if (ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) { - ORTE_ERROR_LOG(rc); - return rc; - } - - asprintf(&keys[0], "%s-%s", ORTE_NODE_BOOTPROXY_KEY, jobid_string); - keys[1] = NULL; - - rc = orte_gpr.get( - ORTE_GPR_KEYS_OR|ORTE_GPR_TOKENS_OR, - ORTE_NODE_SEGMENT, - NULL, - keys, - &num_values, - &values - ); - if (rc != ORTE_SUCCESS) { - free(jobid_string); - return rc; - } - if (0 == num_values) { - rc = ORTE_ERR_NOT_FOUND; - ORTE_ERROR_LOG(rc); - goto cleanup; - } - - for(i=0; icnt; j++) { - orte_gpr_keyval_t* keyval = value->keyvals[j]; - orte_buffer_t *cmd = OBJ_NEW(orte_buffer_t); - int ret; - if (cmd == NULL) { - rc = ORTE_ERR_OUT_OF_RESOURCE; - ORTE_ERROR_LOG(rc); - goto cleanup; - } - if (strcmp(keyval->key, keys[0]) != 0) - continue; - - /* construct command */ - ret = orte_rmgr_base_pack_cmd(cmd, ORTE_RMGR_CMD_TERM_JOB, jobid); - if (ORTE_SUCCESS != ret) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(cmd); - rc = ret; - continue; - } - - /* send a terminate message to the bootproxy on each node */ - if (0 > (ret = orte_rml.send_buffer_nb( - &keyval->value.proc, - cmd, - ORTE_RML_TAG_RMGR_SVC, - 0, - orte_pls_rsh_terminate_job_cb, - NULL))) { - - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(cmd); - rc = ret; - continue; - } - } - } - -cleanup: - - free(jobid_string); - free(keys[0]); - - if (NULL != values) { - for(i=0; i_.la (for DSO builds) or libmca__.la diff --git a/orte/mca/pls/tm/src/pls_tm.h b/orte/mca/pls/tm/pls_tm.h similarity index 100% rename from orte/mca/pls/tm/src/pls_tm.h rename to orte/mca/pls/tm/pls_tm.h diff --git a/orte/mca/pls/tm/src/pls_tm_child.c b/orte/mca/pls/tm/pls_tm_child.c similarity index 99% rename from orte/mca/pls/tm/src/pls_tm_child.c rename to orte/mca/pls/tm/pls_tm_child.c index c5bcf0168f..d72d16e8a9 100644 --- a/orte/mca/pls/tm/src/pls_tm_child.c +++ b/orte/mca/pls/tm/pls_tm_child.c @@ -42,7 +42,7 @@ #include "mca/errmgr/errmgr.h" #include "mca/soh/soh_types.h" #include "mca/gpr/gpr.h" -#include "mca/ns/base/ns_base_nds.h" +#include "orte/mca/sds/base/base.h" #include "mca/soh/soh.h" #include "mca/rml/rml.h" #include "mca/ns/ns.h" diff --git a/orte/mca/pls/tm/src/pls_tm_component.c b/orte/mca/pls/tm/pls_tm_component.c similarity index 100% rename from orte/mca/pls/tm/src/pls_tm_component.c rename to orte/mca/pls/tm/pls_tm_component.c diff --git a/orte/mca/pls/tm/src/pls_tm_module.c b/orte/mca/pls/tm/pls_tm_module.c similarity index 99% rename from orte/mca/pls/tm/src/pls_tm_module.c rename to orte/mca/pls/tm/pls_tm_module.c index 7e31591371..a5df95e39c 100644 --- a/orte/mca/pls/tm/src/pls_tm_module.c +++ b/orte/mca/pls/tm/pls_tm_module.c @@ -44,7 +44,7 @@ #include "mca/errmgr/errmgr.h" #include "mca/soh/soh_types.h" #include "mca/gpr/gpr.h" -#include "mca/ns/base/ns_base_nds.h" +#include "orte/mca/sds/base/base.h" #include "mca/soh/soh.h" #include "mca/rml/rml.h" #include "mca/ns/ns.h" diff --git a/orte/mca/pls/tm/src/pls_tm_registry.c b/orte/mca/pls/tm/pls_tm_registry.c similarity index 100% rename from orte/mca/pls/tm/src/pls_tm_registry.c rename to orte/mca/pls/tm/pls_tm_registry.c diff --git a/orte/mca/pls/tm/src/Makefile.extra b/orte/mca/pls/tm/src/Makefile.extra deleted file mode 100644 index 6c5ba62707..0000000000 --- a/orte/mca/pls/tm/src/Makefile.extra +++ /dev/null @@ -1,27 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# 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$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = -I$(top_ompi_builddir)/src/include \ - -I$(top_ompi_srcdir)/src -I$(top_ompi_srcdir)/src/include \ - $(pls_tm_CPPFLAGS) - -sources += \ - src/pls_tm.h \ - src/pls_tm_child.c \ - src/pls_tm_component.c \ - src/pls_tm_module.c \ - src/pls_tm_registry.c diff --git a/orte/mca/ras/tm/.ompi_unignore b/orte/mca/ras/tm/.ompi_unignore index 814285c7e5..3385e6e426 100644 --- a/orte/mca/ras/tm/.ompi_unignore +++ b/orte/mca/ras/tm/.ompi_unignore @@ -1 +1,2 @@ jsquyres +brbarret diff --git a/orte/mca/ras/tm/Makefile.am b/orte/mca/ras/tm/Makefile.am index a9527cf475..fb793c0b67 100644 --- a/orte/mca/ras/tm/Makefile.am +++ b/orte/mca/ras/tm/Makefile.am @@ -18,8 +18,13 @@ include $(top_ompi_srcdir)/config/Makefile.options -sources = -include src/Makefile.extra +AM_CPPFLAGS = $(ras_tm_CPPFLAGS) + +sources = \ + ras_tm.h \ + ras_tm_component.c \ + ras_tm_module.c + # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la diff --git a/orte/mca/ras/tm/src/ras_tm.h b/orte/mca/ras/tm/ras_tm.h similarity index 100% rename from orte/mca/ras/tm/src/ras_tm.h rename to orte/mca/ras/tm/ras_tm.h diff --git a/orte/mca/ras/tm/src/ras_tm_component.c b/orte/mca/ras/tm/ras_tm_component.c similarity index 100% rename from orte/mca/ras/tm/src/ras_tm_component.c rename to orte/mca/ras/tm/ras_tm_component.c diff --git a/orte/mca/ras/tm/src/ras_tm_module.c b/orte/mca/ras/tm/ras_tm_module.c similarity index 100% rename from orte/mca/ras/tm/src/ras_tm_module.c rename to orte/mca/ras/tm/ras_tm_module.c diff --git a/orte/mca/ras/tm/src/Makefile.am b/orte/mca/ras/tm/src/Makefile.am deleted file mode 100644 index d990063a37..0000000000 --- a/orte/mca/ras/tm/src/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# 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$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -include $(top_ompi_srcdir)/config/Makefile.options - -AM_CPPFLAGS = -I$(top_ompi_builddir)/src/include \ - -I$(top_ompi_srcdir)/src -I$(top_ompi_srcdir)/src/include - -noinst_LTLIBRARIES = libmca_ras_tm.la -libmca_ras_tm_la_SOURCES = \ - ras_tm.h \ - ras_tm_component.c \ - ras_tm_module.c diff --git a/orte/mca/ras/tm/src/Makefile.extra b/orte/mca/ras/tm/src/Makefile.extra deleted file mode 100644 index 14380f3519..0000000000 --- a/orte/mca/ras/tm/src/Makefile.extra +++ /dev/null @@ -1,26 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# 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$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = -I$(top_ompi_builddir)/src/include \ - -I$(top_ompi_srcdir)/src -I$(top_ompi_srcdir)/src/include \ - $(pls_tm_CPPFLAGS) - - -sources += \ - src/ras_tm.h \ - src/ras_tm_component.c \ - src/ras_tm_module.c