1
1

Move set_my_name (NDS) functionality from ns_base and universe contact

test from orte_init_stage1 into a new framework, Startup Discovery Service
(sds).  This allows us to have more flexibility with platforms like
Red Storm, which do not have a universe in the usual meaning and don't have
a seed daemon they can contact

This commit was SVN r6630.
Этот коммит содержится в:
Brian Barrett 2005-07-27 23:18:16 +00:00
родитель 6aa464b67e
Коммит 1ce2e26272
59 изменённых файлов: 2467 добавлений и 522 удалений

Просмотреть файл

@ -46,6 +46,7 @@ liborte_la_LIBADD = \
mca/rmgr/base/libmca_orte_rmgr_base.la $(MCA_rmgr_STATIC_LTLIBS) \
mca/rml/base/libmca_rml_base.la $(MCA_rml_STATIC_LTLIBS) \
mca/schema/base/libmca_schema_base.la $(MCA_schema_STATIC_LTLIBS) \
mca/sds/base/libmca_sds_base.la $(MCA_sds_STATIC_LTLIBS) \
mca/soh/base/libmca_soh_base.la $(MCA_soh_STATIC_LTLIBS) \
runtime/libruntime.la \
util/liborteutil.la

Просмотреть файл

@ -29,4 +29,5 @@ SUBDIRS = \
rmgr \
rml \
schema \
sds \
soh

26
orte/dynamic-mca/sds/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = $(MCA_sds_DSO_SUBDIRS)
DISTCLEANFILES = $(SUBDIRS)
# Every directory under here is a sym link to something in the main
# src/mca tree. Hence, we don't want to distribute anything under
# here.
DIST_SUBDIRS =

Просмотреть файл

@ -29,4 +29,5 @@ SUBDIRS = \
rmgr \
rml \
schema \
sds \
soh

Просмотреть файл

@ -25,7 +25,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src
# Source code files
headers = \
ns_base_nds.h \
base.h
# Library
@ -35,10 +34,7 @@ libmca_ns_base_la_SOURCES = \
ns_base_close.c \
ns_base_select.c \
ns_base_open.c \
ns_base_nds.c \
ns_base_nds_bproc.c \
ns_base_nds_env.c \
ns_base_nds_pipe.c \
ns_base_nds.c \
ns_base_local_fns.c \
data_type_support/ns_data_type_packing_fns.c \
data_type_support/ns_data_type_unpacking_fns.c

Просмотреть файл

