root/orte/mca/plm/alps/plm_alps_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. plm_alps_register
  2. plm_alps_open
  3. orte_plm_alps_component_query
  4. plm_alps_close

   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) 2017      Intel, Inc. All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  *
  22  * These symbols are in a file by themselves to provide nice linker
  23  * semantics.  Since linkers generally pull in symbols by object
  24  * files, keeping these symbols as the only symbols in this file
  25  * prevents utility programs such as "ompi_info" from having to import
  26  * entire components just to query their version and parameters.
  27  */
  28 
  29 #include "orte_config.h"
  30 #include "orte/constants.h"
  31 
  32 #include "opal/mca/base/mca_base_var.h"
  33 
  34 #include "orte/runtime/orte_globals.h"
  35 
  36 #include "orte/mca/plm/plm.h"
  37 #include "orte/mca/plm/base/base.h"
  38 #include "orte/mca/plm/base/plm_private.h"
  39 #include "plm_alps.h"
  40 
  41 
  42 /*
  43  * Public string showing the plm ompi_alps component version number
  44  */
  45 const char *mca_plm_alps_component_version_string =
  46   "Open MPI alps plm MCA component version " ORTE_VERSION;
  47 
  48 
  49 /*
  50  * Local functions
  51  */
  52 static int plm_alps_register(void);
  53 static int plm_alps_open(void);
  54 static int plm_alps_close(void);
  55 static int orte_plm_alps_component_query(mca_base_module_t **module, int *priority);
  56 
  57 
  58 /*
  59  * Instantiate the public struct with all of our public information
  60  * and pointers to our public functions in it
  61  */
  62 
  63 orte_plm_alps_component_t mca_plm_alps_component = {
  64 
  65     {
  66         /* First, the mca_component_t struct containing meta
  67            information about the component itself */
  68 
  69         .base_version = {
  70             ORTE_PLM_BASE_VERSION_2_0_0,
  71 
  72             /* Component name and version */
  73             .mca_component_name = "alps",
  74             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  75                                   ORTE_RELEASE_VERSION),
  76 
  77             /* Component open and close functions */
  78             .mca_open_component = plm_alps_open,
  79             .mca_close_component = plm_alps_close,
  80             .mca_query_component = orte_plm_alps_component_query,
  81             .mca_register_component_params = plm_alps_register,
  82         },
  83         .base_data = {
  84             /* The component is checkpoint ready */
  85             MCA_BASE_METADATA_PARAM_CHECKPOINT
  86         },
  87     }
  88 
  89     /* Other orte_plm_alps_component_t items -- left uninitialized
  90        here; will be initialized in plm_alps_open() */
  91 };
  92 
  93 
  94 static int plm_alps_register(void)
  95 {
  96     mca_base_component_t *comp = &mca_plm_alps_component.super.base_version;
  97 
  98     mca_plm_alps_component.debug = false;
  99     (void) mca_base_component_var_register (comp, "debug", "Enable debugging of alps plm",
 100                                             MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 101                                             OPAL_INFO_LVL_9,
 102                                             MCA_BASE_VAR_SCOPE_READONLY,
 103                                             &mca_plm_alps_component.debug);
 104 
 105     if (mca_plm_alps_component.debug == 0) {
 106         mca_plm_alps_component.debug = orte_debug_flag;
 107     }
 108 
 109     mca_plm_alps_component.priority = 100;
 110     (void) mca_base_component_var_register (comp, "priority", "Default selection priority",
 111                                             MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 112                                             OPAL_INFO_LVL_9,
 113                                             MCA_BASE_VAR_SCOPE_READONLY,
 114                                             &mca_plm_alps_component.priority);
 115 
 116     mca_plm_alps_component.aprun_cmd = "aprun";
 117     (void) mca_base_component_var_register (comp, "aprun", "Command to run instead of aprun",
 118                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
 119                                             OPAL_INFO_LVL_9,
 120                                             MCA_BASE_VAR_SCOPE_READONLY,
 121                                             &mca_plm_alps_component.aprun_cmd);
 122 
 123     mca_plm_alps_component.custom_args = NULL;
 124     (void) mca_base_component_var_register (comp, "args", "Custom arguments to aprun",
 125                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
 126                                             OPAL_INFO_LVL_9,
 127                                             MCA_BASE_VAR_SCOPE_READONLY,
 128                                             &mca_plm_alps_component.custom_args);
 129     return ORTE_SUCCESS;
 130 }
 131 
 132 static int plm_alps_open(void)
 133 {
 134     return ORTE_SUCCESS;
 135 }
 136 
 137 
 138 static int orte_plm_alps_component_query(mca_base_module_t **module, int *priority)
 139 {
 140 #if CRAY_WLM_DETECT
 141     char slurm[]="SLURM";
 142     char *wlm_detected = NULL;
 143 
 144     wlm_detected = wlm_detect_get_active();
 145 
 146     /*
 147      * The content of wlm_detected.h indicates wlm_detect_get_active
 148      * may return NULL upon failure.  Resort to the suggested plan
 149      * B in that event.
 150      */
 151 
 152     if (NULL == wlm_detected) {
 153         wlm_detected = (char *)wlm_detect_get_default();
 154         OPAL_OUTPUT_VERBOSE((10, orte_plm_base_framework.framework_output,
 155                              "%s plm:alps: wlm_detect_get_active returned NULL, using %s",
 156                              ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), wlm_detected));
 157 
 158     }
 159 
 160     if((NULL != wlm_detected) && !strcmp(slurm, wlm_detected)) {
 161         /* we are in a Cray SLURM environment, so we don't want
 162          * this plm component */
 163         *priority = 0;
 164         *module = NULL;
 165         return ORTE_ERROR;
 166     }
 167 #endif
 168 
 169     *priority = mca_plm_alps_component.priority;
 170     *module = (mca_base_module_t *) &orte_plm_alps_module;
 171     OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output,
 172                         "%s plm:alps: available for selection",
 173                          ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
 174 
 175     return ORTE_SUCCESS;
 176 }
 177 
 178 
 179 static int plm_alps_close(void)
 180 {
 181     return ORTE_SUCCESS;
 182 }

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