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