root/opal/mca/pmix/s2/pmix_s2_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. pmix_s2_component_register
  2. pmix_s2_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_s2.h"
  25 
  26 /*
  27  * Public string showing the pmix s2 component version number
  28  */
  29 const char *opal_pmix_s2_component_version_string =
  30         "OPAL s2 pmix MCA component version " OPAL_VERSION;
  31 
  32 /*
  33  * Local function
  34  */
  35 static int pmix_s2_component_query(mca_base_module_t **module, int *priority);
  36 static int pmix_s2_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_s2_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 = "s2",
  58         MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  59         OPAL_RELEASE_VERSION),
  60 
  61         .mca_query_component = pmix_s2_component_query,
  62         .mca_register_component_params = pmix_s2_component_register,
  63     },
  64     /* Next the MCA v1.0.0 component meta data */
  65     .base_data = {
  66         /* The component is checkpoint ready */
  67         MCA_BASE_METADATA_PARAM_CHECKPOINT
  68     },
  69     .priority = 20,
  70 };
  71 
  72 
  73 static int pmix_s2_component_register(void)
  74 {
  75     int ret;
  76     mca_base_component_t *component = &(mca_pmix_s2_component.base_version);
  77 
  78     ret = mca_base_component_var_register(component, "priority",
  79                                           "Priority of the pmix s2 component (default: 20)",
  80                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  81                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
  82                                           &mca_pmix_s2_component.priority);
  83     if (0 > ret) {
  84         return ret;
  85     }
  86 
  87     return OPAL_SUCCESS;
  88 }
  89 
  90 static int pmix_s2_component_query(mca_base_module_t **module, int *priority)
  91 {
  92     /* disqualify ourselves if we are not under slurm, and
  93      * if they didn't set mpi=pmix2 */
  94     if (NULL == getenv("SLURM_STEP_NUM_TASKS") ||
  95             NULL == getenv("PMI_FD")) {
  96         *priority = 0;
  97         *module = NULL;
  98         return OPAL_ERROR;
  99     }
 100 
 101     /* we can be considered */
 102     *priority = mca_pmix_s2_component.priority;
 103     *module = (mca_base_module_t *)&opal_pmix_s2_module;
 104     return OPAL_SUCCESS;
 105 }

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