This source file includes following definitions.
- pmix_pnet_base_select
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 #include <src/include/pmix_config.h>
  21 #include <pmix_common.h>
  22 
  23 #include <string.h>
  24 
  25 #include "src/mca/mca.h"
  26 #include "src/mca/base/base.h"
  27 
  28 #include "src/mca/pnet/base/base.h"
  29 
  30 static bool selected = false;
  31 
  32 
  33 
  34 int pmix_pnet_base_select(void)
  35 {
  36     pmix_mca_base_component_list_item_t *cli = NULL;
  37     pmix_mca_base_component_t *component = NULL;
  38     pmix_mca_base_module_t *module = NULL;
  39     pmix_pnet_module_t *nmodule;
  40     pmix_pnet_base_active_module_t *newmodule, *mod;
  41     int rc, priority;
  42     bool inserted;
  43 
  44     if (selected) {
  45         
  46         return PMIX_SUCCESS;
  47     }
  48     selected = true;
  49 
  50     
  51     PMIX_LIST_FOREACH(cli, &pmix_pnet_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
  52         component = (pmix_mca_base_component_t *) cli->cli_component;
  53 
  54         pmix_output_verbose(5, pmix_pnet_base_framework.framework_output,
  55                             "mca:pnet:select: checking available component %s", component->pmix_mca_component_name);
  56 
  57         
  58         if (NULL == component->pmix_mca_query_component) {
  59             pmix_output_verbose(5, pmix_pnet_base_framework.framework_output,
  60                                 "mca:pnet:select: Skipping component [%s]. It does not implement a query function",
  61                                 component->pmix_mca_component_name );
  62             continue;
  63         }
  64 
  65         
  66         pmix_output_verbose(5, pmix_pnet_base_framework.framework_output,
  67                             "mca:pnet:select: Querying component [%s]",
  68                             component->pmix_mca_component_name);
  69         rc = component->pmix_mca_query_component(&module, &priority);
  70 
  71         
  72         if (PMIX_SUCCESS != rc || NULL == module) {
  73             pmix_output_verbose(5, pmix_pnet_base_framework.framework_output,
  74                                 "mca:pnet:select: Skipping component [%s]. Query failed to return a module",
  75                                 component->pmix_mca_component_name );
  76             continue;
  77         }
  78 
  79         
  80         nmodule = (pmix_pnet_module_t*) module;
  81         
  82         if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) {
  83             continue;
  84         }
  85         
  86         newmodule = PMIX_NEW(pmix_pnet_base_active_module_t);
  87         newmodule->pri = priority;
  88         newmodule->module = nmodule;
  89         newmodule->component = (pmix_pnet_base_component_t*)cli->cli_component;
  90 
  91         
  92         inserted = false;
  93         PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
  94             if (priority > mod->pri) {
  95                 pmix_list_insert_pos(&pmix_pnet_globals.actives,
  96                                      (pmix_list_item_t*)mod, &newmodule->super);
  97                 inserted = true;
  98                 break;
  99             }
 100         }
 101         if (!inserted) {
 102             
 103             pmix_list_append(&pmix_pnet_globals.actives, &newmodule->super);
 104         }
 105     }
 106 
 107     if (4 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) {
 108         pmix_output(0, "Final pnet priorities");
 109         
 110         PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) {
 111             pmix_output(0, "\tpnet: %s Priority: %d", mod->component->base.pmix_mca_component_name, mod->pri);
 112         }
 113     }
 114 
 115     return PMIX_SUCCESS;;
 116 }