root/opal/mca/pmix/s1/pmix_s1_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. pmix_s1_component_register
  2. pmix_s1_component_query

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2014      Intel, Inc.  All rights reserved.
   4  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2016 Cisco Systems, Inc.  All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  *
  13  * These symbols are in a file by themselves to provide nice linker
  14  * semantics.  Since linkers generally pull in symbols by object
  15  * files, keeping these symbols as the only symbols in this file
  16  * prevents utility programs such as "ompi_info" from having to import
  17  * entire components just to query their version and parameters.
  18  */
  19 
  20 #include "opal_config.h"
  21 
  22 #include "opal/constants.h"
  23 #include "opal/mca/pmix/pmix.h"
  24 #include "pmix_s1.h"
  25 
  26 /*
  27  * Public string showing the pmix s1 component version number
  28  */
  29 const char *opal_pmix_s1_component_version_string =
  30         "OPAL s1 pmix MCA component version " OPAL_VERSION;
  31 
  32 /*
  33  * Local function
  34  */
  35 static int pmix_s1_component_query(mca_base_module_t **module, int *priority);
  36 static int pmix_s1_component_register(void);
  37 
  38 
  39 /*
  40  * Instantiate the public struct with all of our public information
  41  * and pointers to our public functions in it
  42  */
  43 
  44 opal_pmix_base_component_t mca_pmix_s1_component = {
  45 
  46     /* First, the mca_component_t struct containing meta information
  47            about the component itself */
  48 
  49     .base_version = {
  50         /* Indicate that we are a pmix v1.1.0 component (which also
  51                implies a specific MCA version) */
  52 
  53         OPAL_PMIX_BASE_VERSION_2_0_0,
  54 
  55         /* Component name and version */
  56 
  57         .mca_component_name = "s1",
  58         MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  59         OPAL_RELEASE_VERSION),
  60 
  61         /* Component open and close functions */
  62         .mca_query_component = pmix_s1_component_query,
  63         .mca_register_component_params = pmix_s1_component_register,
  64     },
  65     /* Next the MCA v1.0.0 component meta data */
  66     .base_data = {
  67         /* The component is checkpoint ready */
  68         MCA_BASE_METADATA_PARAM_CHECKPOINT
  69     },
  70     .priority = 10,
  71 };
  72 
  73 static int pmix_s1_component_register(void)
  74 {
  75     int ret;
  76     mca_base_component_t *component = &mca_pmix_s1_component.base_version;
  77 
  78     mca_pmix_s1_component.priority = 10;
  79     ret = mca_base_component_var_register(component, "priority",
  80                                           "Priority of the pmix s1 component (default: 10)",
  81                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  82                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
  83                                           &mca_pmix_s1_component.priority);
  84     if (0 > ret) {
  85         return ret;
  86     }
  87 
  88     return OPAL_SUCCESS;
  89 }
  90 
  91 static int pmix_s1_component_query(mca_base_module_t **module, int *priority)
  92 {
  93     /* disqualify ourselves if we are not under slurm */
  94     if (NULL == getenv("SLURM_STEP_NUM_TASKS")) {
  95         *priority = 0;
  96         *module = NULL;
  97         return OPAL_ERROR;
  98     }
  99 
 100     /* we can be considered, but set our priority by default
 101      * to be less than s2 */
 102     *priority = mca_pmix_s1_component.priority;
 103     *module = (mca_base_module_t *)&opal_pmix_s1_module;
 104     return OPAL_SUCCESS;
 105 }

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