This source file includes following definitions.
- pmix_psquash_base_select
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include <src/include/pmix_config.h>
22 #include <pmix_common.h>
23
24 #include <string.h>
25
26 #include "src/mca/mca.h"
27 #include "src/mca/base/base.h"
28 #include "src/util/error.h"
29 #include "src/util/show_help.h"
30
31 #include "src/mca/psquash/base/base.h"
32
33 static bool selected = false;
34
35
36
37 int pmix_psquash_base_select(void)
38 {
39 pmix_mca_base_component_list_item_t *cli;
40 pmix_mca_base_component_t *component;
41 pmix_mca_base_module_t *module;
42 pmix_psquash_base_module_t *nmodule;
43 int rc, priority, best_pri = -1;
44 bool inserted = false;
45
46 if (selected) {
47
48 return PMIX_SUCCESS;
49 }
50 selected = true;
51
52
53 PMIX_LIST_FOREACH(cli, &pmix_psquash_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_psquash_base_framework.framework_output,
57 "mca:psquash: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_psquash_base_framework.framework_output,
62 "mca:psquash: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_psquash_base_framework.framework_output,
69 "mca:psquash: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_psquash_base_framework.framework_output,
76 "mca:psquash:select: Skipping component [%s]. Query failed to return a module",
77 component->pmix_mca_component_name );
78 continue;
79 }
80
81
82 nmodule = (pmix_psquash_base_module_t*) module;
83 if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) {
84 continue;
85 }
86
87
88 if (best_pri < priority) {
89 best_pri = priority;
90
91 if (NULL != pmix_psquash.finalize) {
92 pmix_psquash.finalize();
93 }
94 pmix_psquash = *nmodule;
95 inserted = true;
96 }
97 }
98
99 if (!inserted) {
100 return PMIX_ERR_NOT_FOUND;
101 }
102
103 return PMIX_SUCCESS;;
104 }