From 8b59de0f3761e403933a7ec814f1bd275ec6d32d Mon Sep 17 00:00:00 2001 From: Thara Angskun Date: Thu, 13 Oct 2005 14:08:17 +0000 Subject: [PATCH] Import RAS for POE This commit was SVN r7748. --- orte/mca/ras/poe/Makefile.am | 48 ++++++++++++++ orte/mca/ras/poe/configure.m4 | 36 ++++++++++ orte/mca/ras/poe/configure.params | 22 +++++++ orte/mca/ras/poe/ras_poe.h | 48 ++++++++++++++ orte/mca/ras/poe/ras_poe_component.c | 96 +++++++++++++++++++++++++++ orte/mca/ras/poe/ras_poe_module.c | 99 ++++++++++++++++++++++++++++ 6 files changed, 349 insertions(+) create mode 100644 orte/mca/ras/poe/Makefile.am create mode 100644 orte/mca/ras/poe/configure.m4 create mode 100644 orte/mca/ras/poe/configure.params create mode 100644 orte/mca/ras/poe/ras_poe.h create mode 100644 orte/mca/ras/poe/ras_poe_component.c create mode 100644 orte/mca/ras/poe/ras_poe_module.c diff --git a/orte/mca/ras/poe/Makefile.am b/orte/mca/ras/poe/Makefile.am new file mode 100644 index 0000000000..56af90b3c3 --- /dev/null +++ b/orte/mca/ras/poe/Makefile.am @@ -0,0 +1,48 @@ +# +# 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$ +# + +# Use the top-level Makefile.options + + + +sources = \ + ras_poe.h \ + ras_poe_component.c \ + ras_poe_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 OMPI_BUILD_ras_poe_DSO +component_noinst = +component_install = mca_ras_poe.la +else +component_noinst = libmca_ras_poe.la +component_install = +endif + +mcacomponentdir = $(libdir)/openmpi +mcacomponent_LTLIBRARIES = $(component_install) +mca_ras_poe_la_SOURCES = $(sources) +mca_ras_poe_la_LDFLAGS = -module -avoid-version +mca_ras_poe_la_LIBADD = \ + $(top_ompi_builddir)/orte/liborte.la \ + $(top_ompi_builddir)/opal/libopal.la + +noinst_LTLIBRARIES = $(component_noinst) +libmca_ras_poe_la_SOURCES =$(sources) +libmca_ras_poe_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/ras/poe/configure.m4 b/orte/mca/ras/poe/configure.m4 new file mode 100644 index 0000000000..1b5c7ad4f3 --- /dev/null +++ b/orte/mca/ras/poe/configure.m4 @@ -0,0 +1,36 @@ +# -*- shell-script -*- +# +# 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$ +# + +# MCA_ras_poe_CONFIG([action-if-found], [action-if-not-found]) +# ----------------------------------------------------------- + +AC_DEFUN([MCA_ras_poe_CONFIG],[ + # POE is only supported on AIX. We only need executables (no + # header files or libraries), but those can be found (or not) at + # run-time. So if we're on AIX, build this component. + AC_MSG_CHECKING([if on AIX]) + case $host_os in + aix3* | aix4* | aix5*) + happy=yes + ;; + *) + happy=no + ;; + esac + AC_MSG_RESULT([$happy]) + AS_IF([test "$happy" = "yes"], [$1], [$2]) +]) diff --git a/orte/mca/ras/poe/configure.params b/orte/mca/ras/poe/configure.params new file mode 100644 index 0000000000..2d8c4d5ff8 --- /dev/null +++ b/orte/mca/ras/poe/configure.params @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# +# 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$ +# + +# Specific to this module + +PARAM_INIT_FILE=ras_poe.c +PARAM_CONFIG_HEADER_FILE="ras_poe.h" +PARAM_CONFIG_FILES="Makefile" diff --git a/orte/mca/ras/poe/ras_poe.h b/orte/mca/ras/poe/ras_poe.h new file mode 100644 index 0000000000..d91a2fb690 --- /dev/null +++ b/orte/mca/ras/poe/ras_poe.h @@ -0,0 +1,48 @@ +/* + * 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$ + */ +/** + * @file + * + * Resource Allocation (POE) + */ +#ifndef ORTE_RAS_POE_H +#define ORTE_RAS_POE_H + +#include "mca/ras/ras.h" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + + +/** + * RAS Component + */ +struct orte_ras_poe_component_t { + orte_ras_base_component_t super; + int debug; + int priority; +}; +typedef struct orte_ras_poe_component_t orte_ras_poe_component_t; + +OMPI_COMP_EXPORT extern orte_ras_poe_component_t mca_ras_poe_component; +OMPI_COMP_EXPORT extern orte_ras_base_module_t orte_ras_poe_module; + + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif diff --git a/orte/mca/ras/poe/ras_poe_component.c b/orte/mca/ras/poe/ras_poe_component.c new file mode 100644 index 0000000000..2bf9cdaba7 --- /dev/null +++ b/orte/mca/ras/poe/ras_poe_component.c @@ -0,0 +1,96 @@ +/* + * 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 "include/orte_constants.h" +#include "mca/base/base.h" +#include "mca/base/mca_base_param.h" +#include "util/proc_info.h" +#include "opal/util/output.h" +#include "ras_poe.h" + +/* + * Local functions + */ + +static int orte_ras_poe_open(void); +static int orte_ras_poe_close(void); +static orte_ras_base_module_t* orte_ras_poe_init(int* priority); + + +orte_ras_poe_component_t mca_ras_poe_component = { + { + /* First, the mca_base_component_t struct containing meta + information about the component itself */ + + { + /* Indicate that we are a iof v1.0.0 component (which also + implies a specific MCA version) */ + + ORTE_RAS_BASE_VERSION_1_0_0, + "poe", /* MCA component name */ + ORTE_MAJOR_VERSION, /* MCA component major version */ + ORTE_MINOR_VERSION, /* MCA component minor version */ + ORTE_RELEASE_VERSION, /* MCA component release version */ + orte_ras_poe_open, /* component open */ + orte_ras_poe_close /* component close */ + }, + + /* Next the MCA v1.0.0 component meta data */ + { + /* Whether the component is checkpointable or not */ + false + }, + + orte_ras_poe_init + } +}; + +/** + * component open/close/init function + */ +static int orte_ras_poe_open(void) +{ + mca_base_component_t *c = &mca_ras_poe_component.super.ras_version; + + mca_base_param_reg_int(c, "debug", + "Whether or not to enable debugging output for the poe ras component (0 or 1)", + false, false, 0, &mca_ras_poe_component.debug); + + mca_base_param_reg_int(c, "priority", + "Priority of the poe ras component", + false , false, 100, &mca_ras_poe_component.priority); + + return ORTE_SUCCESS; +} + +static orte_ras_base_module_t *orte_ras_poe_init(int* priority) +{ + *priority = mca_ras_poe_component.priority; + + if ( NULL != getenv("LOADL_PID") ) { + return &orte_ras_poe_module; + } + return NULL; +} + +/** + * Close all subsystems. + */ +static int orte_ras_poe_close(void) +{ + return ORTE_SUCCESS; +} diff --git a/orte/mca/ras/poe/ras_poe_module.c b/orte/mca/ras/poe/ras_poe_module.c new file mode 100644 index 0000000000..6a9a773cc7 --- /dev/null +++ b/orte/mca/ras/poe/ras_poe_module.c @@ -0,0 +1,99 @@ +/* + * 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 +#include +#include + +#include "opal/util/argv.h" +#include "orte/include/orte_constants.h" +#include "orte/mca/ras/poe/ras_poe.h" +#include "orte/mca/ras/base/base.h" +#include "orte/mca/ras/base/ras_base_node.h" + +static int orte_ras_poe_allocate(orte_jobid_t jobid) +{ + char *poe_node_str; + char **names; + int i, j, ret, nnode; + int *slots; + opal_list_t nodes_list; + orte_ras_node_t *node; + opal_list_item_t* item; + + poe_node_str = getenv("LOADL_PROCESSOR_LIST"); + if (NULL == poe_node_str) { + return ORTE_ERR_NOT_FOUND; + } + + /* poe_node_str is something like "nodeA nodeA nodeB nodeB" */ + + names = opal_argv_copy(opal_argv_split(poe_node_str, ' ')); + nnode = opal_argv_count(names); + + OBJ_CONSTRUCT(&nodes_list, opal_list_t); + for (i = 0; i < nnode; i++) { + node = OBJ_NEW(orte_ras_node_t); + if (NULL == node) { + return ORTE_ERR_OUT_OF_RESOURCE; + } + node->node_name = strdup(names[i]); + node->node_arch = NULL; + node->node_state = ORTE_NODE_STATE_UP; + node->node_cellid = 0; + node->node_slots_inuse = 0; + node->node_slots_max = 0; + node->node_slots = 1; + opal_list_append(&nodes_list, &node->super); + } + ret = orte_ras_base_node_insert(&nodes_list); + ret = orte_ras_base_allocate_nodes(jobid, &nodes_list); + + while (NULL != (item = opal_list_remove_first(&nodes_list))) { + OBJ_RELEASE(item); + } + OBJ_DESTRUCT(&nodes_list); + + return ret; +} + +static int orte_ras_poe_node_insert(opal_list_t *nodes) +{ + return orte_ras_base_node_insert(nodes); +} + +static int orte_ras_poe_node_query(opal_list_t *nodes) +{ + return orte_ras_base_node_insert(nodes); +} + +static int orte_ras_poe_deallocate(orte_jobid_t jobid) +{ + return ORTE_SUCCESS; +} + +static int orte_ras_poe_finalize(void) +{ + return ORTE_SUCCESS; +} + +orte_ras_base_module_t orte_ras_poe_module = { + orte_ras_poe_allocate, + orte_ras_poe_node_insert, + orte_ras_poe_node_query, + orte_ras_poe_deallocate, + orte_ras_poe_finalize +};