@ -147,8 +147,6 @@ OMPI_DECLSPEC int orte_ns_base_define_data_type_not_available(
OMPI_DECLSPEC int orte_ns_base_create_my_name_not_available(void);
/* Base functions used everywhere */
OMPI_DECLSPEC int orte_ns_base_set_my_name(void);
OMPI_DECLSPEC int orte_ns_base_get_peers(orte_process_name_t **procs,
size_t *num_procs, size_t *self);

Просмотреть файл

@ -19,91 +19,13 @@
#include "orte_config.h"
#include "include/orte_constants.h"
#include "mca/ns/base/ns_base_nds.h"
#include "util/proc_info.h"
#include "mca/base/mca_base_param.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
#include "opal/util/output.h"
static orte_ns_nds_t orte_ns_nds[] = {
{ "env", orte_ns_nds_env_get },
{ "pipe", orte_ns_nds_pipe_get },
{ "bproc", orte_ns_nds_bproc_get },
{ NULL, NULL }
};
int orte_ns_base_set_my_name(void)
{
int rc, id, flag;
char *mode;
orte_vpid_t vpid;
/* check to see if name has already been set - if so, THIS IS AN ERROR */
if (NULL != orte_process_info.my_name) {
opal_output(0, "my name was set to [%d,%d,%d]", ORTE_NAME_ARGS(orte_process_info.my_name));
ORTE_ERROR_LOG(ORTE_ERR_FATAL);
return ORTE_ERR_FATAL;
}
/* first check if we are seed or singleton that couldn't
* join an existing universe - if so, name is mandated, and we need
* to set the singleton flag so that our job infrastructure gets built
*/
if (orte_process_info.seed || NULL == orte_process_info.ns_replica) {
id = mca_base_param_register_int("orte", "base", "infrastructure", NULL, (int)false);
mca_base_param_lookup_int(id, &flag);
if (!flag) {
orte_process_info.singleton = true;
}
return orte_ns_base_create_process_name(
&(orte_process_info.my_name), 0, 0, 0);
}
/* okay, not seed/singleton attempt another approach */
id = mca_base_param_register_string("ns", "nds", NULL, NULL, NULL);
mca_base_param_lookup_string(id, &mode);
if (NULL != mode) { /* mode identified */
orte_ns_nds_t* nds = orte_ns_nds;
while(NULL != nds->mode) {
if (0 == strcmp(mode, nds->mode)) {
return nds->discover();
}
nds++;
}
}
/* if the name wasn't passed to us, and we are not the seed, then
* we must be a singleton. We need to get a name assigned by the seed
* daemon, so we call the name service to do that, and then set the
* singleton flag.
*/
if (ORTE_SUCCESS != (rc = orte_ns.create_my_name())) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid(&vpid, orte_process_info.my_name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_process_info.num_procs = 1;
orte_process_info.vpid_start = vpid;
/* only set the singleton flag is we are NOT infrastructure */
id = mca_base_param_register_int("orte", "base", "infrastructure", NULL, (int)false);
mca_base_param_lookup_int(id, &flag);
if (!flag) {
orte_process_info.singleton = true;
}
return ORTE_SUCCESS;
}
int orte_ns_base_get_peers(orte_process_name_t **procs,
size_t *num_procs, size_t *self)
{

Просмотреть файл

@ -1,87 +0,0 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Name Discovery
*
* Since each launcher/environment can be different, the NDS provides a mechanism
* by which writers of PLS launchers can provide the necessary corresponding logic
* for process name discovery. Accordingly, each PLS MUST:
*
* - set the environmental parameter OMPI_MCA_ns_nds to indicate the
* name discovery facility used by the launcher.
*
* - have a corresponding entry in the orte_ns_base_nds table (defined in
* src/ns/base/ns_base_nds.c) that identifies the mode and its associated
* function for obtaining the process name. This information is stored in an array
* of orte_ns_base_nds_t structures - each of which contains the string name of the
* mode (that must correspond exactly with the value of the environmental
* parameter OMPI_MCA_ns_nds as set by the launcher) and a function pointer
* to the necessary name discovery function.
*
* WARNING: Be sure to increment the orte_plsnds_max value so that the name discovery
* subsystem will correctly search the entire array.
*
*/
#ifndef ORTE_NS_BASE_NDS_H_
#define ORTE_NS_BASE_NDS_H_
#include "orte_config.h"
#include "include/orte_types.h"
#include "include/orte_constants.h"
#include "mca/ns/ns_types.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Define the nds function pointer
*/
typedef int (*orte_ns_nds_fn_t)(void);
/*
* Define the nds structure
*/
typedef struct {
char *mode;
orte_ns_nds_fn_t discover;
} orte_ns_nds_t;
/*
* Name discovery mechanisms
*/
int orte_ns_nds_env_get(void);
int orte_ns_nds_env_put(const orte_process_name_t* proc,
orte_vpid_t vpid_start, size_t num_procs,
char ***environ);
int orte_ns_nds_pipe_get(void);
int orte_ns_nds_pipe_put(const orte_process_name_t* proc, orte_vpid_t vpid_start, size_t num_procs, int fd);
int orte_ns_nds_bproc_get(void);
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);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_PLSNDS_H */

Просмотреть файл

@ -76,7 +76,6 @@ OMPI_DECLSPEC mca_ns_base_module_t orte_ns = {
orte_ns_base_derive_vpid,
orte_ns_base_assign_rml_tag_not_available,
orte_ns_base_define_data_type_not_available,
orte_ns_base_set_my_name,
orte_ns_base_get_peers
};
bool mca_ns_base_selected = false;

Просмотреть файл

@ -573,19 +573,6 @@ typedef int (*orte_ns_base_module_define_data_type_fn_t)(
const char *name,
orte_data_type_t *type);
/*
* Discover my name
* Upon startup, each process must discover its official ORTE process name. There are
* several ways this name could be passed to the process. This typicall involves an
* environmental parameter of some appropriate name, possibly followed by some
* computation of the vpid based on process rank. This function checks the different
* environmental parameters to find the one that has been set with the appropriate
* value, determines (based on that) the name of this process, and then sets that
* value in the orte_system_info global structure.
*/
typedef int (*orte_ns_base_module_set_my_name_fn_t)(void);
/*
* Get my peers
*
@ -628,7 +615,6 @@ struct mca_ns_base_module_1_0_0_t {
orte_ns_base_module_derive_vpid_fn_t derive_vpid;
orte_ns_base_module_assign_rml_tag_fn_t assign_rml_tag;
orte_ns_base_module_define_data_type_fn_t define_data_type;
orte_ns_base_module_set_my_name_fn_t set_my_name;
orte_ns_base_module_get_peers_fn_t get_peers;
};

Просмотреть файл

@ -93,7 +93,6 @@ static mca_ns_base_module_t orte_ns_proxy = {
orte_ns_base_derive_vpid,
orte_ns_proxy_assign_rml_tag,
orte_ns_proxy_define_data_type,
orte_ns_base_set_my_name,
orte_ns_base_get_peers
};

Просмотреть файл

@ -96,7 +96,6 @@ static mca_ns_base_module_t orte_ns_replica = {
orte_ns_base_derive_vpid,
orte_ns_replica_assign_rml_tag,
orte_ns_replica_define_data_type,
orte_ns_base_set_my_name,
orte_ns_base_get_peers
};

Просмотреть файл

@ -35,7 +35,7 @@
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/iof/iof.h"
#include "orte/mca/ns/base/base.h"
#include "orte/mca/ns/base/ns_base_nds.h"
#include "orte/mca/sds/base/base.h"
#include "orte/mca/oob/base/base.h"
#include "orte/mca/ras/base/base.h"
#include "orte/mca/rmgr/base/base.h"

Просмотреть файл

@ -32,7 +32,7 @@
#include "runtime/orte_wait.h"
#include "runtime/runtime.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
#include "mca/sds/base/base.h"
#include "mca/pls/base/base.h"
#include "mca/base/mca_base_param.h"
#include "mca/iof/iof.h"

Просмотреть файл

@ -47,7 +47,7 @@
#include "mca/iof/base/iof_base_setup.h"
#include "mca/base/mca_base_param.h"
#include "mca/ns/ns.h"
#include "mca/ns/base/ns_base_nds.h"
#include "orte/mca/sds/base/base.h"
#include "mca/pls/pls.h"
#include "mca/pls/base/base.h"
#include "mca/rml/rml.h"

33
orte/mca/sds/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = base $(MCA_sds_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_sds_ALL_SUBDIRS)
# Source code files
headers = sds.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ortedir = $(includedir)/openmpi/orte/mca/sds
orte_HEADERS = $(headers)
else
ortedir = $(includedir)
endif

44
orte/mca/sds/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_sds_base.la
# Source code files
headers = \
base.h
libmca_sds_base_la_SOURCES = \
$(headers) \
sds_base_close.c \
sds_base_open.c \
sds_base_select.c \
sds_base_interface.c \
sds_base_universe.c \
sds_base_put.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ortedir = $(includedir)/openmpi/orte/mca/sds/base
orte_HEADERS = $(headers)
else
ortedir = $(includedir)
endif
distclean-local:
rm -f static-components.h

87
orte/mca/sds/base/base.h Обычный файл
Просмотреть файл

@ -0,0 +1,87 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_SDS_BASE_H
#define MCA_SDS_BASE_H
#include "orte_config.h"
#include "opal/mca/mca.h"
#include "orte/mca/sds/sds.h"
#include "orte/mca/ns/ns_types.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Global functions for MCA overall collective open and close
*/
/**
* Open the sds framework
*/
OMPI_DECLSPEC int orte_sds_base_open(void);
/**
* Select a sds module
*/
OMPI_DECLSPEC int orte_sds_base_select(void);
/**
* Setup universe contact information
*/
OMPI_DECLSPEC int orte_sds_base_contact_universe(void);
/**
* Setup self and peer naming
*/
OMPI_DECLSPEC int orte_sds_base_set_name(void);
/**
* Close the sds framework
*/
OMPI_DECLSPEC int orte_sds_base_close(void);
/*
* Internal helper functions used by components
*/
OMPI_DECLSPEC int orte_sds_base_basic_contact_universe(void);
OMPI_DECLSPEC int orte_sds_base_seed_set_name(void);
/*
* Put functions
*/
OMPI_DECLSPEC int orte_ns_nds_env_put(const orte_process_name_t* proc,
orte_vpid_t vpid_start,
size_t num_procs,
char ***environ);
OMPI_DECLSPEC int orte_ns_nds_pipe_put(const orte_process_name_t* proc,
orte_vpid_t vpid_start,
size_t num_procs,
int fd);
OMPI_DECLSPEC 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);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

44
orte/mca/sds/base/sds_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "include/orte_constants.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/sds/base/base.h"
#include "opal/util/output.h"
extern opal_list_t orte_sds_base_components_available;
extern orte_sds_base_module_t *orte_sds_base_module;
int
orte_sds_base_close(void)
{
/* finalize running component */
orte_sds_base_module->finalize();
/* shutdown any remaining opened components */
if (! opal_list_is_empty(&orte_sds_base_components_available)) {
mca_base_components_close(0,
&orte_sds_base_components_available, NULL);
}
OBJ_DESTRUCT(&orte_sds_base_components_available);
return OMPI_SUCCESS;
}

46
orte/mca/sds/base/sds_base_interface.c Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "opal/util/output.h"
#include "mca/sds/base/base.h"
#include "util/proc_info.h"
extern orte_sds_base_module_t *orte_sds_base_module;
int
orte_sds_base_contact_universe(void)
{
return orte_sds_base_module->contact_universe();
}
int
orte_sds_base_set_name(void)
{
/* if we got "promoted" to the seed between selection and
set_name, it's probably the seed component isn't the one
running. Go behind the selected component's back and do the
seed set name, since that's what we really want to have
happen */
if (orte_process_info.seed) {
return orte_sds_base_seed_set_name();
} else {
return orte_sds_base_module->set_name();
}
}

51
orte/mca/sds/base/sds_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "opal/util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/sds/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
*/
#include "orte/mca/sds/base/static-components.h"
opal_list_t orte_sds_base_components_available;
orte_sds_base_module_t *orte_sds_base_module = NULL;
int
orte_sds_base_open(void)
{
OBJ_CONSTRUCT(&orte_sds_base_components_available, opal_list_t);
/* Open up all available components */
if (ORTE_SUCCESS !=
mca_base_components_open("sds", 0, mca_sds_base_static_components,
&orte_sds_base_components_available,
true)) {
return ORTE_ERROR;
}
return ORTE_SUCCESS;
}

229
orte/mca/sds/base/sds_base_put.c Обычный файл
Просмотреть файл

@ -0,0 +1,229 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/include/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"
int orte_ns_nds_env_put(const orte_process_name_t* name,
orte_vpid_t vpid_start, size_t num_procs,
char ***env)
{
char* param;
char* cellid;
char* jobid;
char* vpid;
char* value;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.get_cellid_string(&cellid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_jobid_string(&jobid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_vpid_string(&vpid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* set the mode to env */
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, "env", 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(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, cellid, true, env);
free(param);
free(cellid);
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, jobid, true, env);
free(param);
free(jobid);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","vpid"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
opal_setenv(param, vpid, true, env);
free(param);
free(vpid);
asprintf(&value, "%lu", (unsigned long) vpid_start);
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);
asprintf(&value, "%lu", (unsigned long) 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);
return ORTE_SUCCESS;
}
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* cellid;
char* jobid;
char* value;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.convert_cellid_to_string(&cellid, cell))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid, job))) {
ORTE_ERROR_LOG(rc);
return 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(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, cellid, true, env);
free(param);
free(cellid);
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, jobid, true, env);
free(param);
free(jobid);
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;
}

