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