This source file includes following definitions.
- pmix_bfrop_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 #include "src/util/error.h"
28 #include "src/util/show_help.h"
29
30 #include "src/mca/bfrops/base/base.h"
31
32 static bool selected = false;
33
34
35
36 int pmix_bfrop_base_select(void)
37 {
38 pmix_mca_base_component_list_item_t *cli = NULL;
39 pmix_mca_base_component_t *component = NULL;
40 pmix_mca_base_module_t *module = NULL;
41 pmix_bfrops_module_t *nmodule;
42 pmix_bfrops_base_active_module_t *newmodule, *mod;
43 int rc, priority;
44 bool inserted;
45
46 if (selected) {
47
48 return PMIX_SUCCESS;
49 }
50 selected = true;
51
52
53 PMIX_LIST_FOREACH(cli, &pmix_bfrops_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
54 component = (pmix_mca_base_component_t *) cli->cli_component;
55
56 pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
57 "mca:bfrops:select: checking available component %s", component->pmix_mca_component_name);
58
59
60 if (NULL == component->pmix_mca_query_component) {
61 pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
62 "mca:bfrops:select: Skipping component [%s]. It does not implement a query function",
63 component->pmix_mca_component_name );
64 continue;
65 }
66
67
68 pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
69 "mca:bfrops:select: Querying component [%s]",
70 component->pmix_mca_component_name);
71 rc = component->pmix_mca_query_component(&module, &priority);
72
73
74 if (PMIX_SUCCESS != rc || NULL == module) {
75 pmix_output_verbose(5, pmix_bfrops_base_framework.framework_output,
76 "mca:bfrops:select: Skipping component [%s]. Query failed to return a module",
77 component->pmix_mca_component_name );
78 continue;
79 }
80 nmodule = (pmix_bfrops_module_t*) module;
81
82
83 if (NULL != nmodule->init) {
84 if (PMIX_SUCCESS != nmodule->init()) {
85
86 continue;
87 }
88 }
89
90
91
92 newmodule = PMIX_NEW(pmix_bfrops_base_active_module_t);
93 newmodule->pri = priority;
94 newmodule->module = nmodule;
95 newmodule->component = (pmix_bfrops_base_component_t*)cli->cli_component;
96
97
98 inserted = false;
99 PMIX_LIST_FOREACH(mod, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
100 if (priority > mod->pri) {
101 pmix_list_insert_pos(&pmix_bfrops_globals.actives,
102 (pmix_list_item_t*)mod, &newmodule->super);
103 inserted = true;
104 break;
105 }
106 }
107 if (!inserted) {
108
109 pmix_list_append(&pmix_bfrops_globals.actives, &newmodule->super);
110 }
111 }
112
113
114 if (0 == pmix_list_get_size(&pmix_bfrops_globals.actives)) {
115 pmix_show_help("help-pmix-runtime.txt", "no-plugins", true, "BFROPS");
116 return PMIX_ERR_SILENT;
117 }
118
119 if (4 < pmix_output_get_verbosity(pmix_bfrops_base_framework.framework_output)) {
120 pmix_output(0, "Final Bfrop priorities");
121
122 PMIX_LIST_FOREACH(mod, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
123 pmix_output(0, "\tBfrop: %s Priority: %d", mod->component->base.pmix_mca_component_name, mod->pri);
124 }
125 }
126
127 return PMIX_SUCCESS;;
128 }