98
orte/mca/sds/base/sds_base_select.c Обычный файл
Просмотреть файл

@ -0,0 +1,98 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "opal/class/opal_list.h"
#include "opal/util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/sds/base/base.h"
extern opal_list_t orte_sds_base_components_available;
extern orte_sds_base_module_t *orte_sds_base_module;
int
orte_sds_base_select(void)
{
opal_list_item_t *item;
mca_base_component_list_item_t *cli;
int selected_priority = -1;
orte_sds_base_component_t *selected_component = NULL;
orte_sds_base_module_t *selected_module = NULL;
/* Traverse the list of opened modules; call their init functions. */
for(item = opal_list_get_first(&orte_sds_base_components_available);
item != opal_list_get_end(&orte_sds_base_components_available);
item = opal_list_get_next(item)) {
orte_sds_base_component_t* component;
cli = (mca_base_component_list_item_t *) item;
component = (orte_sds_base_component_t *) cli->cli_component;
opal_output_verbose(10, 0,
"orte_sds_base_select: initializing %s component %s",
component->sds_version.mca_type_name,
component->sds_version.mca_component_name);
if (NULL == component->sds_init) {
opal_output_verbose(10, 0,
"orte_sds_base_select: no init function; ignoring component");
} else {
int priority;
orte_sds_base_module_t* module = component->sds_init(&priority);
/* If the component didn't initialize, remove it from the opened
list and remove it from the component repository */
if (NULL == module) {
opal_output_verbose(10, 0,
"orte_sds_base_select: init returned failure");
continue;
}
if(priority > selected_priority) {
selected_priority = priority;
selected_component = component;
selected_module = module;
}
}
}
/* unload all components that were not selected */
item = opal_list_get_first(&orte_sds_base_components_available);
while(item != opal_list_get_end(&orte_sds_base_components_available)) {
opal_list_item_t* next = opal_list_get_next(item);
orte_sds_base_component_t* component;
cli = (mca_base_component_list_item_t *) item;
component = (orte_sds_base_component_t *) cli->cli_component;
if(component != selected_component) {
opal_output_verbose(10, 0,
"orte_sds_base_select: module %s unloaded",
component->sds_version.mca_component_name);
mca_base_component_repository_release((mca_base_component_t *) component);
opal_list_remove_item(&orte_sds_base_components_available, item);
OBJ_RELEASE(item);
}
item = next;
}
/* setup reference to selected module */
if(NULL != selected_module) {
orte_sds_base_module = selected_module;
}
return OMPI_SUCCESS;
}

