This source file includes following definitions.
- orte_rtc_base_select
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 #include "orte_config.h"
  11 #include "orte/constants.h"
  12 
  13 #include <string.h>
  14 
  15 #include "orte/mca/mca.h"
  16 #include "opal/mca/base/base.h"
  17 
  18 #include "orte/mca/rtc/base/base.h"
  19 
  20 static bool selected = false;
  21 
  22 
  23 
  24 
  25 
  26 int orte_rtc_base_select(void)
  27 {
  28     mca_base_component_list_item_t *cli = NULL;
  29     mca_base_component_t *component = NULL;
  30     mca_base_module_t *module = NULL;
  31     orte_rtc_base_module_t *nmodule;
  32     orte_rtc_base_selected_module_t *newmodule, *mod;
  33     int rc, priority;
  34     bool inserted;
  35 
  36     if (selected) {
  37         
  38         return ORTE_SUCCESS;
  39     }
  40     selected = true;
  41 
  42     
  43     OPAL_LIST_FOREACH(cli, &orte_rtc_base_framework.framework_components, mca_base_component_list_item_t) {
  44         component = (mca_base_component_t *) cli->cli_component;
  45 
  46         opal_output_verbose(5, orte_rtc_base_framework.framework_output,
  47                             "mca:rtc:select: checking available component %s", component->mca_component_name);
  48 
  49         
  50         if (NULL == component->mca_query_component) {
  51             opal_output_verbose(5, orte_rtc_base_framework.framework_output,
  52                                 "mca:rtc:select: Skipping component [%s]. It does not implement a query function",
  53                                 component->mca_component_name );
  54             continue;
  55         }
  56 
  57         
  58         opal_output_verbose(5, orte_rtc_base_framework.framework_output,
  59                             "mca:rtc:select: Querying component [%s]",
  60                             component->mca_component_name);
  61         rc = component->mca_query_component(&module, &priority);
  62 
  63         
  64         if (ORTE_SUCCESS != rc || NULL == module) {
  65             opal_output_verbose(5, orte_rtc_base_framework.framework_output,
  66                                 "mca:rtc:select: Skipping component [%s]. Query failed to return a module",
  67                                 component->mca_component_name );
  68             continue;
  69         }
  70         nmodule = (orte_rtc_base_module_t*) module;
  71 
  72         
  73         if (NULL != nmodule->init) {
  74             if (ORTE_SUCCESS != (rc = nmodule->init())) {
  75                 opal_output_verbose(5, orte_rtc_base_framework.framework_output,
  76                                     "mca:rtc:select: Skipping component [%s]. Failed to init",
  77                                     component->mca_component_name );
  78                 continue;
  79             }
  80         }
  81 
  82         
  83         newmodule = OBJ_NEW(orte_rtc_base_selected_module_t);
  84         newmodule->pri = priority;
  85         newmodule->module = nmodule;
  86         newmodule->component = component;
  87 
  88         
  89         inserted = false;
  90         OPAL_LIST_FOREACH(mod, &orte_rtc_base.actives, orte_rtc_base_selected_module_t) {
  91             if (priority > mod->pri) {
  92                 opal_list_insert_pos(&orte_rtc_base.actives,
  93                                      (opal_list_item_t*)mod, &newmodule->super);
  94                 inserted = true;
  95                 break;
  96             }
  97         }
  98         if (!inserted) {
  99             
 100             opal_list_append(&orte_rtc_base.actives, &newmodule->super);
 101         }
 102     }
 103 
 104     if (4 < opal_output_get_verbosity(orte_rtc_base_framework.framework_output)) {
 105         opal_output(0, "%s: Final RTC priorities", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 106         
 107         OPAL_LIST_FOREACH(mod, &orte_rtc_base.actives, orte_rtc_base_selected_module_t) {
 108             opal_output(0, "\tModule: %s Priority: %d", mod->component->mca_component_name, mod->pri);
 109         }
 110     }
 111 
 112     return ORTE_SUCCESS;
 113 }