This source file includes following definitions.
- external_register
- external_open
- external_close
- external_component_query
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 #include "opal_config.h"
  20 
  21 #include "opal/constants.h"
  22 #include "opal/class/opal_list.h"
  23 #include "opal/util/proc.h"
  24 #include "opal/util/show_help.h"
  25 #include "opal/mca/pmix/pmix.h"
  26 #include "ext2x.h"
  27 
  28 
  29 
  30 
  31 const char *opal_pmix_ext2x_component_version_string =
  32     "OPAL ext2x MCA component version " OPAL_VERSION;
  33 
  34 
  35 
  36 
  37 static int external_register(void);
  38 static int external_open(void);
  39 static int external_close(void);
  40 static int external_component_query(mca_base_module_t **module, int *priority);
  41 
  42 
  43 
  44 
  45 static char *pmix_library_version = NULL;
  46 
  47 
  48 
  49 
  50 
  51 
  52 
  53 mca_pmix_ext2x_component_t mca_pmix_ext2x_component = {
  54     {
  55     
  56 
  57 
  58         .base_version = {
  59         
  60 
  61 
  62             OPAL_PMIX_BASE_VERSION_2_0_0,
  63 
  64         
  65 
  66             .mca_component_name = "ext2x",
  67             MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  68                                   OPAL_RELEASE_VERSION),
  69 
  70         
  71 
  72             .mca_open_component = external_open,
  73             .mca_close_component = external_close,
  74             .mca_query_component = external_component_query,
  75             .mca_register_component_params = external_register
  76         },
  77         
  78         .base_data = {
  79         
  80             MCA_BASE_METADATA_PARAM_CHECKPOINT
  81         }
  82     },
  83     .legacy_get = true,
  84     .native_launch = false
  85 };
  86 
  87 static int external_register(void)
  88 {
  89     mca_base_component_t *component = &mca_pmix_ext2x_component.super.base_version;
  90 
  91     mca_pmix_ext2x_component.silence_warning = false;
  92     (void) mca_base_component_var_register (component, "silence_warning",
  93                                             "Silence warning about PMIX_INSTALL_PREFIX",
  94                                             MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
  95                                             OPAL_INFO_LVL_4,
  96                                             MCA_BASE_VAR_SCOPE_READONLY,
  97                                             &mca_pmix_ext2x_component.silence_warning);
  98 
  99     asprintf(&pmix_library_version, "PMIx library version %s", PMIx_Get_version());
 100     (void) mca_base_component_var_register(component, "library_version",
 101                                            "Version of the underlying PMIx library",
 102                                            MCA_BASE_VAR_TYPE_STRING,
 103                                            NULL, 0, 0,
 104                                            OPAL_INFO_LVL_4,
 105                                            MCA_BASE_VAR_SCOPE_CONSTANT,
 106                                            &pmix_library_version);
 107 
 108     return OPAL_SUCCESS;
 109 }
 110 
 111 static int external_open(void)
 112 {
 113     const char *version;
 114 
 115     mca_pmix_ext2x_component.evindex = 0;
 116     OBJ_CONSTRUCT(&mca_pmix_ext2x_component.jobids, opal_list_t);
 117     OBJ_CONSTRUCT(&mca_pmix_ext2x_component.events, opal_list_t);
 118     OBJ_CONSTRUCT(&mca_pmix_ext2x_component.dmdx, opal_list_t);
 119 
 120     version = PMIx_Get_version();
 121     if ('2' > version[0]) {
 122         opal_show_help("help-pmix-base.txt",
 123                        "incorrect-pmix", true, version, "v2.x");
 124         return OPAL_ERROR;
 125     }
 126     if (0 != strncmp(version, "2.0", 3)) {
 127         mca_pmix_ext2x_component.legacy_get = false;
 128     }
 129 
 130     return OPAL_SUCCESS;
 131 }
 132 
 133 static int external_close(void)
 134 {
 135     OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.jobids);
 136     OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.events);
 137     OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.dmdx);
 138     return OPAL_SUCCESS;
 139 }
 140 
 141 
 142 static int external_component_query(mca_base_module_t **module, int *priority)
 143 {
 144     char *t, *id;
 145 
 146     
 147     if (NULL != (t = getenv("PMIX_SERVER_URI")) ||
 148         NULL != (t = getenv("PMIX_SERVER_URI2")) ||
 149         NULL != (id = getenv("PMIX_ID"))) {
 150         
 151         *priority = 100;
 152     } else {
 153         
 154         *priority = 5;
 155     }
 156     *module = (mca_base_module_t *)&opal_pmix_ext2x_module;
 157     return OPAL_SUCCESS;
 158 }