This source file includes following definitions.
- orte_oob_base_select
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "orte_config.h"
24 #include "orte/constants.h"
25
26 #include <stdio.h>
27 #include <string.h>
28
29 #include "orte/mca/mca.h"
30 #include "opal/util/output.h"
31 #include "opal/mca/base/base.h"
32
33 #include "orte/util/show_help.h"
34
35 #include "orte/runtime/orte_globals.h"
36 #include "orte/mca/oob/oob.h"
37 #include "orte/mca/oob/base/base.h"
38
39
40
41
42
43
44
45
46 int orte_oob_base_select(void)
47 {
48 mca_base_component_list_item_t *cli, *cmp, *c2;
49 mca_oob_base_component_t *component, *c3;
50 bool added;
51 int i, rc;
52
53
54 OPAL_LIST_FOREACH(cli, &orte_oob_base_framework.framework_components, mca_base_component_list_item_t) {
55 component = (mca_oob_base_component_t *) cli->cli_component;
56
57 opal_output_verbose(5, orte_oob_base_framework.framework_output,
58 "mca:oob:select: checking available component %s",
59 component->oob_base.mca_component_name);
60
61
62 if (NULL == component->available) {
63 opal_output_verbose(5, orte_oob_base_framework.framework_output,
64 "mca:oob:select: Skipping component [%s]. It does not implement a query function",
65 component->oob_base.mca_component_name );
66 continue;
67 }
68
69
70 opal_output_verbose(5, orte_oob_base_framework.framework_output,
71 "mca:oob:select: Querying component [%s]",
72 component->oob_base.mca_component_name);
73
74 rc = component->available();
75
76
77
78
79 if (ORTE_SUCCESS != rc && ORTE_ERR_FORCE_SELECT != rc) {
80 opal_output_verbose(5, orte_oob_base_framework.framework_output,
81 "mca:oob:select: Skipping component [%s] - no available interfaces",
82 component->oob_base.mca_component_name );
83 continue;
84 }
85
86
87 if (ORTE_SUCCESS != component->startup()) {
88 opal_output_verbose(5, orte_oob_base_framework.framework_output,
89 "mca:oob:select: Skipping component [%s] - failed to startup",
90 component->oob_base.mca_component_name );
91 continue;
92 }
93
94 if (ORTE_ERR_FORCE_SELECT == rc) {
95
96
97 while (NULL != (cmp = (mca_base_component_list_item_t*)opal_list_remove_first(&orte_oob_base.actives))) {
98 c3 = (mca_oob_base_component_t *) cmp->cli_component;
99 if (NULL != c3->shutdown) {
100 c3->shutdown();
101 }
102 OBJ_RELEASE(cmp);
103 }
104 c2 = OBJ_NEW(mca_base_component_list_item_t);
105 c2->cli_component = (mca_base_component_t*)component;
106 opal_list_append(&orte_oob_base.actives, &c2->super);
107 break;
108 }
109
110
111 added = false;
112 OPAL_LIST_FOREACH(cmp, &orte_oob_base.actives, mca_base_component_list_item_t) {
113 c3 = (mca_oob_base_component_t *) cmp->cli_component;
114 if (c3->priority > component->priority) {
115 continue;
116 }
117 opal_output_verbose(5, orte_oob_base_framework.framework_output,
118 "mca:oob:select: Inserting component");
119 c2 = OBJ_NEW(mca_base_component_list_item_t);
120 c2->cli_component = (mca_base_component_t*)component;
121 opal_list_insert_pos(&orte_oob_base.actives,
122 &cmp->super, &c2->super);
123 added = true;
124 break;
125 }
126 if (!added) {
127
128 opal_output_verbose(5, orte_oob_base_framework.framework_output,
129 "mca:oob:select: Adding component to end");
130 c2 = OBJ_NEW(mca_base_component_list_item_t);
131 c2->cli_component = (mca_base_component_t*)component;
132 opal_list_append(&orte_oob_base.actives, &c2->super);
133 }
134 }
135
136 if (0 == opal_list_get_size(&orte_oob_base.actives) &&
137 !orte_standalone_operation) {
138
139
140 opal_output_verbose(5, orte_oob_base_framework.framework_output,
141 "mca:oob:select: Init failed to return any available transports");
142 orte_show_help("help-oob-base.txt", "no-interfaces-avail", true);
143 return ORTE_ERR_SILENT;
144 }
145
146
147 i=0;
148 OPAL_LIST_FOREACH(cmp, &orte_oob_base.actives, mca_base_component_list_item_t) {
149 c3 = (mca_oob_base_component_t *) cmp->cli_component;
150 c3->idx = i++;
151 }
152
153 opal_output_verbose(5, orte_oob_base_framework.framework_output,
154 "mca:oob:select: Found %d active transports",
155 (int)opal_list_get_size(&orte_oob_base.actives));
156 return ORTE_SUCCESS;
157 }