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