This source file includes following definitions.
- mca_pml_base_progress
- mca_pml_base_register
- mca_pml_base_finalize
- mca_pml_base_close
- mca_pml_base_open
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "ompi_config.h"
27 #include <stdio.h>
28
29 #include <string.h>
30 #ifdef HAVE_UNISTD_H
31 #include <unistd.h>
32 #endif
33 #include "ompi/mca/mca.h"
34 #include "opal/util/output.h"
35 #include "opal/mca/base/base.h"
36
37
38 #include "ompi/constants.h"
39 #include "ompi/mca/pml/pml.h"
40 #include "ompi/mca/pml/base/base.h"
41 #include "ompi/mca/pml/base/pml_base_request.h"
42
43
44
45
46
47
48
49 #include "ompi/mca/pml/base/static-components.h"
50
51 int mca_pml_base_progress(void)
52 {
53 return OMPI_SUCCESS;
54 }
55
56 #define xstringify(pml) #pml
57 #define stringify(pml) xstringify(pml)
58
59
60
61
62 mca_pml_base_module_t mca_pml = {
63 NULL,
64 NULL,
65 NULL,
66 mca_pml_base_progress,
67 NULL,
68 NULL,
69 NULL,
70 NULL,
71 NULL,
72 NULL,
73 NULL,
74 NULL,
75 NULL,
76 NULL,
77 NULL,
78 NULL,
79 NULL,
80 0,
81 0
82 };
83
84 mca_pml_base_component_t mca_pml_base_selected_component = {{0}};
85 opal_pointer_array_t mca_pml_base_pml = {{0}};
86 char *ompi_pml_base_bsend_allocator_name = NULL;
87
88 #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
89 static char *ompi_pml_base_wrapper = NULL;
90 #endif
91
92 static int mca_pml_base_register(mca_base_register_flag_t flags)
93 {
94 #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
95 int var_id;
96 #endif
97
98 ompi_pml_base_bsend_allocator_name = "basic";
99 (void) mca_base_var_register("ompi", "pml", "base", "bsend_allocator", NULL,
100 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
101 OPAL_INFO_LVL_9,
102 MCA_BASE_VAR_SCOPE_READONLY,
103 &ompi_pml_base_bsend_allocator_name);
104
105 #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1
106 ompi_pml_base_wrapper = NULL;
107 var_id = mca_base_var_register("ompi", "pml", "base", "wrapper",
108 "Use a Wrapper component around the selected PML component",
109 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
110 OPAL_INFO_LVL_9,
111 MCA_BASE_VAR_SCOPE_READONLY,
112 &ompi_pml_base_wrapper);
113 (void) mca_base_var_register_synonym(var_id, "ompi", "pml", NULL, "wrapper", 0);
114 #endif
115
116 return OMPI_SUCCESS;
117 }
118
119 int mca_pml_base_finalize(void) {
120 if (NULL != mca_pml_base_selected_component.pmlm_finalize) {
121 return mca_pml_base_selected_component.pmlm_finalize();
122 }
123 return OMPI_SUCCESS;
124 }
125
126
127 static int mca_pml_base_close(void)
128 {
129 int i, j;
130
131
132 if( NULL != mca_pml.pml_progress ) {
133 opal_progress_unregister(mca_pml.pml_progress);
134 }
135
136
137
138
139
140
141
142
143
144
145 OBJ_DESTRUCT(&mca_pml_base_send_requests);
146 OBJ_DESTRUCT(&mca_pml_base_recv_requests);
147
148 mca_pml.pml_progress = mca_pml_base_progress;
149
150
151 j = opal_pointer_array_get_size(&mca_pml_base_pml);
152 for (i = 0; i < j; ++i) {
153 char *str;
154 str = (char*) opal_pointer_array_get_item(&mca_pml_base_pml, i);
155 free(str);
156 }
157 OBJ_DESTRUCT(&mca_pml_base_pml);
158
159
160 return mca_base_framework_components_close(&ompi_pml_base_framework, NULL);
161 }
162
163
164
165
166
167 static int mca_pml_base_open(mca_base_open_flag_t flags)
168 {
169
170
171
172
173
174
175
176 OBJ_CONSTRUCT(&mca_pml_base_send_requests, opal_free_list_t);
177 OBJ_CONSTRUCT(&mca_pml_base_recv_requests, opal_free_list_t);
178
179 OBJ_CONSTRUCT(&mca_pml_base_pml, opal_pointer_array_t);
180
181
182
183 if (OPAL_SUCCESS !=
184 mca_base_framework_components_open(&ompi_pml_base_framework, flags)) {
185 return OMPI_ERROR;
186 }
187
188
189
190
191 mca_pml_base_selected_component.pmlm_finalize = NULL;
192
193
194
195
196
197
198
199
200
201 #if MCA_ompi_pml_DIRECT_CALL
202 opal_pointer_array_add(&mca_pml_base_pml,
203 strdup(stringify(MCA_ompi_pml_DIRECT_CALL_COMPONENT)));
204 #else
205 {
206 const char **default_pml = NULL;
207 int var_id;
208
209 var_id = mca_base_var_find("ompi", "pml", NULL, NULL);
210 mca_base_var_get_value(var_id, &default_pml, NULL, NULL);
211
212 if( (NULL == default_pml || NULL == default_pml[0] ||
213 0 == strlen(default_pml[0])) || (default_pml[0][0] == '^') ) {
214 opal_pointer_array_add(&mca_pml_base_pml, strdup("ob1"));
215 opal_pointer_array_add(&mca_pml_base_pml, strdup("yalla"));
216 opal_pointer_array_add(&mca_pml_base_pml, strdup("ucx"));
217 opal_pointer_array_add(&mca_pml_base_pml, strdup("cm"));
218 } else {
219 opal_pointer_array_add(&mca_pml_base_pml, strdup(default_pml[0]));
220 }
221 }
222 #if OPAL_ENABLE_FT_CR == 1
223
224
225
226
227
228 if( NULL != ompi_pml_base_wrapper) {
229 opal_pointer_array_add(&mca_pml_base_pml, ompi_pml_base_wrapper);
230 }
231 #endif
232
233 #endif
234
235 return OMPI_SUCCESS;
236
237 }
238
239 MCA_BASE_FRAMEWORK_DECLARE(ompi, pml, "OMPI PML", mca_pml_base_register,
240 mca_pml_base_open, mca_pml_base_close,
241 mca_pml_base_static_components, 0);