root/orte/mca/plm/tm/plm_tm_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. plm_tm_register
  2. plm_tm_open
  3. plm_tm_close
  4. orte_plm_tm_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) 2006      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  15  *                         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/util/argv.h"
  33 
  34 
  35 #include "orte/mca/plm/plm.h"
  36 #include "orte/mca/plm/base/base.h"
  37 #include "orte/mca/plm/base/plm_private.h"
  38 #include "plm_tm.h"
  39 
  40 
  41 /*
  42  * Public string showing the plm ompi_tm component version number
  43  */
  44 const char *mca_plm_tm_component_version_string =
  45   "Open MPI tm plm MCA component version " ORTE_VERSION;
  46 
  47 
  48 
  49 /*
  50  * Local function
  51  */
  52 static int plm_tm_register(void);
  53 static int plm_tm_open(void);
  54 static int plm_tm_close(void);
  55 static int orte_plm_tm_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_tm_component_t mca_plm_tm_component = {
  64     {
  65         /* First, the mca_component_t struct containing meta information
  66            about the component itself */
  67 
  68         .base_version = {
  69             ORTE_PLM_BASE_VERSION_2_0_0,
  70 
  71             /* Component name and version */
  72             .mca_component_name = "tm",
  73             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  74                                   ORTE_RELEASE_VERSION),
  75 
  76             /* Component open and close functions */
  77             .mca_open_component = plm_tm_open,
  78             .mca_close_component = plm_tm_close,
  79             .mca_query_component = orte_plm_tm_component_query,
  80             .mca_register_component_params = plm_tm_register,
  81         },
  82         .base_data = {
  83             /* The component is checkpoint ready */
  84             MCA_BASE_METADATA_PARAM_CHECKPOINT
  85         },
  86     }
  87 };
  88 
  89 static int plm_tm_register(void)
  90 {
  91     mca_base_component_t *comp = &mca_plm_tm_component.super.base_version;
  92 
  93     mca_plm_tm_component.want_path_check = true;
  94     (void) mca_base_component_var_register (comp, "want_path_check",
  95                                             "Whether the launching process should check for the plm_tm_orted executable in the PATH before launching (the TM API does not give an indication of failure; this is a somewhat-lame workaround; non-zero values enable this check)",
  96                                             MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
  97                                             OPAL_INFO_LVL_9,
  98                                             MCA_BASE_VAR_SCOPE_READONLY,
  99                                             &mca_plm_tm_component.want_path_check);
 100 
 101     return ORTE_SUCCESS;
 102 }
 103 
 104 static int plm_tm_open(void)
 105 {
 106     mca_plm_tm_component.checked_paths = NULL;
 107 
 108     return ORTE_SUCCESS;
 109 }
 110 
 111 
 112 static int plm_tm_close(void)
 113 {
 114     if (NULL != mca_plm_tm_component.checked_paths) {
 115         opal_argv_free(mca_plm_tm_component.checked_paths);
 116     }
 117 
 118     return ORTE_SUCCESS;
 119 }
 120 
 121 
 122 static int orte_plm_tm_component_query(mca_base_module_t **module, int *priority)
 123 {
 124     /* Are we running under a TM job? */
 125 
 126     if (NULL != getenv("PBS_ENVIRONMENT") &&
 127         NULL != getenv("PBS_JOBID")) {
 128 
 129         *priority = 75;
 130         *module = (mca_base_module_t *) &orte_plm_tm_module;
 131         return ORTE_SUCCESS;
 132     }
 133 
 134     /* Sadly, no */
 135     *module = NULL;
 136     return ORTE_ERROR;
 137 }

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