root/orte/mca/ras/simulator/ras_sim_component.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ras_sim_register
  2. ras_sim_component_query

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * Copyright (c) 2015      Intel, Inc. All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #include "orte_config.h"
  24 #include "orte/constants.h"
  25 
  26 #include "opal/mca/base/base.h"
  27 #include "opal/mca/if/if.h"
  28 
  29 #include "orte/util/name_fns.h"
  30 #include "orte/runtime/orte_globals.h"
  31 
  32 #include "orte/mca/ras/base/ras_private.h"
  33 #include "ras_sim.h"
  34 
  35 /*
  36  * Local functions
  37  */
  38 static int ras_sim_register(void);
  39 static int ras_sim_component_query(mca_base_module_t **module, int *priority);
  40 
  41 
  42 orte_ras_sim_component_t mca_ras_simulator_component = {
  43     {
  44         /* First, the mca_base_component_t struct containing meta
  45            information about the component itself */
  46 
  47         .base_version = {
  48             ORTE_RAS_BASE_VERSION_2_0_0,
  49 
  50             /* Component name and version */
  51             .mca_component_name = "simulator",
  52             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  53                                   ORTE_RELEASE_VERSION),
  54             .mca_query_component = ras_sim_component_query,
  55             .mca_register_component_params = ras_sim_register,
  56         },
  57         .base_data = {
  58             /* The component is checkpoint ready */
  59             MCA_BASE_METADATA_PARAM_CHECKPOINT
  60         },
  61     }
  62 };
  63 
  64 
  65 static int ras_sim_register(void)
  66 {
  67     mca_base_component_t *component = &mca_ras_simulator_component.super.base_version;
  68 
  69     mca_ras_simulator_component.slots = "1";
  70     (void) mca_base_component_var_register (component, "slots",
  71                                             "Comma-separated list of number of slots on each node to simulate",
  72                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  73                                             OPAL_INFO_LVL_9,
  74                                             MCA_BASE_VAR_SCOPE_READONLY,
  75                                             &mca_ras_simulator_component.slots);
  76 
  77     mca_ras_simulator_component.slots_max = "0";
  78     (void) mca_base_component_var_register (component, "max_slots",
  79                                             "Comma-separated list of number of max slots on each node to simulate",
  80                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  81                                             OPAL_INFO_LVL_9,
  82                                             MCA_BASE_VAR_SCOPE_READONLY,
  83                                             &mca_ras_simulator_component.slots_max);
  84     mca_ras_simulator_component.num_nodes = NULL;
  85     (void) mca_base_component_var_register (component, "num_nodes",
  86                                             "Comma-separated list of number of nodes to simulate for each topology",
  87                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  88                                             OPAL_INFO_LVL_9,
  89                                             MCA_BASE_VAR_SCOPE_READONLY,
  90                                             &mca_ras_simulator_component.num_nodes);
  91     mca_ras_simulator_component.topofiles = NULL;
  92     (void) mca_base_component_var_register (component, "topo_files",
  93                                             "Comma-separated list of files containing xml topology descriptions for simulated nodes",
  94                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  95                                             OPAL_INFO_LVL_9,
  96                                             MCA_BASE_VAR_SCOPE_READONLY,
  97                                             &mca_ras_simulator_component.topofiles);
  98     mca_ras_simulator_component.topologies = NULL;
  99     (void) mca_base_component_var_register (component, "topologies",
 100                                             "Comma-separated list of topology descriptions for simulated nodes",
 101                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
 102                                             OPAL_INFO_LVL_9,
 103                                             MCA_BASE_VAR_SCOPE_READONLY,
 104                                             &mca_ras_simulator_component.topologies);
 105     mca_ras_simulator_component.have_cpubind = true;
 106     (void) mca_base_component_var_register (component, "have_cpubind",
 107                                             "Topology supports binding to cpus",
 108                                             MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 109                                             OPAL_INFO_LVL_9,
 110                                             MCA_BASE_VAR_SCOPE_READONLY,
 111                                                 &mca_ras_simulator_component.have_cpubind);
 112     mca_ras_simulator_component.have_membind = true;
 113     (void) mca_base_component_var_register (component, "have_membind",
 114                                             "Topology supports binding to memory",
 115                                             MCA_BASE_VAR_TYPE_BOOL,NULL, 0, 0,
 116                                             OPAL_INFO_LVL_9,
 117                                             MCA_BASE_VAR_SCOPE_READONLY,
 118                                             &mca_ras_simulator_component.have_membind);
 119     return ORTE_SUCCESS;
 120 }
 121 
 122 
 123 static int ras_sim_component_query(mca_base_module_t **module, int *priority)
 124 {
 125     if (NULL != mca_ras_simulator_component.num_nodes) {
 126         *module = (mca_base_module_t *) &orte_ras_sim_module;
 127         *priority = 1000;
 128         /* cannot launch simulated nodes or resolve their names to addresses */
 129         orte_do_not_launch = true;
 130         opal_if_do_not_resolve = true;
 131         return ORTE_SUCCESS;
 132     }
 133 
 134     /* Sadly, no */
 135     *module = NULL;
 136     *priority = 0;
 137     return ORTE_ERROR;
 138 }

/* [<][>][^][v][top][bottom][index][help] */