1
1

Add simulator component to support testing of large scale mapping methods. Automatically sets do-not-resolve and do-not-launch, and creates however many nodes the user wants to simulate in the system.

This commit was SVN r25386.
Этот коммит содержится в:
Ralph Castain 2011-10-28 23:48:53 +00:00
родитель 691aa0a6dd
Коммит 7fa5f82d70
4 изменённых файлов: 247 добавлений и 0 удалений

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

@ -0,0 +1,39 @@
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
ras_sim.h \
ras_sim_component.c \
ras_sim_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_ras_simulator_DSO
lib =
lib_sources =
component = mca_ras_simulator.la
component_sources = $(sources)
else
lib = libmca_ras_simulator.la
lib_sources = $(sources)
component =
component_sources =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_ras_simulator_la_SOURCES = $(component_sources)
mca_ras_simulator_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lib)
libmca_ras_simulator_la_SOURCES = $(lib_sources)
libmca_ras_simulator_la_LDFLAGS = -module -avoid-version

32
orte/mca/ras/simulator/ras_sim.h Обычный файл
Просмотреть файл

@ -0,0 +1,32 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_RAS_SIM_H
#define ORTE_RAS_SIM_H
#include "orte_config.h"
#include "orte/mca/ras/ras.h"
#include "orte/mca/ras/base/base.h"
BEGIN_C_DECLS
struct orte_ras_sim_component_t {
orte_ras_base_component_t super;
int num_nodes;
int slots;
int slots_max;
};
typedef struct orte_ras_sim_component_t orte_ras_sim_component_t;
ORTE_DECLSPEC extern orte_ras_sim_component_t mca_ras_simulator_component;
ORTE_DECLSPEC extern orte_ras_base_module_t orte_ras_sim_module;
END_C_DECLS
#endif

100
orte/mca/ras/simulator/ras_sim_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,100 @@
/*
* Copyright (c) 2004-2008 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 "opal/mca/base/mca_base_param.h"
#include "opal/mca/if/if.h"
#include "orte/util/name_fns.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/ras/base/ras_private.h"
#include "ras_sim.h"
/*
* Local functions
*/
static int ras_sim_open(void);
static int ras_sim_component_query(mca_base_module_t **module, int *priority);
orte_ras_sim_component_t mca_ras_simulator_component = {
{
/* First, the mca_base_component_t struct containing meta
information about the component itself */
{
ORTE_RAS_BASE_VERSION_2_0_0,
/* Component name and version */
"simulator",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
ras_sim_open,
NULL,
ras_sim_component_query
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
}
};
static int ras_sim_open(void)
{
mca_base_param_reg_int(&mca_ras_simulator_component.super.base_version,
"num_nodes",
"Number of nodes to simulate",
false, false, 0, &mca_ras_simulator_component.num_nodes);
mca_base_param_reg_int(&mca_ras_simulator_component.super.base_version,
"slots",
"Number of slots on each node to simulate",
false, false, 1, &mca_ras_simulator_component.slots);
mca_base_param_reg_int(&mca_ras_simulator_component.super.base_version,
"max_slots",
"Number of max slots on each node to simulate",
false, false, 0, &mca_ras_simulator_component.slots_max);
return ORTE_SUCCESS;
}
static int ras_sim_component_query(mca_base_module_t **module, int *priority)
{
if (0 < mca_ras_simulator_component.num_nodes) {
*module = (mca_base_module_t *) &orte_ras_sim_module;
*priority = 1000;
/* cannot launch simulated nodes or resolve their names to addresses */
orte_do_not_launch = true;
opal_if_do_not_resolve = true;
return ORTE_SUCCESS;
}
/* Sadly, no */
*module = NULL;
*priority = 0;
return ORTE_ERROR;
}

76
orte/mca/ras/simulator/ras_sim_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,76 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. 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 <ctype.h>
#include "opal/class/opal_list.h"
#include "opal/mca/hwloc/hwloc.h"
#include "orte/runtime/orte_globals.h"
#include "ras_sim.h"
/*
* Local functions
*/
static int allocate(opal_list_t *nodes);
static int finalize(void);
/*
* Global variable
*/
orte_ras_base_module_t orte_ras_sim_module = {
allocate,
finalize
};
static int allocate(opal_list_t *nodes)
{
int i, val, dig;
orte_node_t *node;
/* get number of digits */
val = mca_ras_simulator_component.num_nodes;
for (dig=0; 0 != val; dig++) {
val /= 10;
}
for (i=0; i < mca_ras_simulator_component.num_nodes; i++) {
node = OBJ_NEW(orte_node_t);
asprintf(&node->name, "node%0*d", dig, i);
node->state = ORTE_NODE_STATE_UP;
node->slots_inuse = 0;
node->slots_max = mca_ras_simulator_component.slots_max;
node->slots = mca_ras_simulator_component.slots;
#if OPAL_HAVE_HWLOC
node->topology = opal_hwloc_topology;
#endif
opal_list_append(nodes, &node->super);
}
/* record the number of allocated nodes */
orte_num_allocated_nodes = opal_list_get_size(nodes);
return ORTE_SUCCESS;
}
/*
* There's really nothing to do here
*/
static int finalize(void)
{
return ORTE_SUCCESS;
}