139
orte/mca/sds/base/sds_base_universe.c Обычный файл
Просмотреть файл

@ -0,0 +1,139 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "opal/mca/base/mca_base_param.h"
#include "opal/util/output.h"
#include "orte/include/orte_constants.h"
#include "orte/mca/sds/base/base.h"
#include "orte/util/proc_info.h"
#include "orte/runtime/runtime.h"
#include "orte/mca/errmgr/base/base.h"
#include "orte/mca/ns/ns.h"
#include "orte/mca/ns/base/base.h"
int
orte_sds_base_basic_contact_universe(void)
{
int ret, rc, exit_if_not_exist;
orte_universe_t univ;
char *universe;
pid_t pid;
/* if we were NOT given registry and name service replicas (i.e., we
* weren't told a universe contact point), check for some
* existing universe to join */
if (NULL == orte_process_info.ns_replica_uri || NULL == orte_process_info.gpr_replica_uri) {
if (ORTE_SUCCESS == (ret = orte_universe_exists(&univ))) {
/* copy universe info into our universe structure */
orte_universe_info.name = univ.name;
orte_universe_info.host = univ.host;
orte_universe_info.uid = univ.uid;
orte_universe_info.persistence = univ.persistence;
orte_universe_info.scope = univ.scope;
orte_universe_info.console = univ.console;
orte_universe_info.seed_uri = univ.seed_uri;
orte_universe_info.console_connected = univ.console_connected;
orte_universe_info.scriptfile = univ.scriptfile;
/* define the replica contact points */
orte_process_info.ns_replica_uri = strdup(univ.seed_uri);
orte_process_info.gpr_replica_uri = strdup(univ.seed_uri);
} else {
/* if an existing universe is not detected, check the
* relevant MCA parameter to see if the caller wants
* us to abort in this situation
*/
if (0 > (rc = mca_base_param_register_int("orte", "univ", "exist", NULL, 0))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = mca_base_param_lookup_int(rc, &exit_if_not_exist))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (exit_if_not_exist) {
/* cleanup the subsystems that were already opened */
orte_system_finalize();
return ORTE_ERR_UNREACH;
}
if (ORTE_ERR_NOT_FOUND != ret) {
/* if it exists but no contact could be established,
* define unique name based on current one.
* and start new universe with me as seed
*/
universe = strdup(orte_universe_info.name);
free(orte_universe_info.name);
orte_universe_info.name = NULL;
pid = getpid();
if (0 > asprintf(&orte_universe_info.name, "%s-%d", universe, (int)pid)) {
opal_output(0, "orte_init: failed to create unique universe name");
return ret;
}
opal_output(0, "Could not join a running, existing universe");
opal_output(0, "Establishing a new one named: %s",
orte_universe_info.name);
}
orte_process_info.seed = true;
/* since we are seed, ensure that all replica info is NULL'd */
if (NULL != orte_process_info.ns_replica_uri) {
free(orte_process_info.ns_replica_uri);
orte_process_info.ns_replica_uri = NULL;
}
if (NULL != orte_process_info.ns_replica) {
free(orte_process_info.ns_replica);
orte_process_info.ns_replica = NULL;
}
if (NULL != orte_process_info.gpr_replica_uri) {
free(orte_process_info.gpr_replica_uri);
orte_process_info.gpr_replica_uri = NULL;
}
if (NULL != orte_process_info.gpr_replica) {
free(orte_process_info.gpr_replica);
orte_process_info.gpr_replica = NULL;
}
}
}
return ORTE_SUCCESS;
}
int
orte_sds_base_seed_set_name(void)
{
int id, flag;
/* if we're a seed and we're not infrastructure, we're also a
singleton. So set the singleton flag in that case */
id = mca_base_param_register_int("orte", "base", "infrastructure",
NULL, (int)false);
mca_base_param_lookup_int(id, &flag);
if (!flag) {
orte_process_info.singleton = true;
}
return orte_ns_base_create_process_name(
&(orte_process_info.my_name), 0, 0, 0);
}

49
orte/mca/sds/bproc/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
AM_CPPFLAGS = $(sds_bproc_CPPFLAGS)
sources = \
sds_bproc.h \
sds_bproc_component.c \
sds_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 OMPI_BUILD_sds_bproc_DSO
component_noinst =
component_install = mca_sds_bproc.la
else
component_noinst = libmca_sds_bproc.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_bproc_la_SOURCES = $(sources)
mca_sds_bproc_la_LDFLAGS = -module -avoid-version $(sds_bproc_LDFLAGS)
mca_sds_bproc_la_LIBADD = $(sds_bproc_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_bproc_la_SOURCES =$(sources)
libmca_sds_bproc_la_LDFLAGS = -module -avoid-version $(sds_bproc_LDFLAGS)
libmca_sds_bproc_la_LIBADD = $(sds_bproc_LIBS)

38
orte/mca/sds/bproc/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,38 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_sds_bproc_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_sds_bproc_CONFIG],[
# only accept newer non-Scyld bproc
OMPI_CHECK_BPROC([sds_bproc], [sds_bproc_good=1],
[sds_bproc_good=0], [sds_bproc_good=0])
# if check worked, set wrapper flags if so.
# Evaluate succeed / fail
AS_IF([test "$sds_bproc_good" = "1"],
[sds_bproc_WRAPPER_EXTRA_LDFLAGS="$sds_bproc_LDFLAGS"
sds_bproc_WRAPPER_EXTRA_LIBS="$sds_bproc_LIBS"
$1],
[$2])
AS_IF([test "$sds_bproc_good" = "0" && test ! -z "$with_bproc" -a "$with_bproc" != "no"],
[AC_MSG_ERROR([Scyld bproc is not supported by the launching system yet])])
# set build flags to use in makefile
AC_SUBST([sds_bproc_CPPFLAGS])
AC_SUBST([sds_bproc_LDFLAGS])
AC_SUBST([sds_bproc_LIBS])
])dnl

19
orte/mca/sds/bproc/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_bproc_component.c
PARAM_CONFIG_FILES="Makefile"

