This stuff is soooo out-of-date that a complete rewrite would be required - thankfully, nobody cares
This commit was SVN r23944.
Этот коммит содержится в:
родитель
86c7365e8e
Коммит
894230b121
@ -1 +0,0 @@
|
||||
rhc
|
@ -1,48 +0,0 @@
|
||||
#
|
||||
# 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) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = $(ess_bproc_CPPFLAGS)
|
||||
|
||||
sources = \
|
||||
ess_bproc.h \
|
||||
ess_bproc_component.c \
|
||||
ess_bproc_module.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_ess_bproc_DSO
|
||||
component_noinst =
|
||||
component_install = mca_ess_bproc.la
|
||||
else
|
||||
component_noinst = libmca_ess_bproc.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_ess_bproc_la_SOURCES = $(sources)
|
||||
mca_ess_bproc_la_LDFLAGS = -module -avoid-version $(ess_bproc_LDFLAGS)
|
||||
mca_ess_bproc_la_LIBADD = $(ess_bproc_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_ess_bproc_la_SOURCES =$(sources)
|
||||
libmca_ess_bproc_la_LDFLAGS = -module -avoid-version $(ess_bproc_LDFLAGS)
|
||||
libmca_ess_bproc_la_LIBADD = $(ess_bproc_LIBS)
|
@ -1,40 +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-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
AC_DEFUN([MCA_orte_ess_bproc_PRIORITY], [30])
|
||||
|
||||
# MCA_ess_bproc_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_orte_ess_bproc_CONFIG],[
|
||||
AC_CONFIG_FILES([orte/mca/ess/bproc/Makefile])
|
||||
|
||||
ORTE_CHECK_BPROC([ess_bproc], [ess_bproc_good=1],
|
||||
[ess_bproc_good=1], [ess_bproc_good=0])
|
||||
# if check worked, set wrapper flags if so.
|
||||
# Evaluate succeed / fail
|
||||
AS_IF([test "$ess_bproc_good" = "1"],
|
||||
[ess_bproc_WRAPPER_EXTRA_LDFLAGS="$ess_bproc_LDFLAGS"
|
||||
ess_bproc_WRAPPER_EXTRA_LIBS="$ess_bproc_LIBS"
|
||||
$1],
|
||||
[$2])
|
||||
# set build flags to use in makefile
|
||||
AC_SUBST([ess_bproc_CPPFLAGS])
|
||||
AC_SUBST([ess_bproc_LDFLAGS])
|
||||
AC_SUBST([ess_bproc_LIBS])
|
||||
])dnl
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef ORTE_ESS_BPROC_H
|
||||
#define ORTE_ESS_BPROC_H
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Module open / close
|
||||
*/
|
||||
int orte_ess_bproc_component_open(void);
|
||||
int orte_ess_bproc_component_close(void);
|
||||
int orte_ess_bproc_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_ess_base_component_t mca_ess_bproc_component;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* ORTE_ESS_BPROC_H */
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "ess_bproc.h"
|
||||
|
||||
extern orte_ess_base_module_t orte_ess_bproc_module;
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
orte_ess_base_component_t mca_ess_bproc_component = {
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
{
|
||||
ORTE_ESS_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
"bproc",
|
||||
ORTE_MAJOR_VERSION,
|
||||
ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
orte_ess_bproc_component_open,
|
||||
orte_ess_bproc_component_close,
|
||||
orte_ess_bproc_component_query
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int orte_ess_bproc_component_open(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_ess_bproc_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
/* if we can build, we are undoubtedly in a bproc environment,
|
||||
* so set a reasonable priority
|
||||
*/
|
||||
*priority = 20;
|
||||
*module = (mca_base_module_t*)&orte_ess_bproc_module;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_ess_bproc_component_close(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1,357 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include <sys/bproc.h>
|
||||
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
|
||||
#include "orte/mca/ess/ess.h"
|
||||
#include "orte/mca/ess/base/base.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
#include "orte/util/show_help.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
|
||||
#include "ess_bproc.h"
|
||||
|
||||
static int bproc_set_name(void);
|
||||
|
||||
static int rte_init(void);
|
||||
static int rte_finalize(void);
|
||||
static bool proc_is_local(orte_process_name_t *proc);
|
||||
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc);
|
||||
static char* proc_get_hostname(orte_process_name_t *proc);
|
||||
static uint8_t proc_get_local_rank(orte_process_name_t *proc);
|
||||
static uint8_t proc_get_node_rank(orte_process_name_t *proc);
|
||||
|
||||
orte_ess_base_module_t orte_ess_bproc_module = {
|
||||
rte_init,
|
||||
rte_finalize,
|
||||
orte_ess_base_app_abort,
|
||||
proc_is_local,
|
||||
proc_get_daemon,
|
||||
proc_get_hostname,
|
||||
proc_get_local_rank,
|
||||
proc_get_node_rank,
|
||||
NULL, /* update_pidmap */
|
||||
NULL, /* update_nidmap */
|
||||
orte_ess_base_query_sys_info,
|
||||
NULL /* no FT support for Bproc */
|
||||
};
|
||||
|
||||
static opal_pointer_array_t nidmap;
|
||||
static orte_pmap_t *pmap = NULL;
|
||||
static orte_vpid_t nprocs;
|
||||
|
||||
static int rte_init(void)
|
||||
{
|
||||
int ret;
|
||||
char *error = NULL;
|
||||
|
||||
/* run the prolog */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
|
||||
error = "orte_ess_base_std_prolog";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Start by getting a unique name from the enviro */
|
||||
bproc_set_name();
|
||||
|
||||
/* if I am a daemon, complete my setup using the
|
||||
* default procedure
|
||||
*/
|
||||
if (ORTE_PROC_IS_DAEMON) {
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_ess_base_orted_setup";
|
||||
goto error;
|
||||
}
|
||||
|
||||
} else if (ORTE_PROC_IS_TOOL) {
|
||||
/* otherwise, if I am a tool proc, use that procedure */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_ess_base_tool_setup";
|
||||
goto error;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* otherwise, I must be an application process - use
|
||||
* the default procedure to finish my setup
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_app_setup())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_ess_base_app_setup";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* setup the nidmap arrays */
|
||||
OBJ_CONSTRUCT(&nidmap, opal_pointer_array_t);
|
||||
opal_pointer_array_init(&nidmap, 8, INT32_MAX, 8);
|
||||
|
||||
/* if one was provided, build my nidmap */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_build_nidmap(orte_process_info.sync_buf,
|
||||
&nidmap, &pmap, &nprocs))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
error = "orte_ess_base_build_nidmap";
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
||||
error:
|
||||
orte_show_help("help-orte-runtime.txt",
|
||||
"orte_init:startup:internal-failure",
|
||||
true, error, ORTE_ERROR_NAME(ret), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rte_finalize(void)
|
||||
{
|
||||
int ret;
|
||||
orte_nid_t **nids;
|
||||
int32_t i;
|
||||
|
||||
/* if I am a daemon, finalize using the default procedure */
|
||||
if (ORTE_PROC_IS_DAEMON) {
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_orted_finalize())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else if (ORTE_PROC_IS_TOOL) {
|
||||
/* otherwise, if I am a tool proc, use that procedure */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_finalize())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* otherwise, I must be an application process - deconstruct
|
||||
* my nidmap arrays
|
||||
*/
|
||||
nids = (orte_nid_t**)nidmap.addr;
|
||||
for (i=0; i < nidmap.size; i++) {
|
||||
if (NULL == nids[i]) {
|
||||
break;
|
||||
}
|
||||
if (NULL != nids[i]->name) {
|
||||
free(nids[i]->name);
|
||||
nids[i]->name = NULL;
|
||||
}
|
||||
}
|
||||
OBJ_DESTRUCT(&nidmap);
|
||||
free(pmap);
|
||||
pmap = NULL;
|
||||
|
||||
/* use the default procedure to finish */
|
||||
if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool proc_is_local(orte_process_name_t *proc)
|
||||
{
|
||||
if (pmap[proc->vpid].node == (int32_t)ORTE_PROC_MY_DAEMON->vpid) {
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:bproc: proc %s is LOCAL",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc)));
|
||||
return true;
|
||||
}
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:bproc: proc %s is REMOTE",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc)));
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/* the daemon's vpid does not necessairly correlate
|
||||
* to the node's index in the node array since
|
||||
* some nodes may not have a daemon on them. Thus,
|
||||
* we have to search for the daemon in the array.
|
||||
* Fortunately, this is rarely done
|
||||
*/
|
||||
static int32_t find_daemon_node(orte_vpid_t vpid)
|
||||
{
|
||||
int32_t i;
|
||||
orte_nid_t **nids;
|
||||
|
||||
nids = (orte_nid_t**)nidmap.addr;
|
||||
for (i=0; i < nidmap.size; i++) {
|
||||
if (NULL == nids[i]) {
|
||||
break;
|
||||
}
|
||||
if (vpid == nids[i]->daemon) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static orte_vpid_t proc_get_daemon(orte_process_name_t *proc)
|
||||
{
|
||||
orte_nid_t *nid;
|
||||
|
||||
if( ORTE_JOBID_IS_DAEMON(proc->jobid) ) {
|
||||
return proc->vpid;
|
||||
}
|
||||
if (NULL == (nid = orte_util_lookup_nid(proc))) {
|
||||
return ORTE_VPID_INVALID;
|
||||
}
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:env: proc %s is hosted by daemon %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc),
|
||||
ORTE_VPID_PRINT(nid->daemon)));
|
||||
|
||||
return nid->daemon;
|
||||
}
|
||||
|
||||
static char* proc_get_hostname(orte_process_name_t *proc)
|
||||
{
|
||||
int32_t node;
|
||||
orte_nid_t **nids;
|
||||
|
||||
if (ORTE_PROC_MY_DAEMON->jobid == proc->jobid) {
|
||||
/* looking for the daemon's hostname */
|
||||
node = find_daemon_node(proc->vpid);
|
||||
if (0 > node) {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
node = pmap[proc->vpid].node;
|
||||
}
|
||||
nids = (orte_nid_t**)nidmap.addr;
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:bproc: proc %s is on host %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc),
|
||||
nids[node]->name));
|
||||
|
||||
return nids[node]->name;
|
||||
}
|
||||
|
||||
static uint8_t proc_get_local_rank(orte_process_name_t *proc)
|
||||
{
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:bproc: proc %s has local rank %d",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc),
|
||||
(int)pmap[proc->vpid].local_rank));
|
||||
|
||||
return pmap[proc->vpid].local_rank;
|
||||
}
|
||||
|
||||
static uint8_t proc_get_node_rank(orte_process_name_t *proc)
|
||||
{
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_ess_base_output,
|
||||
"%s ess:bproc: proc %s has node rank %d",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(proc),
|
||||
(int)pmap[proc->vpid].node_rank));
|
||||
|
||||
return pmap[proc->vpid].node_rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the process name from the information put into the environment
|
||||
* by the bproc launcher.
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
static int bproc_set_name(void)
|
||||
{
|
||||
int rc;
|
||||
int id;
|
||||
char *jobid_str, *vpid_string, *bproc_rank_string;
|
||||
orte_jobid_t jobid;
|
||||
orte_vpid_t vpid_start;
|
||||
int stride, bproc_rank;
|
||||
|
||||
id = mca_base_param_register_string("orte", "ess", "jobid", NULL, NULL);
|
||||
mca_base_param_lookup_string(id, &jobid_str);
|
||||
if (NULL == jobid_str) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_jobid(&jobid, jobid_str))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return(rc);
|
||||
}
|
||||
free(jobid_str);
|
||||
ORTE_PROC_MY_NAME->jobid = jobid;
|
||||
|
||||
/* BPROC_RANK is set by bproc when we do a parallel launch */
|
||||
bproc_rank_string = getenv("BPROC_RANK");
|
||||
if (NULL == bproc_rank_string) {
|
||||
opal_output(0, "ess:bproc_get: Error: Environment variable "
|
||||
"BPROC_RANK not found.\n");
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
bproc_rank = (int)strtol(bproc_rank_string, NULL, 10);
|
||||
|
||||
/* to compute our process name, we need to know two other things: the
|
||||
* stride (i.e., the size of the step between vpids in this launch
|
||||
* wave) and the starting vpid of this launch. Get those values here
|
||||
*/
|
||||
id = mca_base_param_register_int("orte", "ess_bproc", "stride", NULL, -1);
|
||||
mca_base_param_lookup_int(id, &stride);
|
||||
if (stride < 0) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
id = mca_base_param_register_string("orte", "ess_bproc", "vpid_start", NULL, NULL);
|
||||
mca_base_param_lookup_string(id, &vpid_string);
|
||||
if (NULL == vpid_string) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
rc = orte_util_convert_string_to_vpid(&vpid_start, vpid_string);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return(rc);
|
||||
}
|
||||
|
||||
/* compute our vpid */
|
||||
ORTE_PROC_MY_NAME->vpid = vpid_start + (bproc_rank * stride);
|
||||
|
||||
|
||||
if(NULL != orte_process_info.nodename) {
|
||||
free(orte_process_info.nodename);
|
||||
}
|
||||
asprintf(&orte_process_info.nodename, "%d", bproc_currnode());
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "opal/util/opal_environ.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "orte/orte_constants.h"
|
||||
#include "orte/mca/sds/base/base.h"
|
||||
#include "orte/mca/ns/base/base.h"
|
||||
#include "orte/mca/ns/ns.h"
|
||||
#include "orte/mca/errmgr/base/base.h"
|
||||
|
||||
|
||||
/**
|
||||
* sets up the environment so that a process launched with the bproc launcher can
|
||||
* figure out its name
|
||||
* @param cell the cell that the process belongs to.
|
||||
* @param job the job the process belongs to
|
||||
* @param vpid_start the starting vpid for the current parallel launch
|
||||
* @param global_vpid_start the starting vpid for the job
|
||||
* @param num_procs the number of user processes in the job
|
||||
* @param env a pointer to the environment to setup
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
int orte_ns_nds_bproc_put(orte_cellid_t cell, orte_jobid_t job,
|
||||
orte_vpid_t vpid_start, orte_vpid_t global_vpid_start,
|
||||
int num_procs, char ***env) {
|
||||
char* param;
|
||||
char* value;
|
||||
int rc;
|
||||
|
||||
/* set the mode to bproc */
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds",NULL))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, "bproc", true, env);
|
||||
free(param);
|
||||
|
||||
/* not a seed */
|
||||
if(NULL == (param = mca_base_param_environ_variable("seed",NULL,NULL))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_unsetenv(param, env);
|
||||
free(param);
|
||||
|
||||
/* since we want to pass the name as separate components, make sure
|
||||
* that the "name" environmental variable is cleared!
|
||||
*/
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","name"))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_unsetenv(param, env);
|
||||
free(param);
|
||||
|
||||
/* setup the name */
|
||||
if(ORTE_SUCCESS != (rc = orte_ns.convert_cellid_to_string(&value, cell))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","cellid"))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, value, true, env);
|
||||
free(param);
|
||||
free(value);
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&value, job))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","jobid"))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, value, true, env);
|
||||
free(param);
|
||||
free(value);
|
||||
|
||||
rc = orte_ns.convert_vpid_to_string(&value, vpid_start);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return(rc);
|
||||
}
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","vpid_start"))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, value, true, env);
|
||||
free(param);
|
||||
free(value);
|
||||
|
||||
rc = orte_ns.convert_vpid_to_string(&value, global_vpid_start);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return(rc);
|
||||
}
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","global_vpid_start"))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, value, true, env);
|
||||
free(param);
|
||||
free(value);
|
||||
|
||||
asprintf(&value, "%d", num_procs);
|
||||
if(NULL == (param = mca_base_param_environ_variable("ns","nds","num_procs")))
|
||||
{
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
opal_setenv(param, value, true, env);
|
||||
free(param);
|
||||
free(value);
|
||||
|
||||
/* we have to set this environmental variable so bproc will give us our rank
|
||||
* after the launch */
|
||||
|
||||
putenv("BPROC_RANK=XXXXXXX");
|
||||
opal_setenv("BPROC_RANK", "XXXXXXX", true, env);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
rhc
|
@ -1,48 +0,0 @@
|
||||
#
|
||||
# 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) 2006-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = -I$(top_ompi_builddir)/src/include $(odls_bproc_CPPFLAGS)
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_odls_bproc_DSO
|
||||
component_noinst =
|
||||
component_install = mca_odls_bproc.la
|
||||
else
|
||||
component_noinst = libmca_odls_bproc.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
sources = \
|
||||
odls_bproc.h \
|
||||
odls_bproc.c \
|
||||
odls_bproc_component.c
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_odls_bproc_la_SOURCES = $(sources)
|
||||
mca_odls_bproc_la_LIBADD = $(odls_bproc_LIBS)
|
||||
mca_odls_bproc_la_LDFLAGS = -module -avoid-version $(odls_bproc_LDFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_odls_bproc_la_SOURCES = $(sources)
|
||||
libmca_odls_bproc_la_LIBADD = $(odls_bproc_LIBS)
|
||||
libmca_odls_bproc_la_LDFLAGS = -module -avoid-version $(odls_bproc_LDFLAGS)
|
@ -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-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# MCA_odls_bproc_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_orte_odls_bproc_CONFIG],[
|
||||
AC_CONFIG_FILES([orte/mca/odls/bproc/Makefile])
|
||||
|
||||
ORTE_CHECK_BPROC([odls_bproc], [odls_bproc_good=1],
|
||||
[odls_bproc_good=1], [odls_bproc_good=0])
|
||||
|
||||
# if check worked, set wrapper flags if so.
|
||||
# Evaluate succeed / fail
|
||||
AS_IF([test "$odls_bproc_good" = "1"],
|
||||
[odls_bproc_WRAPPER_EXTRA_LDFLAGS="$odls_bproc_LDFLAGS"
|
||||
odls_bproc_WRAPPER_EXTRA_LIBS="$odls_bproc_LIBS"
|
||||
$1],
|
||||
[$2])
|
||||
|
||||
# set build flags to use in makefile
|
||||
AC_SUBST([odls_bproc_CPPFLAGS])
|
||||
AC_SUBST([odls_bproc_LDFLAGS])
|
||||
AC_SUBST([odls_bproc_LIBS])
|
||||
])dnl
|
@ -1,528 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/**
|
||||
* @file:
|
||||
* Part of the bproc launcher.
|
||||
* See odls_bproc.h for an overview of how it works.
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/util/os_dirpath.h"
|
||||
#include "opal/util/os_path.h"
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/iof_base_setup.h"
|
||||
#include "orte/util/session_dir.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/mca/odls/base/odls_private.h"
|
||||
#include "odls_bproc.h"
|
||||
|
||||
static int orte_odls_bproc_launch_local_procs(opal_buffer_t *data);
|
||||
static int orte_odls_bproc_kill_local_procs(orte_jobid_t job, bool set_state);
|
||||
static int orte_odls_bproc_signal_local_procs(const orte_process_name_t *proc, int32_t signal);
|
||||
|
||||
/**
|
||||
* Initialization of the bproc_orted module with all the needed function pointers
|
||||
*/
|
||||
orte_odls_base_module_t orte_odls_bproc_module = {
|
||||
orte_odls_base_default_get_add_procs_data,
|
||||
orte_odls_bproc_launch_local_procs,
|
||||
orte_odls_bproc_kill_local_procs,
|
||||
orte_odls_bproc_signal_local_procs,
|
||||
orte_odls_base_default_deliver_message,
|
||||
orte_odls_base_default_require_sync
|
||||
};
|
||||
|
||||
static int odls_bproc_make_dir(char *directory);
|
||||
static char * odls_bproc_get_base_dir_name(int proc_rank, orte_jobid_t jobid,
|
||||
orte_std_cntr_t app_context);
|
||||
static void odls_bproc_delete_dir_tree(char * path);
|
||||
static int odls_bproc_remove_dir(void);
|
||||
static void odls_bproc_send_cb(int status, orte_process_name_t * peer,
|
||||
opal_buffer_t* buffer, int tag, void* cbdata);
|
||||
static int odls_bproc_setup_stdio(orte_process_name_t *proc_name,
|
||||
int proc_rank, orte_jobid_t jobid,
|
||||
orte_std_cntr_t app_context, bool connect_stdin);
|
||||
|
||||
/* Local globals */
|
||||
static char *user = NULL;
|
||||
static char *frontend = NULL;
|
||||
|
||||
/**
|
||||
* Creates the passed directory. If the directory already exists, it and its
|
||||
* contents will be deleted then the directory will be created.
|
||||
* @param directory The directory to be created.
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
static int
|
||||
odls_bproc_make_dir(char *directory)
|
||||
{
|
||||
struct stat buf;
|
||||
mode_t my_mode = S_IRWXU; /* at the least, I need to be able to do anything */
|
||||
|
||||
if (0 == stat(directory, &buf)) { /* exists - delete it and its contents */
|
||||
odls_bproc_delete_dir_tree(directory);
|
||||
}
|
||||
/* try to create it with proper mode */
|
||||
return(opal_os_dirpath_create(directory, my_mode));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a path of the form:
|
||||
* @code
|
||||
* /tmp/openmpi-bproc-<user>/<universe>/<jobid>-<app_context>/<proc_rank>/
|
||||
* @endcode
|
||||
* which is used to put links to the pty/pipes in
|
||||
* @param proc_rank the process's rank on the node
|
||||
* @param jobid the jobid the proc belongs to
|
||||
* @param app_context the application context number within the job
|
||||
* @retval path
|
||||
*/
|
||||
static char *
|
||||
odls_bproc_get_base_dir_name(int proc_rank, orte_jobid_t jobid,
|
||||
orte_std_cntr_t app_context)
|
||||
{
|
||||
char *path = NULL, *job = NULL;
|
||||
int rc;
|
||||
|
||||
rc = orte_util_convert_jobid_to_string(&job, jobid);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the username set by the bproc plm. We need to get it from here
|
||||
* because on many bproc systems the method we use to get the username
|
||||
* from the system on the backend fails and we only get the uid
|
||||
*/
|
||||
mca_base_param_reg_string_name("orte", "plm_bproc_username",
|
||||
"Name of the user on the remote node",
|
||||
false, false, NULL, &user);
|
||||
|
||||
if (0 > asprintf(&frontend, OPAL_PATH_SEP"%s"OPAL_PATH_SEP"openmpi-bproc-%s",
|
||||
orte_process_info.tmpdir_base, user)) {
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if (0 > asprintf(&path, "%s"OPAL_PATH_SEP"%s-%d"OPAL_PATH_SEP"%d",
|
||||
frontend, job, (int) app_context, proc_rank)) {
|
||||
ORTE_ERROR_LOG(ORTE_ERROR);
|
||||
path = NULL;
|
||||
}
|
||||
OPAL_OUTPUT_VERBOSE((0, orte_odls_globals.output,
|
||||
"odls bproc io setup. Path: %s\n", path));
|
||||
free(user);
|
||||
free(job);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deletes the passed directory tree recursively
|
||||
* @param path the path to the base directory to delete
|
||||
*/
|
||||
static void
|
||||
odls_bproc_delete_dir_tree(char * path)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
char *filenm;
|
||||
int ret;
|
||||
struct stat buf;
|
||||
dp = opendir(path);
|
||||
if (NULL == dp) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (NULL != (ep = readdir(dp)) ) {
|
||||
/* skip: . and .. */
|
||||
if ((0 != strcmp(ep->d_name, ".")) && (0 != strcmp(ep->d_name, ".."))) {
|
||||
filenm = opal_os_path(false, path, ep->d_name, NULL);
|
||||
ret = stat(filenm, &buf);
|
||||
if (ret < 0 || S_ISDIR(buf.st_mode)) {
|
||||
odls_bproc_delete_dir_tree(filenm);
|
||||
free(filenm);
|
||||
continue;
|
||||
}
|
||||
unlink(filenm);
|
||||
free(filenm);
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
rmdir(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the bproc directory
|
||||
* @code /tmp/openmpi-bproc-<user>/ @endcode and all of its contents
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
static int
|
||||
odls_bproc_remove_dir()
|
||||
{
|
||||
/* we do our best to clean up the directory tree, but we ignore errors*/
|
||||
odls_bproc_delete_dir_tree(frontend);
|
||||
free(frontend);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback function for when we tell mpirun we are ready
|
||||
* @param status
|
||||
* @param peer
|
||||
* @param buffer
|
||||
* @param tag
|
||||
* @param cbdata
|
||||
*/
|
||||
static void
|
||||
odls_bproc_send_cb(int status, orte_process_name_t * peer,
|
||||
opal_buffer_t* buffer, int tag, void* cbdata)
|
||||
{
|
||||
OBJ_RELEASE(buffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create Standard I/O symlinks in the filesystem for a given proc
|
||||
*
|
||||
* Create Standard I/O symlinks in the filesystem for a given proc.
|
||||
* The symlinks will be placed in:
|
||||
* @code
|
||||
* /tmp/openmpi-bproc-<user>/<universe>/<jobid>-<app_context>/<proc_rank>/
|
||||
* @endcode
|
||||
*
|
||||
* The symlinks will be to FIFOs for stdin and stderr. stdout will either
|
||||
* be to a FIFO or pty, depending on the configuration of Open MPI.
|
||||
*
|
||||
* @param proc_rank the process's rank on the node
|
||||
* @param jobid the jobid the proc belongs to
|
||||
* @param app_context the application context number within the job
|
||||
* @param connect_stdin if true, stdin will be connected, otherwise it will be
|
||||
* set to /dev/null
|
||||
*
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
static int
|
||||
odls_bproc_setup_stdio(orte_process_name_t *proc_name, int proc_rank,
|
||||
orte_jobid_t jobid,
|
||||
orte_std_cntr_t app_context, bool connect_stdin)
|
||||
{
|
||||
char *path_prefix, *fd_link_path = NULL;
|
||||
int rc = ORTE_SUCCESS, fd;
|
||||
#if defined(HAVE_OPENPTY) && (OPAL_ENABLE_PTY_SUPPORT != 0)
|
||||
int amaster, aslave;
|
||||
char pty_name[256];
|
||||
struct termios term_attrs;
|
||||
#endif
|
||||
|
||||
path_prefix = odls_bproc_get_base_dir_name(proc_rank, jobid, (size_t)app_context);
|
||||
if (NULL == path_prefix) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* check for existence and access, or create it */
|
||||
if (ORTE_SUCCESS != (rc = odls_bproc_make_dir(path_prefix))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* setup the stdin FIFO. Always use a fifo for the same reason we
|
||||
always use a pipe in the iof_setup code -- don't want to flush
|
||||
onto the floor during close */
|
||||
fd_link_path = opal_os_path( false, path_prefix, "0", NULL );
|
||||
if (NULL == fd_link_path) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (connect_stdin) {
|
||||
if (0 != mkfifo(fd_link_path, S_IRWXU)) {
|
||||
perror("odls_bproc mkfifo failed");
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fd = open(fd_link_path, O_RDWR);
|
||||
if (-1 == fd) {
|
||||
perror("odls_bproc open failed");
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
orte_iof.iof_publish(proc_name, ORTE_IOF_SINK,
|
||||
ORTE_IOF_STDIN, fd);
|
||||
} else {
|
||||
if(0 != symlink("/dev/null", fd_link_path)) {
|
||||
perror("odls_bproc could not create symlink");
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
free(fd_link_path);
|
||||
fd_link_path = NULL;
|
||||
|
||||
/* setup the stdout PTY / FIFO */
|
||||
fd_link_path = opal_os_path( false, path_prefix, "1", NULL );
|
||||
if (NULL == fd_link_path) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#if defined(HAVE_OPENPTY) && (OPAL_ENABLE_PTY_SUPPORT != 0)
|
||||
if (0 != openpty(&amaster, &aslave, pty_name, NULL, NULL)) {
|
||||
opal_output(0, "odls_bproc: openpty failed, using pipes instead");
|
||||
goto stdout_fifo_setup;
|
||||
}
|
||||
|
||||
if (0 != symlink(pty_name, fd_link_path)) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (tcgetattr(aslave, &term_attrs) < 0) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
term_attrs.c_lflag &= ~ (ECHO | ECHOE | ECHOK |
|
||||
ECHOCTL | ECHOKE | ECHONL);
|
||||
term_attrs.c_iflag &= ~ (ICRNL | INLCR | ISTRIP | INPCK | IXON);
|
||||
term_attrs.c_oflag &= ~ (OCRNL | ONLCR);
|
||||
if (tcsetattr(aslave, TCSANOW, &term_attrs) == -1) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
orte_iof.iof_publish(proc_name, ORTE_IOF_SOURCE,
|
||||
ORTE_IOF_STDOUT, amaster);
|
||||
|
||||
goto stderr_fifo_setup;
|
||||
|
||||
stdout_fifo_setup:
|
||||
#endif
|
||||
|
||||
if (0 != mkfifo(fd_link_path, S_IRWXU)) {
|
||||
perror("odls_bproc mkfifo failed");
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fd = open(fd_link_path, O_RDWR);
|
||||
if (-1 == fd) {
|
||||
perror("odls_bproc open failed");
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
orte_iof.iof_publish(proc_name, ORTE_IOF_SOURCE,
|
||||
ORTE_IOF_STDOUT, fd);
|
||||
|
||||
#if defined(HAVE_OPENPTY) && (OPAL_ENABLE_PTY_SUPPORT != 0)
|
||||
stderr_fifo_setup:
|
||||
#endif
|
||||
|
||||
free(fd_link_path);
|
||||
fd_link_path = NULL;
|
||||
|
||||
/* setup the stderr FIFO. Always a fifo */
|
||||
fd_link_path = opal_os_path( false, path_prefix, "2", NULL );
|
||||
if (NULL == fd_link_path) {
|
||||
rc = ORTE_ERROR;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (0 != mkfifo(fd_link_path, S_IRWXU)) {
|
||||
perror("odls_bproc mkfifo failed");
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fd = open(fd_link_path, O_RDWR);
|
||||
if (-1 == fd) {
|
||||
perror("odls_bproc open failed");
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
orte_iof.iof_publish(proc_name, ORTE_IOF_SOURCE,
|
||||
ORTE_IOF_STDERR, fd);
|
||||
|
||||
cleanup:
|
||||
if (NULL != path_prefix) {
|
||||
free(path_prefix);
|
||||
}
|
||||
if (NULL != fd_link_path) {
|
||||
free(fd_link_path);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup io for the current node, then tell orterun we are ready for the actual
|
||||
* processes.
|
||||
* @retval ORTE_SUCCESS
|
||||
* @retval error
|
||||
*/
|
||||
int orte_odls_bproc_launch_local_procs(opal_buffer_t *data)
|
||||
{
|
||||
orte_odls_child_t *child;
|
||||
opal_list_item_t* item;
|
||||
int rc;
|
||||
int src = 0;
|
||||
opal_buffer_t *ack;
|
||||
bool connect_stdin;
|
||||
orte_jobid_t jobid;
|
||||
int cycle = 0;
|
||||
|
||||
/**
|
||||
* hack for bproc4, change process group so that we do not receive signals
|
||||
* from the parent/front-end process, as bproc4 does not currently allow the
|
||||
* process to intercept the signal
|
||||
*/
|
||||
setpgid(0,0);
|
||||
|
||||
/* construct the list of children we are to launch */
|
||||
if (ORTE_SUCCESS != (rc = orte_odls_base_default_construct_child_list(data, &jobid))) {
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
||||
"%s odls:bproc:launch:local failed to construct child list on error %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_ERROR_NAME(rc)));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* set up the io files for our children */
|
||||
for(item = opal_list_get_first(&orte_odls_globals.children);
|
||||
item != opal_list_get_end(&orte_odls_globals.children);
|
||||
item = opal_list_get_next(item)) {
|
||||
child = (orte_odls_child_t *) item;
|
||||
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
||||
"%s odls:bproc:launch:local setting up io for %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(child->name)));
|
||||
/* only setup to forward stdin if it is rank 0, otherwise connect
|
||||
* to /dev/null
|
||||
*/
|
||||
if(0 == child->name->vpid) {
|
||||
connect_stdin = true;
|
||||
} else {
|
||||
connect_stdin = false;
|
||||
}
|
||||
|
||||
rc = odls_bproc_setup_stdio(child->name, cycle,
|
||||
jobid, child->app_idx,
|
||||
connect_stdin);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cycle++;
|
||||
}
|
||||
|
||||
/* message to indicate that we are ready */
|
||||
ack = OBJ_NEW(opal_buffer_t);
|
||||
rc = orte_dss.pack(ack, &src, 1, ORTE_INT);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
rc = mca_oob_send_packed_nb(ORTE_PROC_MY_HNP, ack, ORTE_RML_TAG_BPROC, 0,
|
||||
odls_bproc_send_cb, NULL);
|
||||
if (0 > rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = ORTE_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to terminate a job. Since this component only runs on remote nodes
|
||||
* and doesn't actually launch any processes, this function is not needed
|
||||
* so is a noop.
|
||||
*/
|
||||
int orte_odls_bproc_kill_local_procs(orte_jobid_t job, bool set_state)
|
||||
{
|
||||
orte_iof.iof_flush();
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to signal a process. Since this component only runs on remote nodes
|
||||
* and doesn't actually launch any processes, this function is not needed
|
||||
* so is a noop.
|
||||
* @param proc the process's name
|
||||
* @param signal The signal to send
|
||||
* @retval ORTE_SUCCESS
|
||||
*/
|
||||
int orte_odls_bproc_signal_local_procs(const orte_process_name_t* proc, int32_t signal)
|
||||
{
|
||||
orte_iof.iof_flush();
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finalizes the bproc module. Cleanup tmp directory/files
|
||||
* used for I/O forwarding.
|
||||
* @retval ORTE_SUCCESS
|
||||
*/
|
||||
int orte_odls_bproc_finalize(void)
|
||||
{
|
||||
orte_iof.iof_flush();
|
||||
odls_bproc_remove_dir();
|
||||
orte_session_dir_finalize(orte_process_info.my_name);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/**
|
||||
* @file:
|
||||
* Part of the bproc launching system. This launching system is broken into 2
|
||||
* parts: one runs under the PLS on the head node to launch the orteds, and the
|
||||
* other serves as the orted's local launcher.
|
||||
*
|
||||
* The main job of this component is to setup ptys/pipes for IO forwarding.
|
||||
* See pls_bproc.h for an overview of how the entire bproc launching system works.
|
||||
*/
|
||||
#ifndef ORTE_ODLS_BPROC_H_
|
||||
#define ORTE_ODLS_BPROC_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
|
||||
#include "orte/mca/odls/odls.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Module open / close
|
||||
*/
|
||||
int orte_odls_bproc_component_open(void);
|
||||
int orte_odls_bproc_component_close(void);
|
||||
int orte_odls_bproc_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
ORTE_MODULE_DECLSPEC extern orte_odls_base_component_t mca_odls_bproc_component;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* ORTE_ODLS_BPROC_H_ */
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file:
|
||||
* Takes care of the component stuff for the MCA.
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
|
||||
|
||||
#include "orte/mca/odls/odls.h"
|
||||
#include "orte/mca/odls/base/odls_private.h"
|
||||
#include "odls_bproc.h"
|
||||
|
||||
extern orte_odls_base_module_t orte_odls_bproc_module;
|
||||
|
||||
/**
|
||||
* The bproc component data structure used to store all the relevent data
|
||||
* about this component.
|
||||
*/
|
||||
orte_odls_bproc_component_t mca_odls_bproc_component = {
|
||||
{
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
{
|
||||
ORTE_ODLS_BASE_VERSION_2_0_0,
|
||||
/* Component name and version */
|
||||
"bproc",
|
||||
ORTE_MAJOR_VERSION,
|
||||
ORTE_MINOR_VERSION,
|
||||
ORTE_RELEASE_VERSION,
|
||||
/* Component open and close functions */
|
||||
orte_odls_bproc_component_open,
|
||||
orte_odls_bproc_component_close,
|
||||
orte_odls_bproc_component_query
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the pls_bproc component, setting all the needed mca parameters and
|
||||
* finishes setting up the component struct.
|
||||
*/
|
||||
int orte_odls_bproc_component_open(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the module.
|
||||
*/
|
||||
int orte_odls_bproc_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
int ret;
|
||||
struct bproc_version_t version;
|
||||
|
||||
/* check to see if BProc is running here */
|
||||
ret = bproc_version(&version);
|
||||
if (ret != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*priority = 30;
|
||||
*module = (mca_base_module_t *)&orte_odls_bproc_module;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component close function.
|
||||
*/
|
||||
int orte_odls_bproc_component_close(void)
|
||||
{
|
||||
/* cleanup state */
|
||||
while (NULL != (item = opal_list_remove_first(&orte_odls_globals.children))) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
@ -1 +0,0 @@
|
||||
rhc
|
@ -1,49 +0,0 @@
|
||||
#
|
||||
# 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) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
dist_pkgdata_DATA = help-plm-bproc.txt
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_plm_bproc_DSO
|
||||
component_noinst =
|
||||
component_install = mca_plm_bproc.la
|
||||
else
|
||||
component_noinst = libmca_plm_bproc.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
sources = \
|
||||
plm_bproc.h \
|
||||
plm_bproc_component.c \
|
||||
plm_bproc.c \
|
||||
plm_bproc_state.c
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_plm_bproc_la_SOURCES = $(sources)
|
||||
mca_plm_bproc_la_LIBADD = $(plm_bproc_LIBS)
|
||||
mca_plm_bproc_la_LDFLAGS = -module -avoid-version $(plm_bproc_LDFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_plm_bproc_la_SOURCES = $(sources)
|
||||
libmca_plm_bproc_la_LIBADD = $(plm_bproc_LIBS)
|
||||
libmca_plm_bproc_la_LDFLAGS = -module -avoid-version $(plm_bproc_LDFLAGS)
|
@ -1,44 +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-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# MCA_plm_bproc_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_orte_plm_bproc_CONFIG],[
|
||||
AC_CONFIG_FILES([orte/mca/plm/bproc/Makefile])
|
||||
|
||||
ORTE_CHECK_BPROC([plm_bproc], [plm_bproc_good=2],
|
||||
[plm_bproc_good=1], [plm_bproc_good=0])
|
||||
# if check worked, set wrapper flags if so.
|
||||
# Evaluate succeed / fail
|
||||
AS_IF([test "$plm_bproc_good" = "1"],
|
||||
[AC_DEFINE_UNQUOTED([MCA_plm_bproc_scyld], [1],
|
||||
[Defined if we are using Scyld bproc or pre 3.2.0 LANL bproc])])
|
||||
|
||||
AS_IF([test "$plm_bproc_good" != "0"],
|
||||
[plm_bproc_WRAPPER_EXTRA_LDFLAGS="$plm_bproc_LDFLAGS"
|
||||
plm_bproc_WRAPPER_EXTRA_LIBS="$plm_bproc_LIBS"
|
||||
$1],
|
||||
[$2])
|
||||
|
||||
# set build flags to use in makefile
|
||||
AC_SUBST([plm_bproc_CPPFLAGS])
|
||||
AC_SUBST([plm_bproc_LDFLAGS])
|
||||
AC_SUBST([plm_bproc_LIBS])
|
||||
])dnl
|
@ -1,107 +0,0 @@
|
||||
# -*- text -*-
|
||||
#
|
||||
# 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
# This is the US/English general help file for Open RTE's orterun.
|
||||
#
|
||||
[bproc-vexecmove-launch]
|
||||
The bproc PLS component was not able to launch %s on node %d and therefore
|
||||
cannot continue. Errno was set to %d.
|
||||
[bproc-vexecmove-fork]
|
||||
The bproc PLS component was not able to fork and therefore cannot continue.
|
||||
Errno was set to %d.
|
||||
[no-orted]
|
||||
The bproc PLS component was not able to find the executable "%s" in the
|
||||
current directory, your PATH, or in the directory where Open MPI was
|
||||
initially installed, and therefore cannot continue.
|
||||
|
||||
For reference, we looked for
|
||||
|
||||
%s
|
||||
|
||||
Your current PATH is:
|
||||
|
||||
%s
|
||||
|
||||
We also looked for orted in the following directory:
|
||||
|
||||
%s
|
||||
|
||||
You may need to set your PATH properly, or set the MCA parameter
|
||||
pls_bproc_orted to be the path to "orted".
|
||||
[daemon-launch-number]
|
||||
The bproc PLS component was not able to launch all the daemons on the remote
|
||||
nodes and therefore cannot continue.
|
||||
|
||||
We attempted to launch %d daemons but only %d were actually launched.
|
||||
|
||||
For reference, we tried to launch %s
|
||||
[daemon-launch-bad-pid]
|
||||
The bproc PLS component was not able to launch all the daemons on the remote
|
||||
nodes and therefore cannot continue.
|
||||
|
||||
On node %d the daemon pid was %d and errno was set to %d.
|
||||
|
||||
For reference, we tried to launch %s
|
||||
[daemon-died-no-signal]
|
||||
A daemon (pid %d) launched by the bproc PLS component on node %d died
|
||||
unexpectedly so we are aborting.
|
||||
|
||||
This may be because the daemon was unable to find all the needed shared
|
||||
libraries on the remote node. You may set your LD_LIBRARY_PATH to have the
|
||||
location of the shared libraries on the remote nodes and this will
|
||||
automatically be forwarded to the remote nodes.
|
||||
[daemon-died-signal]
|
||||
A daemon (pid %d) launched by the bproc PLS component on node %d died
|
||||
unexpectedly on signal %d so we are aborting.
|
||||
|
||||
This may be because the daemon was unable to find all the needed shared
|
||||
libraries on the remote node. You may set your LD_LIBRARY_PATH to have the
|
||||
location of the shared libraries on the remote nodes and this will
|
||||
automatically be forwarded to the remote nodes.
|
||||
[proc-launch-number]
|
||||
The bproc PLS component was not able to launch all the processes on the remote
|
||||
nodes and therefore cannot continue.
|
||||
|
||||
We attempted to launch %d processes but only %d were actually launched.
|
||||
|
||||
For reference, we tried to launch %s
|
||||
[proc-launch-bad-pid]
|
||||
The bproc PLS component was not able to launch all the processes on the remote
|
||||
nodes and therefore cannot continue.
|
||||
|
||||
On node %d the process pid was %d and errno was set to %d.
|
||||
|
||||
For reference, we tried to launch %s
|
||||
|
||||
[mismatched-slots]
|
||||
The current bproc support requires that the number of available
|
||||
slots on each node be the same. Note that this does -not- mean
|
||||
that the number of processes you want to launch must be the same.
|
||||
It only requires that you have access to the same number of process
|
||||
slots on each node.
|
||||
|
||||
This is not something inherent to Open MPI, but rather a reported
|
||||
characteristic of Bproc. We are in the process of confirming that
|
||||
this requirement remains in effect. If we find that it has been
|
||||
removed, then we will revise the system to support varying
|
||||
numbers of slots on the allocated nodes.
|
||||
|
||||
Meantime, please revise your hostfile or other allocation so they
|
||||
report the same number of process slots on each node. If you want
|
||||
to force a particular mapping of numbers of processes to each node,
|
||||
please use any of the other Open MPI mechanisms for doing so.
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,56 +0,0 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file:
|
||||
*/
|
||||
|
||||
#ifndef ORTE_PLM_BPROC_H_
|
||||
#define ORTE_PLM_BPROC_H_
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include "orte/mca/plm/base/base.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* PLM bproc Component
|
||||
*/
|
||||
struct orte_plm_bproc_component_t {
|
||||
/**< The base class */
|
||||
orte_plm_base_component_t super;
|
||||
/**< The orted executable. This can be an absolute path, or if not found
|
||||
* we will look for it in the user's path */
|
||||
char * orted;
|
||||
};
|
||||
/**
|
||||
* Convenience typedef
|
||||
*/
|
||||
typedef struct orte_plm_bproc_component_t orte_plm_bproc_component_t;
|
||||
|
||||
ORTE_DECLSPEC extern orte_plm_bproc_component_t mca_plm_bproc_component;
|
||||
ORTE_DECLSPEC extern orte_plm_base_module_t orte_plm_bproc_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* ORTE_PLM_BPROC_H_ */
|
||||
|
@ -1,113 +0,0 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file:
|
||||
* Takes care of the component stuff for the MCA.
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
|
||||
#include "plm_bproc.h"
|
||||
|
||||
/*
|
||||
* Public string showing the plm ompi_bproc component version number
|
||||
*/
|
||||
const char *mca_plm_bproc_component_version_string =
|
||||
"Open MPI bproc plm MCA component version " ORTE_VERSION;
|
||||
|
||||
static int plm_bproc_open(void);
|
||||
static int plm_bproc_close(void);
|
||||
static int orte_plm_bproc_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
/**
|
||||
* The bproc component data structure used to store all the relevent data about
|
||||
* this component.
|
||||
*/
|
||||
orte_plm_bproc_component_t mca_plm_bproc_component = {
|
||||
{
|
||||
{
|
||||
ORTE_PLM_BASE_VERSION_2_0_0,
|
||||
"bproc", /* MCA component name */
|
||||
ORTE_MAJOR_VERSION, /* MCA component major version */
|
||||
ORTE_MINOR_VERSION, /* MCA component minor version */
|
||||
ORTE_RELEASE_VERSION, /* MCA component release version */
|
||||
|
||||
/* Component open and close functions */
|
||||
plm_bproc_open,
|
||||
plm_bproc_close,
|
||||
orte_plm_bproc_component_query
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the plm_bproc component, setting all the needed mca parameters and
|
||||
* finishes setting up the component struct.
|
||||
*/
|
||||
static int plm_bproc_component_open(void) {
|
||||
mca_base_component_t *c = &mca_plm_bproc_component.super.base_version;
|
||||
|
||||
/* init parameters */
|
||||
mca_base_param_reg_string(c, "orted", "Path to where orted is installed",
|
||||
false, false, "orted", &mca_plm_bproc_component.orted);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the plm_bproc component
|
||||
*/
|
||||
static int plm_bproc_component_close(void) {
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the module. We do not want to run unless we are the seed, bproc
|
||||
* is running, and we are the master node.
|
||||
*/
|
||||
static int orte_plm_bproc_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
int ret;
|
||||
struct bproc_version_t version;
|
||||
|
||||
/* see if BProc is running here */
|
||||
ret = bproc_version(&version);
|
||||
if (ret != 0) {
|
||||
*module = NULL;
|
||||
return ORTE_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
/* only launch from the master node */
|
||||
if (bproc_currnode() != BPROC_NODE_MASTER) {
|
||||
*module = NULL;
|
||||
return ORTE_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*priority = 20;
|
||||
*module = (mca_base_module_t *) &orte_plm_bproc_module;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1,401 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/orte_constants.h"
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
#include "orte/dss/dss.h"
|
||||
#include "orte/mca/ns/ns.h"
|
||||
#include "orte/mca/gpr/gpr.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/smr/smr.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/schema/schema.h"
|
||||
|
||||
#include "orte/mca/pls/bproc/pls_bproc.h"
|
||||
|
||||
/**
|
||||
* Set the process pid in the job segment and indicate the state
|
||||
* as being launched.
|
||||
*/
|
||||
|
||||
int orte_pls_bproc_set_proc_pid(const orte_process_name_t *name, pid_t pid, int nodenum)
|
||||
{
|
||||
orte_gpr_value_t *values[1];
|
||||
char *segment;
|
||||
char *nodename;
|
||||
int rc;
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&segment, name->jobid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&values[0],
|
||||
ORTE_GPR_OVERWRITE,
|
||||
segment,
|
||||
2, 0))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
free(segment);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
free(segment);
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_schema.get_proc_tokens(&(values[0]->tokens), &(values[0]->num_tokens), (orte_process_name_t*)name))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[0]->keyvals[0]), ORTE_PROC_LOCAL_PID_KEY, ORTE_PID, &pid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
asprintf(&nodename, "%ld", (long)nodenum);
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[0]->keyvals[1]), ORTE_NODE_NAME_KEY, ORTE_STRING, nodename))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
free(nodename);
|
||||
return rc;
|
||||
}
|
||||
free(nodename);
|
||||
|
||||
rc = orte_gpr.put(1, values);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
OBJ_RELEASE(values[0]);
|
||||
|
||||
/* set the process state to LAUNCHED */
|
||||
if (ORTE_SUCCESS != (rc = orte_smr.set_proc_state((orte_process_name_t*)name, ORTE_PROC_STATE_LAUNCHED, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive a specified process pid from the registry.
|
||||
*/
|
||||
int orte_pls_bproc_get_proc_pid(const orte_process_name_t* name, pid_t* pid)
|
||||
{
|
||||
char *segment;
|
||||
char **tokens;
|
||||
orte_std_cntr_t num_tokens;
|
||||
char *keys[2];
|
||||
orte_gpr_value_t** values = NULL;
|
||||
orte_std_cntr_t i, num_values = 0;
|
||||
pid_t *pptr;
|
||||
int rc;
|
||||
|
||||
/* query the job segment on the registry */
|
||||
if(ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&segment, name->jobid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_schema.get_proc_tokens(&tokens, &num_tokens, (orte_process_name_t*)name))) {
|
||||
free(segment);
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
keys[0] = ORTE_PROC_LOCAL_PID_KEY;
|
||||
keys[1] = NULL;
|
||||
|
||||
rc = orte_gpr.get(
|
||||
ORTE_GPR_KEYS_OR|ORTE_GPR_TOKENS_OR,
|
||||
segment,
|
||||
tokens,
|
||||
keys,
|
||||
&num_values,
|
||||
&values
|
||||
);
|
||||
if(rc != ORTE_SUCCESS) {
|
||||
free(segment);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(0 == num_values) {
|
||||
rc = ORTE_ERR_NOT_FOUND;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
if(1 != num_values || values[0]->cnt != 1) {
|
||||
rc = ORTE_ERR_NOT_FOUND;
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&pptr, values[0]->keyvals[0]->value, ORTE_PID))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
*pid = *pptr;
|
||||
|
||||
cleanup:
|
||||
if(NULL != values) {
|
||||
for(i=0; i<num_values; i++) {
|
||||
if(NULL != values[i]) {
|
||||
OBJ_RELEASE(values[i]);
|
||||
}
|
||||
}
|
||||
if (NULL != values) free(values);
|
||||
}
|
||||
free(segment);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all process pids for the specified job.
|
||||
*/
|
||||
int orte_pls_bproc_get_proc_pids(orte_jobid_t jobid, pid_t **pids, orte_std_cntr_t* num_pids, opal_list_t *attrs)
|
||||
{
|
||||
char *segment;
|
||||
char *keys[2];
|
||||
orte_gpr_value_t** values = NULL;
|
||||
orte_std_cntr_t i, num_values = 0;
|
||||
pid_t *pptr;
|
||||
int rc;
|
||||
|
||||
/* query the job segment on the registry */
|
||||
if(ORTE_SUCCESS != (rc = orte_schema.get_job_segment_name(&segment, jobid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
keys[0] = ORTE_PROC_PID_KEY;
|
||||
keys[1] = NULL;
|
||||
|
||||
rc = orte_gpr.get(
|
||||
ORTE_GPR_KEYS_OR|ORTE_GPR_TOKENS_OR,
|
||||
segment,
|
||||
NULL,
|
||||
keys,
|
||||
&num_values,
|
||||
&values
|
||||
);
|
||||
if(rc != ORTE_SUCCESS) {
|
||||
free(segment);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(0 == num_values) {
|
||||
*pids = NULL;
|
||||
} else {
|
||||
*pids = (pid_t*)malloc(sizeof(pid_t)*num_values);
|
||||
for(i=0; i<num_values; i++) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&pptr, values[i]->keyvals[0]->value, ORTE_PID))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
(*pids)[i] = *pptr;
|
||||
}
|
||||
}
|
||||
*num_pids = num_values;
|
||||
|
||||
cleanup:
|
||||
if(NULL != values) {
|
||||
for(i=0; i<num_values; i++) {
|
||||
if(NULL != values[i]) {
|
||||
OBJ_RELEASE(values[i]);
|
||||
}
|
||||
}
|
||||
if (NULL != values) free(values);
|
||||
}
|
||||
free(segment);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a key-value to the node segment containing the process pid for
|
||||
* the daemons.
|
||||
*/
|
||||
|
||||
int orte_pls_bproc_set_node_pid(orte_cellid_t cellid, char* node_name, orte_jobid_t jobid, pid_t pid)
|
||||
{
|
||||
orte_gpr_value_t *values[1];
|
||||
char *jobid_string, *key;
|
||||
int rc;
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&values[0],
|
||||
ORTE_GPR_OVERWRITE,
|
||||
ORTE_NODE_SEGMENT,
|
||||
1, 0))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_schema.get_node_tokens(&(values[0]->tokens), &(values[0]->num_tokens), cellid, node_name))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
asprintf(&key, "%s-%s", ORTE_PROC_PID_KEY, jobid_string);
|
||||
free(jobid_string);
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(values[0]->keyvals[0]), key, ORTE_PID, &pid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
free(key);
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
free(key);
|
||||
|
||||
rc = orte_gpr.put(1, values);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
|
||||
OBJ_RELEASE(values[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all daemon pids for the specified job.
|
||||
*/
|
||||
int orte_pls_bproc_get_node_pids(orte_jobid_t jobid, pid_t **pids, orte_std_cntr_t* num_pids)
|
||||
{
|
||||
char *keys[2];
|
||||
orte_gpr_value_t** values = NULL;
|
||||
orte_std_cntr_t i, num_values = 0;
|
||||
int rc;
|
||||
char *jobid_string;
|
||||
pid_t *pptr;
|
||||
|
||||
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid_string, jobid)))
|
||||
goto cleanup;
|
||||
|
||||
asprintf(&keys[0], "%s-%s", ORTE_PROC_PID_KEY, jobid_string);
|
||||
free(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(keys[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(0 == num_values) {
|
||||
*pids = NULL;
|
||||
} else {
|
||||
*pids = (pid_t*)malloc(sizeof(pid_t)*num_values);
|
||||
for(i=0; i<num_values; i++) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.get((void**)&pptr, values[i]->keyvals[0]->value, ORTE_PID))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
*(pids[i]) = *pptr;
|
||||
}
|
||||
}
|
||||
*num_pids = num_values;
|
||||
|
||||
cleanup:
|
||||
if(NULL != values) {
|
||||
for(i=0; i<num_values; i++)
|
||||
OBJ_RELEASE(values[i]);
|
||||
if (NULL != values) free(values);
|
||||
}
|
||||
free(keys[0]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* FUNCTIONS FOR DEALING WITH ABNORMAL TERMINATION OF BPROC
|
||||
* APPLICATION PROCESSES
|
||||
*/
|
||||
int orte_pls_bproc_comm_start(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (mca_pls_bproc_component.recv_issued) {
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD,
|
||||
ORTE_RML_TAG_BPROC_ABORT,
|
||||
ORTE_RML_PERSISTENT,
|
||||
orte_pls_bproc_recv,
|
||||
NULL))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
mca_pls_bproc_component.recv_issued = true;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int orte_pls_bproc_comm_stop(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!mca_pls_bproc_component.recv_issued) {
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_BPROC_ABORT))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
mca_pls_bproc_component.recv_issued = false;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* handle message from proxies
|
||||
* NOTE: The incoming buffer "buffer" is OBJ_RELEASED by the calling program.
|
||||
* DO NOT RELEASE THIS BUFFER IN THIS CODE
|
||||
*/
|
||||
|
||||
void orte_pls_bproc_recv(int status, orte_process_name_t* sender,
|
||||
orte_buffer_t* buffer, orte_rml_tag_t tag,
|
||||
void* cbdata)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* we don't care what was in the buffer - just set the state of the sender to ABORTED */
|
||||
if (ORTE_SUCCESS != (rc = orte_smr.set_proc_state(sender, ORTE_PROC_STATE_ABORTED, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
}
|
||||
|
@ -1,460 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "orte/orte_constants.h"
|
||||
#include "orte/orte_types.h"
|
||||
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/mca/ns/ns.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/gpr/base/base.h"
|
||||
#include "orte/mca/schema/schema_types.h"
|
||||
|
||||
#include "orte/mca/smr/base/smr_private.h"
|
||||
#include "orte/mca/smr/bproc/smr_bproc.h"
|
||||
|
||||
#define BIT_MASK(bit) (bit_set)(1 << (bit))
|
||||
#define EMPTY_SET (bit_set)0
|
||||
#define BIT_NODE_NAME 0
|
||||
#define BIT_NODE_STATE 1
|
||||
#define BIT_NODE_BPROC_STATUS 2
|
||||
#define BIT_NODE_BPROC_MODE 3
|
||||
#define BIT_NODE_BPROC_USER 4
|
||||
#define BIT_NODE_BPROC_GROUP 5
|
||||
#define BIT_SET_ALL ( BIT_MASK(BIT_NODE_NAME) \
|
||||
| BIT_MASK(BIT_NODE_STATE) \
|
||||
| BIT_MASK(BIT_NODE_BPROC_STATUS) \
|
||||
| BIT_MASK(BIT_NODE_BPROC_MODE) \
|
||||
| BIT_MASK(BIT_NODE_BPROC_USER) \
|
||||
| BIT_MASK(BIT_NODE_BPROC_GROUP))
|
||||
|
||||
/* define some local variables/types */
|
||||
typedef unsigned int bit_set;
|
||||
static opal_list_t active_node_list;
|
||||
static bool initialized=false;
|
||||
|
||||
static inline void set_bit(bit_set *set, int bit)
|
||||
{
|
||||
*set |= BIT_MASK(bit);
|
||||
}
|
||||
|
||||
static inline int is_set(bit_set set, int bit)
|
||||
{
|
||||
return (set & BIT_MASK(bit)) == BIT_MASK(bit);
|
||||
}
|
||||
|
||||
static inline int num_bits(bit_set set)
|
||||
{
|
||||
int cnt = 0;
|
||||
int bit;
|
||||
|
||||
for (bit = sizeof(bit_set) * 8 - 1; bit >= 0; bit--)
|
||||
if (is_set(set, bit))
|
||||
cnt++;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static inline int empty_set(bit_set set)
|
||||
{
|
||||
return set == EMPTY_SET;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Query the bproc node status
|
||||
*/
|
||||
|
||||
static int orte_smr_bproc_node_state(char *status)
|
||||
{
|
||||
if (strcmp(status, "up") == 0)
|
||||
return ORTE_NODE_STATE_UP;
|
||||
if (strcmp(status, "down") == 0)
|
||||
return ORTE_NODE_STATE_DOWN;
|
||||
if (strcmp(status, "boot") == 0)
|
||||
return ORTE_NODE_STATE_REBOOT;
|
||||
return ORTE_NODE_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
static bit_set find_changes(struct bproc_node_info_t *old, struct bproc_node_info_t *new)
|
||||
{
|
||||
bit_set changes = EMPTY_SET;
|
||||
|
||||
if (orte_smr_bproc_node_state(old->status)
|
||||
!= orte_smr_bproc_node_state(new->status))
|
||||
set_bit(&changes, BIT_NODE_STATE);
|
||||
|
||||
if (strcmp(old->status, new->status) != 0)
|
||||
set_bit(&changes, BIT_NODE_BPROC_STATUS);
|
||||
|
||||
if (old->mode != new->mode)
|
||||
set_bit(&changes, BIT_NODE_BPROC_MODE);
|
||||
|
||||
if (old->group != new->group)
|
||||
set_bit(&changes, BIT_NODE_BPROC_GROUP);
|
||||
|
||||
if (old->user != new->user)
|
||||
set_bit(&changes, BIT_NODE_BPROC_USER);
|
||||
|
||||
if (old->node != new->node)
|
||||
set_bit(&changes, BIT_NODE_NAME);
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a BProc update notice
|
||||
*/
|
||||
|
||||
static void update_registry(bit_set changes, struct bproc_node_info_t *ni)
|
||||
{
|
||||
int idx;
|
||||
int ret;
|
||||
int cnt;
|
||||
orte_node_state_t state;
|
||||
char *node_name;
|
||||
char *user;
|
||||
char *group;
|
||||
struct passwd *pwd;
|
||||
struct group *grp;
|
||||
orte_gpr_value_t *value;
|
||||
int rc;
|
||||
orte_smr_node_state_tracker_t *node;
|
||||
opal_list_item_t *item;
|
||||
|
||||
cnt = num_bits(changes);
|
||||
|
||||
/*
|
||||
* Check if there's anything to do
|
||||
*/
|
||||
if (cnt == 0)
|
||||
return;
|
||||
|
||||
/* check and update the general cluster status segment - this segment has entries
|
||||
* for every node in the cluster, not just the ones we want to monitor
|
||||
*/
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&value, ORTE_GPR_OVERWRITE | ORTE_GPR_TOKENS_AND,
|
||||
ORTE_BPROC_NODE_SEGMENT, cnt, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return;
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
|
||||
if (is_set(changes, BIT_NODE_STATE)) {
|
||||
state = orte_smr_bproc_node_state(ni->status);
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_NODE_STATE_KEY, ORTE_NODE_STATE, &state))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (is_set(changes, BIT_NODE_BPROC_STATUS)) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_SMR_BPROC_NODE_STATUS, ORTE_STRING, ni->status))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (is_set(changes, BIT_NODE_BPROC_MODE)) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_SMR_BPROC_NODE_MODE, ORTE_UINT32, &(ni->mode)))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (is_set(changes, BIT_NODE_BPROC_USER)) {
|
||||
if ((pwd = getpwuid(ni->user)))
|
||||
user = strdup(pwd->pw_name);
|
||||
else
|
||||
asprintf(&user, "%d\n", ni->user);
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_SMR_BPROC_NODE_USER, ORTE_STRING, user))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
free(user);
|
||||
return;
|
||||
}
|
||||
free(user);
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (is_set(changes, BIT_NODE_BPROC_GROUP)) {
|
||||
if ((grp = getgrgid(ni->group)))
|
||||
group = strdup(grp->gr_name);
|
||||
else
|
||||
asprintf(&group, "%d\n", ni->group);
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_SMR_BPROC_NODE_GROUP, ORTE_STRING, group))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
free(group);
|
||||
return;
|
||||
}
|
||||
free(group);
|
||||
idx++;
|
||||
}
|
||||
|
||||
asprintf(&node_name, "%d", ni->node);
|
||||
|
||||
if (is_set(changes, BIT_NODE_NAME)) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[idx]), ORTE_NODE_NAME_KEY, ORTE_STRING, node_name))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
free(node_name);
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (idx != cnt) {
|
||||
opal_output(0, "smr_bproc: internal error %d != %d\n", idx, cnt);
|
||||
free(node_name);
|
||||
OBJ_RELEASE(value);
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = orte_schema.get_node_tokens(&(value->tokens), &(value->num_tokens),
|
||||
ORTE_PROC_MY_NAME->cellid, node_name);
|
||||
|
||||
if (ret != ORTE_SUCCESS) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
OBJ_RELEASE(value);
|
||||
free(node_name);
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mca_smr_bproc_component.debug)
|
||||
opal_output(0, "updating node %d to segment %s\n", ni->node, value->segment);
|
||||
|
||||
if ((ret = orte_gpr.put(1, &value)) != ORTE_SUCCESS) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
}
|
||||
OBJ_RELEASE(value);
|
||||
|
||||
/* now let's see if this is one of the nodes we are monitoring and
|
||||
* update it IFF it the state changed to specified conditions. This
|
||||
* action will trigger a callback to the right place to decide what
|
||||
* to do about it
|
||||
*/
|
||||
if (mca_smr_bproc_component.monitoring &&
|
||||
is_set(changes, BIT_NODE_STATE)) {
|
||||
/* see if this is a node we are monitoring */
|
||||
for (item = opal_list_get_first(&active_node_list);
|
||||
item != opal_list_get_end(&active_node_list);
|
||||
item = opal_list_get_next(item)) {
|
||||
node = (orte_smr_node_state_tracker_t*)item;
|
||||
if (0 == strcmp(node->nodename, node_name)) {
|
||||
/* This is a node we are monitoring. If this is a state we care about,
|
||||
* and the state has changed (so we only do this once) - trip the alert monitor
|
||||
*/
|
||||
if (state != node->state &&
|
||||
(state == ORTE_NODE_STATE_DOWN || state == ORTE_NODE_STATE_REBOOT)) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_value(&value, ORTE_GPR_OVERWRITE | ORTE_GPR_TOKENS_AND,
|
||||
ORTE_BPROC_NODE_SEGMENT, 1, 0))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return;
|
||||
}
|
||||
value->tokens[0] = strdup(ORTE_BPROC_NODE_GLOBALS);
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[0]),
|
||||
ORTE_BPROC_NODE_ALERT_CNTR,
|
||||
ORTE_UNDEF, NULL))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_RELEASE(value);
|
||||
return;
|
||||
}
|
||||
if ((rc = orte_gpr.increment_value(value)) != ORTE_SUCCESS) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
}
|
||||
OBJ_RELEASE(value);
|
||||
}
|
||||
/* update our local records */
|
||||
node->state = state;
|
||||
/* cleanup and return - no need to keep searching */
|
||||
free(node_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if this isn't someone we are monitoring, or it doesn't meet specified conditions,
|
||||
* then just cleanup and leave
|
||||
*/
|
||||
free(node_name);
|
||||
}
|
||||
|
||||
|
||||
static int do_update(struct bproc_node_set_t *ns)
|
||||
{
|
||||
int i;
|
||||
int changed = 0;
|
||||
bit_set changes;
|
||||
struct bproc_node_info_t *ni;
|
||||
|
||||
/* we assume the number of nodes does not change */
|
||||
for (i = 0; i < ns->size; i++) {
|
||||
ni = &ns->node[i];
|
||||
|
||||
if (mca_smr_bproc_component.node_set.size > 0
|
||||
&& mca_smr_bproc_component.node_set.size == ns->size)
|
||||
changes = find_changes(&mca_smr_bproc_component.node_set.node[i], ni);
|
||||
else
|
||||
changes = BIT_SET_ALL;
|
||||
|
||||
if (!empty_set(changes)) {
|
||||
update_registry(changes, ni);
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
if (mca_smr_bproc_component.node_set.size != 0)
|
||||
bproc_nodeset_free(&mca_smr_bproc_component.node_set);
|
||||
mca_smr_bproc_component.node_set = *ns;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static void orte_smr_bproc_notify_handler(int fd, short flags, void *user)
|
||||
{
|
||||
struct bproc_node_set_t ns = BPROC_EMPTY_NODESET;
|
||||
|
||||
if (bproc_nodelist_(&ns, fd) < 0) {
|
||||
/* bproc_nodelist_ error */
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!do_update(&ns))
|
||||
bproc_nodeset_free(&ns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to receive BProc update notifications
|
||||
*/
|
||||
static int orte_smr_bproc_module_init(void)
|
||||
{
|
||||
if (mca_smr_bproc_component.debug)
|
||||
opal_output(0, "init smr_bproc_module\n");
|
||||
|
||||
mca_smr_bproc_component.node_set.size = 0;
|
||||
|
||||
/* construct the monitored node list so we can track who is being monitored */
|
||||
OBJ_CONSTRUCT(&active_node_list, opal_list_t);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup to begin monitoring a job
|
||||
*/
|
||||
int orte_smr_bproc_begin_monitoring(orte_job_map_t *map, orte_gpr_trigger_cb_fn_t cbfunc, void *user_tag)
|
||||
{
|
||||
struct bproc_node_set_t ns = BPROC_EMPTY_NODESET;
|
||||
opal_list_item_t *item;
|
||||
orte_mapped_node_t *node;
|
||||
orte_smr_node_state_tracker_t *newnode;
|
||||
|
||||
/* if our internal structures haven't been initialized, then
|
||||
* set them up
|
||||
*/
|
||||
if (!initialized) {
|
||||
orte_smr_bproc_module_init();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/* setup the local monitoring list */
|
||||
for (item = opal_list_get_first(&map->nodes);
|
||||
item != opal_list_get_end(&map->nodes);
|
||||
item = opal_list_get_next(item)) {
|
||||
node = (orte_mapped_node_t*)item;
|
||||
|
||||
newnode = OBJ_NEW(orte_smr_node_state_tracker_t);
|
||||
newnode->cell = node->cell;
|
||||
newnode->nodename = strdup(node->nodename);
|
||||
opal_list_append(&active_node_list, &newnode->super);
|
||||
}
|
||||
|
||||
/* define the alert monitor to call the cbfunc if we trigger the alert */
|
||||
orte_smr.define_alert_monitor(map->job, ORTE_BPROC_NODE_ALERT_TRIG,
|
||||
ORTE_BPROC_NODE_ALERT_CNTR,
|
||||
0, 1, true, cbfunc, user_tag);
|
||||
|
||||
/*
|
||||
* Set initial node status for all nodes in the local cell. We will
|
||||
* receive reports from them all, but we will only provide alerts
|
||||
* on those we are actively monitoring
|
||||
*/
|
||||
|
||||
if (bproc_nodelist(&ns) < 0)
|
||||
return ORTE_ERROR;
|
||||
|
||||
if (!do_update(&ns))
|
||||
bproc_nodeset_free(&ns);
|
||||
|
||||
/*
|
||||
* Now register notify event
|
||||
*/
|
||||
|
||||
mca_smr_bproc_component.notify_fd = bproc_notifier();
|
||||
if (mca_smr_bproc_component.notify_fd < 0)
|
||||
return ORTE_ERROR;
|
||||
|
||||
memset(&mca_smr_bproc_component.notify_event, 0, sizeof(opal_event_t));
|
||||
|
||||
opal_event.set(
|
||||
&mca_smr_bproc_component.notify_event,
|
||||
mca_smr_bproc_component.notify_fd,
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
orte_smr_bproc_notify_handler,
|
||||
0);
|
||||
|
||||
opal_event.add(&mca_smr_bproc_component.notify_event, 0);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* Cleanup
|
||||
*/
|
||||
|
||||
int orte_smr_bproc_finalize(void)
|
||||
{
|
||||
opal_event.del(&mca_smr_bproc_component.notify_event);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/orte_constants.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
|
||||
#include "orte/mca/smr/base/smr_private.h"
|
||||
#include "orte/mca/smr/bproc/smr_bproc.h"
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
|
||||
static int orte_smr_bproc_open(void);
|
||||
static int orte_smr_bproc_close(void);
|
||||
static orte_smr_base_module_t* orte_smr_bproc_init(int *priority);
|
||||
|
||||
orte_smr_bproc_component_t mca_smr_bproc_component = {
|
||||
{
|
||||
/* First, the mca_base_module_t struct containing meta
|
||||
information about the module itself */
|
||||
{
|
||||
ORTE_SMR_BASE_VERSION_2_0_0,
|
||||
|
||||
"bproc", /* MCA module name */
|
||||
ORTE_MAJOR_VERSION, /* MCA module major version */
|
||||
ORTE_MINOR_VERSION, /* MCA module minor version */
|
||||
ORTE_RELEASE_VERSION, /* MCA module release version */
|
||||
orte_smr_bproc_open, /* component open */
|
||||
orte_smr_bproc_close /* component close */
|
||||
},
|
||||
{
|
||||
/* Component is not known to be checkpointable */
|
||||
MCA_BASE_METADATA_PARAM_NONE
|
||||
},
|
||||
|
||||
orte_smr_bproc_init
|
||||
}
|
||||
};
|
||||
|
||||
orte_smr_base_module_t orte_smr_bproc_module = {
|
||||
orte_smr_base_get_proc_state,
|
||||
orte_smr_base_set_proc_state,
|
||||
orte_smr_base_get_node_state,
|
||||
orte_smr_base_set_node_state,
|
||||
orte_smr_base_get_job_state,
|
||||
orte_smr_base_set_job_state,
|
||||
orte_smr_bproc_begin_monitoring,
|
||||
orte_smr_base_init_job_stage_gates,
|
||||
orte_smr_base_init_orted_stage_gates,
|
||||
orte_smr_base_define_alert_monitor,
|
||||
orte_smr_base_job_stage_gate_subscribe,
|
||||
orte_smr_bproc_finalize
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility function to register parameters
|
||||
*/
|
||||
static int orte_smr_bproc_param_register_int(
|
||||
const char* param_name,
|
||||
int default_value)
|
||||
{
|
||||
int id = mca_base_param_register_int("smr","bproc",param_name,NULL,default_value);
|
||||
int param_value = default_value;
|
||||
mca_base_param_lookup_int(id,¶m_value);
|
||||
return param_value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
static int orte_smr_bproc_open(void)
|
||||
{
|
||||
mca_smr_bproc_component.debug =
|
||||
orte_smr_bproc_param_register_int("debug", 0);
|
||||
mca_smr_bproc_component.priority =
|
||||
orte_smr_bproc_param_register_int("priority", 1);
|
||||
mca_smr_bproc_component.monitoring = false;
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
static orte_smr_base_module_t* orte_smr_bproc_init(int *priority)
|
||||
{
|
||||
if (!orte_process_info.seed) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*priority = mca_smr_bproc_component.priority;
|
||||
return &orte_smr_bproc_module;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
static int orte_smr_bproc_close(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
rhc
|
@ -1,48 +0,0 @@
|
||||
#
|
||||
# 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) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_orte_ras_bjs_DSO
|
||||
component_noinst =
|
||||
component_install = mca_ras_bjs.la
|
||||
else
|
||||
component_noinst = libmca_ras_bjs.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS= $(ras_bjs_CPPFLAGS)
|
||||
|
||||
proxy_SOURCES = \
|
||||
ras_bjs.h \
|
||||
ras_bjs_component.c \
|
||||
ras_bjs.c
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_ras_bjs_la_SOURCES = $(proxy_SOURCES)
|
||||
mca_ras_bjs_la_LIBADD = $(ras_bjs_LIBS)
|
||||
mca_ras_bjs_la_LDFLAGS = -module -avoid-version $(ras_bjs_LDFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_ras_bjs_la_SOURCES = $(proxy_SOURCES)
|
||||
libmca_ras_bjs_la_LIBADD = $(ras_bjs_LIBS)
|
||||
libmca_ras_bjs_la_LDFLAGS = -module -avoid-version $(ras_bjs_LDFLAGS)
|
@ -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-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# MCA_ras_bjs_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_orte_ras_bjs_CONFIG],[
|
||||
AC_CONFIG_FILES([orte/mca/ras/bjs/Makefile])
|
||||
|
||||
ORTE_CHECK_BPROC([ras_bjs], [ras_bjs_good=1], [ras_bjs_good=1],
|
||||
[ras_bjs_good=0])
|
||||
|
||||
# if check worked, set wrapper flags if so.
|
||||
# Evaluate succeed / fail
|
||||
AS_IF([test "$ras_bjs_good" = "1"],
|
||||
[ras_bjs_WRAPPER_EXTRA_LDFLAGS="$ras_bjs_LDFLAGS"
|
||||
ras_bjs_WRAPPER_EXTRA_LIBS="$ras_bjs_LIBS"
|
||||
$1],
|
||||
[$2])
|
||||
|
||||
# set build flags to use in makefile
|
||||
AC_SUBST([ras_bjs_CPPFLAGS])
|
||||
AC_SUBST([ras_bjs_LDFLAGS])
|
||||
AC_SUBST([ras_bjs_LIBS])
|
||||
])dnl
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/bproc.h>
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/mca/ras/base/ras_private.h"
|
||||
#include "ras_bjs.h"
|
||||
|
||||
/* API functions */
|
||||
static int allocate(opal_list_t *nodes);
|
||||
static int finalize(void);
|
||||
|
||||
orte_ras_base_module_t orte_ras_bjs_module = {
|
||||
allocate,
|
||||
finalize
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Query the bproc node status
|
||||
*/
|
||||
|
||||
static int bjs_node_state(int node)
|
||||
{
|
||||
#if defined BPROC_API_VERSION && BPROC_API_VERSION >= 4
|
||||
char nodestatus[BPROC_STATE_LEN + 1];
|
||||
|
||||
bproc_nodestatus(node, nodestatus, sizeof(nodestatus));
|
||||
if (strcmp(nodestatus, "up") == 0)
|
||||
return ORTE_NODE_STATE_UP;
|
||||
if (strcmp(nodestatus, "down") == 0)
|
||||
return ORTE_NODE_STATE_DOWN;
|
||||
if (strcmp(nodestatus, "boot") == 0)
|
||||
return ORTE_NODE_STATE_REBOOT;
|
||||
return ORTE_NODE_STATE_UNKNOWN;
|
||||
#else
|
||||
switch(bproc_nodestatus(node)) {
|
||||
case bproc_node_up:
|
||||
return ORTE_NODE_STATE_UP;
|
||||
case bproc_node_down:
|
||||
return ORTE_NODE_STATE_DOWN;
|
||||
case bproc_node_boot:
|
||||
return ORTE_NODE_STATE_REBOOT;
|
||||
default:
|
||||
return ORTE_NODE_STATE_UNKNOWN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int allocate(opal_list_t *nodes)
|
||||
{
|
||||
char* nodelist;
|
||||
char* ptr;
|
||||
opal_list_item_t* item;
|
||||
orte_node_t *node;
|
||||
int rc;
|
||||
|
||||
/* parse the node list and check node status/access */
|
||||
nodelist = getenv("NODES");
|
||||
if (NULL == nodelist) {
|
||||
return ORTE_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
while(NULL != (ptr = strsep(&nodelist,","))) {
|
||||
orte_node_state_t node_state;
|
||||
int node_num;
|
||||
|
||||
/* is this node already in the list */
|
||||
for(item = opal_list_get_first(nodes);
|
||||
item != opal_list_get_end(nodes);
|
||||
item = opal_list_get_next(item)) {
|
||||
node = (orte_node_t*)item;
|
||||
if(strcmp(node->name, ptr) == 0)
|
||||
break;
|
||||
}
|
||||
/* it if is in the list, then just increment the slot count */
|
||||
if(item != opal_list_get_end(nodes)) {
|
||||
node->slots++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* convert to an int node number */
|
||||
if(sscanf(ptr, "%d", &node_num) != 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ORTE_NODE_STATE_UP != (node_state = bjs_node_state(node_num))) {
|
||||
opal_output(0, "error: a specified node (%d) is not up.\n", node_num);
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
if(bproc_access(node_num, BPROC_X_OK) != 0) {
|
||||
opal_output(0, "error: a specified node (%d) is not accessible.\n", node_num);
|
||||
rc = ORTE_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* create a new node entry */
|
||||
node = OBJ_NEW(orte_node_t);
|
||||
node->name = strdup(ptr);
|
||||
node->state = node_state;
|
||||
node->slots = 1;
|
||||
opal_list_append(nodes, &node->super);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int finalize(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Resource Allocation (LSF over BPROC)
|
||||
*/
|
||||
#ifndef ORTE_RAS_BJS_H
|
||||
#define ORTE_RAS_BJS_H
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/mca/ras/ras.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
ORTE_DECLSPEC extern orte_ras_base_component_t mca_ras_bjs_component;
|
||||
ORTE_DECLSPEC extern orte_ras_base_module_t orte_ras_bjs_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
|
||||
#include "opal/mca/base/base.h"
|
||||
|
||||
#include "ras_bjs.h"
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
|
||||
static int ras_bjs_open(void);
|
||||
static int ras_bjs_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
|
||||
orte_ras_base_component_t mca_ras_bjs_component = {
|
||||
{
|
||||
ORTE_RAS_BASE_VERSION_2_0_0,
|
||||
|
||||
"bjs", /* MCA component name */
|
||||
ORTE_MAJOR_VERSION, /* MCA component major version */
|
||||
ORTE_MINOR_VERSION, /* MCA component minor version */
|
||||
ORTE_RELEASE_VERSION, /* MCA component release version */
|
||||
|
||||
/* Component open and close functions */
|
||||
ras_bjs_open, /* component open */
|
||||
NULL, /* component close */
|
||||
ras_bjs_component_query
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* component open/close/init function
|
||||
*/
|
||||
static int ras_bjs_open(void)
|
||||
{
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int ras_bjs_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
if(getenv("NODES") == NULL) {
|
||||
*module = NULL;
|
||||
return ORTE_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*priority = 10;
|
||||
*module = (mca_base_module_t *) &orte_ras_bjs_module;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user