This source file includes following definitions.
- pmix_pshmem_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
28 #include "src/mca/pshmem/base/base.h"
29
30 static bool selected = false;
31
32
33
34 int pmix_pshmem_base_select(void)
35 {
36 pmix_mca_base_component_list_item_t *cli;
37 pmix_mca_base_component_t *component;
38 pmix_mca_base_module_t *module;
39 pmix_pshmem_base_module_t *nmodule;
40 int rc, priority, best_pri = -1;
41 bool inserted = false;
42
43 if (selected) {
44
45 return PMIX_SUCCESS;
46 }
47 selected = true;
48
49
50 PMIX_LIST_FOREACH(cli, &pmix_pshmem_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
51 component = (pmix_mca_base_component_t *) cli->cli_component;
52
53 pmix_output_verbose(5, pmix_pshmem_base_framework.framework_output,
54 "mca:pshmem:select: checking available component %s", component->pmix_mca_component_name);
55
56
57 if (NULL == component->pmix_mca_query_component) {
58 pmix_output_verbose(5, pmix_pshmem_base_framework.framework_output,
59 "mca:pshmem:select: Skipping component [%s]. It does not implement a query function",
60 component->pmix_mca_component_name );
61 continue;
62 }
63
64
65 pmix_output_verbose(5, pmix_pshmem_base_framework.framework_output,
66 "mca:pshmem:select: Querying component [%s]",
67 component->pmix_mca_component_name);
68 rc = component->pmix_mca_query_component(&module, &priority);
69
70
71 if (PMIX_SUCCESS != rc || NULL == module) {
72 pmix_output_verbose(5, pmix_pshmem_base_framework.framework_output,
73 "mca:pshmem:select: Skipping component [%s]. Query failed to return a module",
74 component->pmix_mca_component_name );
75 continue;
76 }
77
78
79 nmodule = (pmix_pshmem_base_module_t*) module;
80 if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) {
81 continue;
82 }
83
84
85 if (best_pri < priority) {
86 best_pri = priority;
87
88 if (NULL != pmix_pshmem.finalize) {
89 pmix_pshmem.finalize();
90 }
91 pmix_pshmem = *nmodule;
92 inserted = true;
93 }
94 }
95
96 if (!inserted) {
97 return PMIX_ERR_NOT_FOUND;
98 }
99 return PMIX_SUCCESS;
100 }