46
orte/mca/sds/bproc/sds_bproc.h Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_BPROC_H
#define ORTE_SDS_BPROC_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_bproc_component_open(void);
int orte_sds_bproc_component_close(void);
orte_sds_base_module_t* orte_sds_bproc_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_bproc_finalize(void);
/*
* Module functions
*/
int orte_sds_bproc_set_name(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_BPROC_H */

95
orte/mca/sds/bproc/sds_bproc_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,95 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/bproc/sds_bproc.h"
#include "mca/base/mca_base_param.h"
extern orte_sds_base_module_t sds_bproc_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_bproc_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"bproc",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_bproc_component_open,
orte_sds_bproc_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_bproc_component_init
};
int
orte_sds_bproc_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_bproc_component_init(int *priority)
{
int id;
char *mode;
/* okay, not seed/singleton attempt another approach */
id = mca_base_param_register_string("ns", "nds", NULL, NULL, NULL);
mca_base_param_lookup_string(id, &mode);
if (NULL == mode || 0 != strcmp("bproc", mode)) { return NULL; }
*priority = 20;
return &sds_bproc_module;
}
int
orte_sds_bproc_component_close(void)
{
return ORTE_SUCCESS;
}

Просмотреть файл

@ -12,23 +12,30 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "util/proc_info.h"
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"
#include "mca/base/mca_base_param.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/bproc/sds_bproc.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
#include "mca/errmgr/base/base.h"
orte_sds_base_module_t sds_bproc_module = {
orte_sds_base_basic_contact_universe,
orte_sds_bproc_set_name,
orte_sds_bproc_finalize,
};
int orte_ns_nds_bproc_get(void) {
int
orte_sds_bproc_set_name(void)
{
int rc;
int id;
int vpid_start;
@ -133,109 +140,8 @@ int orte_ns_nds_bproc_get(void) {
}
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* cellid;
char* jobid;
char* value;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.convert_cellid_to_string(&cellid, cell))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.convert_jobid_to_string(&jobid, job))) {
ORTE_ERROR_LOG(rc);
return 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(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, cellid, true, env);
free(param);
free(cellid);
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, jobid, true, env);
free(param);
free(jobid);
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);
int
orte_sds_bproc_finalize(void)
{
return ORTE_SUCCESS;
}

45
orte/mca/sds/cnos/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
sds_cnos.h \
sds_cnos_component.c \
sds_cnos_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 OMPI_BUILD_sds_cnos_DSO
component_noinst =
component_install = mca_sds_cnos.la
else
component_noinst = libmca_sds_cnos.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_cnos_la_SOURCES = $(sources)
mca_sds_cnos_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_cnos_la_SOURCES =$(sources)
libmca_sds_cnos_la_LDFLAGS = -module -avoid-version

23
orte/mca/sds/cnos/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_sds_cnos_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_sds_cnos_CONFIG],[
# check for cnos functions
AC_CHECK_FUNC([cnos_get_rank], [$1], [$2])
])dnl

19
orte/mca/sds/cnos/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_cnos_component.c
PARAM_CONFIG_FILES="Makefile"

47
orte/mca/sds/cnos/sds_cnos.h Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_CNOS_H
#define ORTE_SDS_CNOS_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_cnos_component_open(void);
int orte_sds_cnos_component_close(void);
orte_sds_base_module_t* orte_sds_cnos_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_cnos_finalize(void);
/*
* Module functions
*/
int orte_sds_cnos_set_name(void);
int orte_sds_cnos_contact_universe(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_CNOS_H */

97
orte/mca/sds/cnos/sds_cnos_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,97 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/cnos/sds_cnos.h"
#include "mca/base/mca_base_param.h"
extern orte_sds_base_module_t sds_cnos_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_cnos_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"cnos",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_cnos_component_open,
orte_sds_cnos_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_cnos_component_init
};
int
orte_sds_cnos_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_cnos_component_init(int *priority)
{
int id;
char *mode;
/* okay, not seed/singleton attempt another approach */
id = mca_base_param_register_string("ns", "nds", NULL, NULL, NULL);
mca_base_param_lookup_string(id, &mode);
/* if mode isn't NULL, then we have an ORTE starter. Don't use
this component */
if (NULL != mode) return NULL;
*priority = 60;
return sds_cnos_module;
}
int
orte_sds_cnos_component_close(void)
{
return ORTE_SUCCESS;
}

48
orte/mca/sds/cnos/sds_cnos_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/cnos/sds_cnos.h"
orte_sds_base_module_t sds_cnos_module = {
orte_sds_base_contact_universe,
orte_sds_cnos_set_name,
orte_sds_cnos_finalize,
};
int
orte_sds_cnos_contact_universe(void)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}
int
orte_sds_cnos_set_name(void)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}
int
orte_sds_cnos_finalize(void)
{
return ORTE_ERR_NOT_IMPLEMENTED;
}

45
orte/mca/sds/env/Makefile.am поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
sds_env.h \
sds_env_component.c \
sds_env_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 OMPI_BUILD_sds_env_DSO
component_noinst =
component_install = mca_sds_env.la
else
component_noinst = libmca_sds_env.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_env_la_SOURCES = $(sources)
mca_sds_env_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_env_la_SOURCES =$(sources)
libmca_sds_env_la_LDFLAGS = -module -avoid-version

19
orte/mca/sds/env/configure.params поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_env_component.c
PARAM_CONFIG_FILES="Makefile"

