Skip to content

Commit 7c11011

Browse files
committed
odls/base: fix support for PMIx < v2.1
wrap opal_pmix.get() around opal_pmix.legacy_get() to support previous PMIx releases. Signed-off-by: Gilles Gouaillardet <[email protected]> (back-ported from commit open-mpi/ompi@4f1cb47)
1 parent 71764ef commit 7c11011

File tree

1 file changed

+90
-43
lines changed

1 file changed

+90
-43
lines changed

orte/mca/odls/base/odls_base_default_fns.c

Lines changed: 90 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* All rights reserved.
1616
* Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved
1717
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
18-
* Copyright (c) 2014-2017 Research Organization for Information Science
19-
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2014-2018 Research Organization for Information Science
19+
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
2121
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2222
* $COPYRIGHT$
@@ -169,38 +169,60 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
169169
wireup = OBJ_NEW(opal_buffer_t);
170170
/* always include data for mpirun as the daemons can't have it yet */
171171
val = NULL;
172-
if (OPAL_SUCCESS != (rc = opal_pmix.get(ORTE_PROC_MY_NAME, NULL, NULL, &val)) || NULL == val) {
173-
ORTE_ERROR_LOG(rc);
174-
OBJ_RELEASE(wireup);
175-
return rc;
176-
} else {
177-
/* the data is returned as a list of key-value pairs in the opal_value_t */
178-
if (OPAL_PTR != val->type) {
179-
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
180-
OBJ_RELEASE(wireup);
181-
return ORTE_ERR_NOT_FOUND;
182-
}
183-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) {
172+
if (opal_pmix.legacy_get()) {
173+
if (OPAL_SUCCESS != (rc = opal_pmix.get(ORTE_PROC_MY_NAME, OPAL_PMIX_PROC_URI, NULL, &val)) || NULL == val) {
184174
ORTE_ERROR_LOG(rc);
185175
OBJ_RELEASE(wireup);
186176
return rc;
177+
} else {
178+
/* pack the name of the daemon */
179+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) {
180+
ORTE_ERROR_LOG(rc);
181+
OBJ_RELEASE(wireup);
182+
return rc;
183+
}
184+
/* pack the URI */
185+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &val->data.string, 1, OPAL_STRING))) {
186+
ORTE_ERROR_LOG(rc);
187+
OBJ_RELEASE(wireup);
188+
return rc;
189+
}
190+
OBJ_RELEASE(val);
187191
}
188-
modex = (opal_list_t*)val->data.ptr;
189-
numbytes = (int32_t)opal_list_get_size(modex);
190-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &numbytes, 1, OPAL_INT32))) {
192+
} else {
193+
if (OPAL_SUCCESS != (rc = opal_pmix.get(ORTE_PROC_MY_NAME, NULL, NULL, &val)) || NULL == val) {
191194
ORTE_ERROR_LOG(rc);
192195
OBJ_RELEASE(wireup);
193196
return rc;
194-
}
195-
OPAL_LIST_FOREACH(kv, modex, opal_value_t) {
196-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &kv, 1, OPAL_VALUE))) {
197+
} else {
198+
/* the data is returned as a list of key-value pairs in the opal_value_t */
199+
if (OPAL_PTR != val->type) {
200+
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
201+
OBJ_RELEASE(wireup);
202+
return ORTE_ERR_NOT_FOUND;
203+
}
204+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) {
205+
ORTE_ERROR_LOG(rc);
206+
OBJ_RELEASE(wireup);
207+
return rc;
208+
}
209+
modex = (opal_list_t*)val->data.ptr;
210+
numbytes = (int32_t)opal_list_get_size(modex);
211+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &numbytes, 1, OPAL_INT32))) {
197212
ORTE_ERROR_LOG(rc);
198213
OBJ_RELEASE(wireup);
199214
return rc;
200215
}
216+
OPAL_LIST_FOREACH(kv, modex, opal_value_t) {
217+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &kv, 1, OPAL_VALUE))) {
218+
ORTE_ERROR_LOG(rc);
219+
OBJ_RELEASE(wireup);
220+
return rc;
221+
}
222+
}
223+
OPAL_LIST_RELEASE(modex);
224+
OBJ_RELEASE(val);
201225
}
202-
OPAL_LIST_RELEASE(modex);
203-
OBJ_RELEASE(val);
204226
}
205227
/* if we didn't rollup the connection info, then we have
206228
* to provide a complete map of connection info */
@@ -210,41 +232,66 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
210232
continue;
211233
}
212234
val = NULL;
213-
if (OPAL_SUCCESS != (rc = opal_pmix.get(&dmn->name, NULL, NULL, &val)) || NULL == val) {
214-
ORTE_ERROR_LOG(rc);
215-
OBJ_RELEASE(buffer);
216-
return rc;
217-
} else {
218-
/* the data is returned as a list of key-value pairs in the opal_value_t */
219-
if (OPAL_PTR != val->type) {
220-
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
221-
OBJ_RELEASE(buffer);
222-
return ORTE_ERR_NOT_FOUND;
223-
}
224-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &dmn->name, 1, ORTE_NAME))) {
235+
if (opal_pmix.legacy_get()) {
236+
if (OPAL_SUCCESS != (rc = opal_pmix.get(&dmn->name, OPAL_PMIX_PROC_URI, NULL, &val)) || NULL == val) {
225237
ORTE_ERROR_LOG(rc);
226238
OBJ_RELEASE(buffer);
227239
OBJ_RELEASE(wireup);
228240
return rc;
241+
} else {
242+
/* pack the name of the daemon */
243+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &dmn->name, 1, ORTE_NAME))) {
244+
ORTE_ERROR_LOG(rc);
245+
OBJ_RELEASE(buffer);
246+
OBJ_RELEASE(wireup);
247+
return rc;
248+
}
249+
/* pack the URI */
250+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &val->data.string, 1, OPAL_STRING))) {
251+
ORTE_ERROR_LOG(rc);
252+
OBJ_RELEASE(buffer);
253+
OBJ_RELEASE(wireup);
254+
return rc;
255+
}
256+
OBJ_RELEASE(val);
229257
}
230-
modex = (opal_list_t*)val->data.ptr;
231-
numbytes = (int32_t)opal_list_get_size(modex);
232-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &numbytes, 1, OPAL_INT32))) {
258+
} else {
259+
if (OPAL_SUCCESS != (rc = opal_pmix.get(&dmn->name, NULL, NULL, &val)) || NULL == val) {
233260
ORTE_ERROR_LOG(rc);
234261
OBJ_RELEASE(buffer);
235-
OBJ_RELEASE(wireup);
236262
return rc;
237-
}
238-
OPAL_LIST_FOREACH(kv, modex, opal_value_t) {
239-
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &kv, 1, OPAL_VALUE))) {
263+
} else {
264+
/* the data is returned as a list of key-value pairs in the opal_value_t */
265+
if (OPAL_PTR != val->type) {
266+
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
267+
OBJ_RELEASE(buffer);
268+
return ORTE_ERR_NOT_FOUND;
269+
}
270+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &dmn->name, 1, ORTE_NAME))) {
240271
ORTE_ERROR_LOG(rc);
241272
OBJ_RELEASE(buffer);
242273
OBJ_RELEASE(wireup);
243274
return rc;
244275
}
276+
modex = (opal_list_t*)val->data.ptr;
277+
numbytes = (int32_t)opal_list_get_size(modex);
278+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &numbytes, 1, OPAL_INT32))) {
279+
ORTE_ERROR_LOG(rc);
280+
OBJ_RELEASE(buffer);
281+
OBJ_RELEASE(wireup);
282+
return rc;
283+
}
284+
OPAL_LIST_FOREACH(kv, modex, opal_value_t) {
285+
if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &kv, 1, OPAL_VALUE))) {
286+
ORTE_ERROR_LOG(rc);
287+
OBJ_RELEASE(buffer);
288+
OBJ_RELEASE(wireup);
289+
return rc;
290+
}
291+
}
292+
OPAL_LIST_RELEASE(modex);
293+
OBJ_RELEASE(val);
245294
}
246-
OPAL_LIST_RELEASE(modex);
247-
OBJ_RELEASE(val);
248295
}
249296
}
250297
}

0 commit comments

Comments
 (0)