46
orte/mca/sds/env/sds_env.h поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_ENV_H
#define ORTE_SDS_ENV_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_env_component_open(void);
int orte_sds_env_component_close(void);
orte_sds_base_module_t* orte_sds_env_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_env_finalize(void);
/*
* Module functions
*/
int orte_sds_env_set_name(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_ENV_H */

93
orte/mca/sds/env/sds_env_component.c поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,93 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/env/sds_env.h"
#include "mca/base/mca_base_param.h"
extern orte_sds_base_module_t sds_env_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_env_component = {
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"env",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_env_component_open,
orte_sds_env_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_env_component_init
};
int
orte_sds_env_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_env_component_init(int *priority)
{
int id;
char *mode;
/* okay, not seed/singleton attempt another approach */
id = mca_base_param_register_string("ns", "nds", NULL, NULL, NULL);
mca_base_param_lookup_string(id, &mode);
if (NULL == mode || 0 != strcmp("env", mode)) { return NULL; }
*priority = 20;
return &sds_env_module;
}
int
orte_sds_env_component_close(void)
{
return ORTE_SUCCESS;
}

Просмотреть файл

@ -12,22 +12,32 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/env/sds_env.h"
#include "util/proc_info.h"
#include "opal/util/opal_environ.h"
#include "mca/base/mca_base_param.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
int orte_ns_nds_env_get(void)
orte_sds_base_module_t sds_env_module = {
orte_sds_base_basic_contact_universe,
orte_sds_env_set_name,
orte_sds_env_finalize,
};
int
orte_sds_env_set_name(void)
{
int rc;
int id;
@ -36,6 +46,7 @@ int orte_ns_nds_env_get(void)
char* name_string = NULL;
id = mca_base_param_register_string("ns", "nds", "name", NULL, NULL);
mca_base_param_lookup_string(id, &name_string);
if(name_string != NULL) {
if (ORTE_SUCCESS != (rc = orte_ns_base_convert_string_to_process_name(
&(orte_process_info.my_name),
@ -118,99 +129,8 @@ int orte_ns_nds_env_get(void)
}
int orte_ns_nds_env_put(const orte_process_name_t* name,
orte_vpid_t vpid_start, size_t num_procs,
char ***env)
int
orte_sds_env_finalize(void)
{
char* param;
char* cellid;
char* jobid;
char* vpid;
char* value;
int rc;
if(ORTE_SUCCESS != (rc = orte_ns.get_cellid_string(&cellid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_jobid_string(&jobid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_ns.get_vpid_string(&vpid, name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* set the mode to env */
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, "env", 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(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, cellid, true, env);
free(param);
free(cellid);
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, jobid, true, env);
free(param);
free(jobid);
if(NULL == (param = mca_base_param_environ_variable("ns","nds","vpid"))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
opal_setenv(param, vpid, true, env);
free(param);
free(vpid);
asprintf(&value, "%lu", (unsigned long) vpid_start);
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);
asprintf(&value, "%lu", (unsigned long) 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);
return ORTE_SUCCESS;
}

45
orte/mca/sds/pipe/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
sds_pipe.h \
sds_pipe_component.c \
sds_pipe_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 OMPI_BUILD_sds_pipe_DSO
component_noinst =
component_install = mca_sds_pipe.la
else
component_noinst = libmca_sds_pipe.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_pipe_la_SOURCES = $(sources)
mca_sds_pipe_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_pipe_la_SOURCES =$(sources)
libmca_sds_pipe_la_LDFLAGS = -module -avoid-version

23
orte/mca/sds/pipe/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_sds_pipe_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_sds_pipe_CONFIG],[
# check for pipe
AC_CHECK_FUNC([pipe], [$1], [$2])
])dnl

19
orte/mca/sds/pipe/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_pipe_component.c
PARAM_CONFIG_FILES="Makefile"

46
orte/mca/sds/pipe/sds_pipe.h Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_PIPE_H
#define ORTE_SDS_PIPE_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_pipe_component_open(void);
int orte_sds_pipe_component_close(void);
orte_sds_base_module_t* orte_sds_pipe_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_pipe_finalize(void);
/*
* Module functions
*/
int orte_sds_pipe_set_name(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_PIPE_H */

95
orte/mca/sds/pipe/sds_pipe_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,95 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/pipe/sds_pipe.h"
#include "mca/base/mca_base_param.h"
extern orte_sds_base_module_t sds_pipe_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_pipe_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"pipe",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_pipe_component_open,
orte_sds_pipe_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_pipe_component_init
};
int
orte_sds_pipe_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_pipe_component_init(int *priority)
{
int id;
char *mode;
/* okay, not seed/singleton attempt another approach */
id = mca_base_param_register_string("ns", "nds", NULL, NULL, NULL);
mca_base_param_lookup_string(id, &mode);
if (NULL == mode || 0 != strcmp("pipe", mode)) { return NULL; }
*priority = 20;
return &sds_pipe_module;
}
int
orte_sds_pipe_component_close(void)
{
return ORTE_SUCCESS;
}

Просмотреть файл

@ -12,11 +12,11 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include "orte_config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -27,15 +27,24 @@
#include "util/proc_info.h"
#include "opal/util/output.h"
#include "mca/base/mca_base_param.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/ns.h"
#include "mca/ns/base/base.h"
#include "mca/ns/base/ns_base_nds.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/pipe/sds_pipe.h"
orte_sds_base_module_t sds_pipe_module = {
orte_sds_base_basic_contact_universe,
orte_sds_pipe_set_name,
orte_sds_pipe_finalize,
};
int orte_ns_nds_pipe_get(void)
int
orte_sds_pipe_set_name(void)
{
int rc, fd, id;
int rc, fd, id;
orte_process_name_t name;
size_t num_procs;
@ -73,28 +82,8 @@ int orte_ns_nds_pipe_get(void)
}
int orte_ns_nds_pipe_put(const orte_process_name_t* name, orte_vpid_t vpid_start, size_t num_procs, int fd)
int
orte_sds_pipe_finalize(void)
{
int rc;
rc = write(fd,name,sizeof(orte_process_name_t));
if(rc != sizeof(orte_process_name_t)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_NOT_FOUND;
}
rc = write(fd,&vpid_start, sizeof(vpid_start));
if(rc != sizeof(vpid_start)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_NOT_FOUND;
}
rc = write(fd,&num_procs, sizeof(num_procs));
if(rc != sizeof(num_procs)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_NOT_FOUND;
}
return ORTE_SUCCESS;
}

121
orte/mca/sds/sds.h Обычный файл
Просмотреть файл

@ -0,0 +1,121 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The Open MPI Start-up Discovery Service
*
*/
#ifndef ORTE_SDS_H
#define ORTE_SDS_H
#include "opal/mca/mca.h"
/*
* Module and component structures
*/
struct orte_sds_base_module_1_0_0_t;
typedef struct orte_sds_base_module_1_0_0_t orte_sds_base_module_1_0_0_t;
typedef orte_sds_base_module_1_0_0_t orte_sds_base_module_t;
struct orte_sds_base_component_1_0_0_t;
typedef struct orte_sds_base_component_1_0_0_t orte_sds_base_component_1_0_0_t;
typedef orte_sds_base_component_1_0_0_t orte_sds_base_component_t;
/**
* Selection function
*
* Priority list:
*
* - 0 singleton process (not seed)
* - 20 process has name provided by starter
* - 40 seed process
* - 60 process has name provided by starter and needs to
* override seed. This should be used with care, and
* is mainly intended for environments where orte is
* not the starter (such as cnos)
*/
typedef orte_sds_base_module_t*
(*orte_sds_base_component_init_fn_t)(int *priority);
/*
* Module functions
*/
/**
* Contact universe and set contact information
*
* Attempt to contact the universe to get replica contact information.
*/
typedef int (*orte_sds_base_contact_universe_fn_t)(void);
/**
* Set Name and Job information for current process
*
* Set name and job information for current process. This information
* includes:
*
* - orte_process_info.my_name
* - orte_process_info.vpid_start
* - orte_process_info.num_procs
*
* From this, the ns is able to develop a map of all processes started
* in the curent job.
*
* Upon startup, each process must discover its official ORTE process
* name. There are several ways this name could be passed to the
* process. This typicall involves an environmental parameter of some
* appropriate name, possibly followed by some computation of the vpid
* based on process rank. This function checks the different
* environmental parameters to find the one that has been set with the
* appropriate value, determines (based on that) the name of this
* process, and then sets that value in the orte_system_info global
* structure.
*/
typedef int (*orte_sds_base_set_name_fn_t)(void);
typedef int (*orte_sds_base_module_finalize_fn_t)(void);
/*
* the standard module data structure
*/
struct orte_sds_base_module_1_0_0_t {
orte_sds_base_contact_universe_fn_t contact_universe;
orte_sds_base_set_name_fn_t set_name;
orte_sds_base_module_finalize_fn_t finalize;
};
/*
* the standard component data structure
*/
struct orte_sds_base_component_1_0_0_t {
mca_base_component_t sds_version;
mca_base_component_data_1_0_0_t sds_data;
orte_sds_base_component_init_fn_t sds_init;
};
/*
* Macro for use in components that are of type ns v1.0.0
*/
#define ORTE_SDS_BASE_VERSION_1_0_0 \
/* sds v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* sds v1.0 */ \
"sds", 1, 0, 0
#endif

45
orte/mca/sds/seed/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
sds_seed.h \
sds_seed_component.c \
sds_seed_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 OMPI_BUILD_sds_seed_DSO
component_noinst =
component_install = mca_sds_seed.la
else
component_noinst = libmca_sds_seed.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_seed_la_SOURCES = $(sources)
mca_sds_seed_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_seed_la_SOURCES =$(sources)
libmca_sds_seed_la_LDFLAGS = -module -avoid-version

19
orte/mca/sds/seed/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_seed_component.c
PARAM_CONFIG_FILES="Makefile"

46
orte/mca/sds/seed/sds_seed.h Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_SEED_H
#define ORTE_SDS_SEED_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_seed_component_open(void);
int orte_sds_seed_component_close(void);
orte_sds_base_module_t* orte_sds_seed_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_seed_finalize(void);
/*
* Module functions
*/
int orte_sds_seed_set_name(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_SEED_H */

89
orte/mca/sds/seed/sds_seed_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,89 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/seed/sds_seed.h"
#include "mca/base/mca_base_param.h"
#include "util/proc_info.h"
extern orte_sds_base_module_t sds_seed_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_seed_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"seed",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_seed_component_open,
orte_sds_seed_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_seed_component_init
};
int
orte_sds_seed_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_seed_component_init(int *priority)
{
if (orte_process_info.seed == false) return NULL;
*priority = 40;
return &sds_seed_module;
}
int
orte_sds_seed_component_close(void)
{
return ORTE_SUCCESS;
}

43
orte/mca/sds/seed/sds_seed_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/seed/sds_seed.h"
orte_sds_base_module_t sds_seed_module = {
orte_sds_base_basic_contact_universe,
orte_sds_base_seed_set_name,
orte_sds_seed_finalize,
};
/* seed_set_name is part of base because it's possible that the
base_set_name will decide that the process has been "promoted" to
seed after the selection occured. Therefore, need a reasonable way
to do the seed setname without actually having the seed
component. */
int
orte_sds_seed_finalize(void)
{
return ORTE_SUCCESS;
}

45
orte/mca/sds/singleton/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
sds_singleton.h \
sds_singleton_component.c \
sds_singleton_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 OMPI_BUILD_sds_singleton_DSO
component_noinst =
component_install = mca_sds_singleton.la
else
component_noinst = libmca_sds_singleton.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_sds_singleton_la_SOURCES = $(sources)
mca_sds_singleton_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_sds_singleton_la_SOURCES =$(sources)
libmca_sds_singleton_la_LDFLAGS = -module -avoid-version

19
orte/mca/sds/singleton/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=sds_singleton_component.c
PARAM_CONFIG_FILES="Makefile"

46
orte/mca/sds/singleton/sds_singleton.h Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_SDS_SINGLETON_H
#define ORTE_SDS_SINGLETON_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Module open / close
*/
int orte_sds_singleton_component_open(void);
int orte_sds_singleton_component_close(void);
orte_sds_base_module_t* orte_sds_singleton_component_init(int *priority);
/*
* Startup / Shutdown
*/
int orte_sds_singleton_finalize(void);
/*
* Module functions
*/
int orte_sds_singleton_set_name(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* ORTE_SDS_SINGLETON_H */

Просмотреть файл

@ -0,0 +1,86 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* 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 "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/singleton/sds_singleton.h"
#include "mca/base/mca_base_param.h"
extern orte_sds_base_module_t sds_singleton_module;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_sds_base_component_t mca_sds_singleton_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a sds v1.0.0 component (which also
implies a specific MCA version) */
ORTE_SDS_BASE_VERSION_1_0_0,
/* Component name and version */
"singleton",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_sds_singleton_component_open,
orte_sds_singleton_component_close
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Initialization / querying functions */
orte_sds_singleton_component_init
};
int
orte_sds_singleton_component_open(void)
{
return ORTE_SUCCESS;
}
orte_sds_base_module_t *
orte_sds_singleton_component_init(int *priority)
{
*priority = 0;
return &sds_singleton_module;
}
int
orte_sds_singleton_component_close(void)
{
return ORTE_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,72 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "include/orte_constants.h"
#include "mca/sds/sds.h"
#include "mca/sds/base/base.h"
#include "mca/sds/singleton/sds_singleton.h"
#include "util/proc_info.h"
#include "mca/base/mca_base_param.h"
#include "mca/errmgr/errmgr.h"
#include "mca/ns/base/base.h"
#include "opal/util/output.h"
orte_sds_base_module_t sds_singleton_module = {
orte_sds_base_basic_contact_universe,
orte_sds_singleton_set_name,
orte_sds_singleton_finalize,
};
int
orte_sds_singleton_set_name(void)
{
int rc, id, flag;
orte_vpid_t vpid;
if (ORTE_SUCCESS != (rc = orte_ns.create_my_name())) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid(&vpid, orte_process_info.my_name))) {
ORTE_ERROR_LOG(rc);
return rc;
}
orte_process_info.num_procs = 1;
orte_process_info.vpid_start = vpid;
/* only set the singleton flag is we are NOT infrastructure */
id = mca_base_param_register_int("orte", "base", "infrastructure",
NULL, (int)false);
mca_base_param_lookup_int(id, &flag);
if (!flag) {
orte_process_info.singleton = true;
}
return ORTE_SUCCESS;
}
int
orte_sds_singleton_finalize(void)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -36,6 +36,7 @@
#include "mca/errmgr/base/base.h"
#include "mca/iof/base/base.h"
#include "mca/ns/base/base.h"
#include "mca/sds/base/base.h"
#include "mca/gpr/base/base.h"
#include "mca/rmgr/base/base.h"
#include "mca/rmaps/base/base.h"
@ -56,13 +57,10 @@
int orte_init_stage1(void)
{
int ret, rc, exit_if_not_exist;
char *universe;
int ret, rc;
char *jobid_str = NULL;
char *procid_str = NULL;
char *contact_path = NULL;
pid_t pid;
orte_universe_t univ;
orte_jobid_t my_jobid;
orte_cellid_t my_cellid;
orte_gpr_value_t value, *values;
@ -165,98 +163,27 @@ int orte_init_stage1(void)
/*
* Initialize schema utilities
*/
if (ORTE_SUCCESS != (ret = orte_schema_base_open())) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* if we were NOT given registry and name service replicas (i.e., we
* weren't told a universe contact point), check for some
* existing universe to join */
if (NULL == orte_process_info.ns_replica_uri || NULL == orte_process_info.gpr_replica_uri) {
if (ORTE_SUCCESS == (ret = orte_universe_exists(&univ))) {
/* copy universe info into our universe structure */
orte_universe_info.name = univ.name;
orte_universe_info.host = univ.host;
orte_universe_info.uid = univ.uid;
orte_universe_info.persistence = univ.persistence;
orte_universe_info.scope = univ.scope;
orte_universe_info.console = univ.console;
orte_universe_info.seed_uri = univ.seed_uri;
orte_universe_info.console_connected = univ.console_connected;
orte_universe_info.scriptfile = univ.scriptfile;
/* define the replica contact points */
orte_process_info.ns_replica_uri = strdup(univ.seed_uri);
orte_process_info.gpr_replica_uri = strdup(univ.seed_uri);
} else {
/* if an existing universe is not detected, check the
* relevant MCA parameter to see if the caller wants
* us to abort in this situation
*/
if (0 > (rc = mca_base_param_register_int("orte", "univ", "exist", NULL, 0))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = mca_base_param_lookup_int(rc, &exit_if_not_exist))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (exit_if_not_exist) {
/* cleanup the subsystems that were already opened */
orte_wait_finalize();
orte_ns_base_close();
orte_gpr_base_close();
orte_schema_base_close();
orte_rml_base_close();
orte_dps_close();
orte_errmgr_base_close();
opal_progress_finalize();
opal_event_fini();
orte_sys_info_finalize();
orte_proc_info_finalize();
orte_univ_info_finalize();
opal_finalize();
return ORTE_ERR_UNREACH;
}
if (ORTE_ERR_NOT_FOUND != ret) {
/* if it exists but no contact could be established,
* define unique name based on current one.
* and start new universe with me as seed
*/
universe = strdup(orte_universe_info.name);
free(orte_universe_info.name);
orte_universe_info.name = NULL;
pid = getpid();
if (0 > asprintf(&orte_universe_info.name, "%s-%d", universe, (int)pid)) {
opal_output(0, "orte_init: failed to create unique universe name");
return ret;
}
opal_output(0, "Could not join a running, existing universe");
opal_output(0, "Establishing a new one named: %s",
orte_universe_info.name);
}
orte_process_info.seed = true;
/* since we are seed, ensure that all replica info is NULL'd */
if (NULL != orte_process_info.ns_replica_uri) {
free(orte_process_info.ns_replica_uri);
orte_process_info.ns_replica_uri = NULL;
}
if (NULL != orte_process_info.ns_replica) {
free(orte_process_info.ns_replica);
orte_process_info.ns_replica = NULL;
}
if (NULL != orte_process_info.gpr_replica_uri) {
free(orte_process_info.gpr_replica_uri);
orte_process_info.gpr_replica_uri = NULL;
}
if (NULL != orte_process_info.gpr_replica) {
free(orte_process_info.gpr_replica);
orte_process_info.gpr_replica = NULL;
}
}
/*
* Initialize and select sds
*/
if (ORTE_SUCCESS != (ret = orte_sds_base_open())) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (ORTE_SUCCESS != (ret = orte_sds_base_select())) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* Try to connect to the universe */
if (ORTE_SUCCESS != (ret = orte_sds_base_contact_universe())) {
ORTE_ERROR_LOG(ret);
return ret;
}
/*
@ -283,12 +210,15 @@ int orte_init_stage1(void)
orte_rml.set_uri(orte_process_info.gpr_replica_uri);
}
/***** SET MY NAME *****/
if (ORTE_SUCCESS != (ret = orte_ns.set_my_name())) {
/* set my name and the names of the procs I was started with */
if (ORTE_SUCCESS != (ret = orte_sds_base_set_name())) {
ORTE_ERROR_LOG(ret);
return ret;
}
/* all done with sds - clean up and call it a day */
orte_sds_base_close();
/* if I'm the seed, set the seed uri to be me! */
if (orte_process_info.seed) {
orte_universe_info.seed_uri = orte_rml.get_uri();