Skip to content

Commit 2cb628c

Browse files
committed
ompi/communicator: fix cid_base retrieving
Since PMIx_Group_construct() might return multiple results, we must explicitly set cid_base from the info with the PMIX_GROUP_CONTEXT_ID key Thanks Lisandro Dalcin for the report Refs #11593 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent 5d91862 commit 2cb628c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ompi/communicator/comm_cid.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* reserved.
1919
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
2020
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
21-
* Copyright (c) 2014-2016 Research Organization for Information Science
22-
* and Technology (RIST). All rights reserved.
21+
* Copyright (c) 2014-2023 Research Organization for Information Science
22+
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2016 IBM Corporation. All rights reserved.
2424
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
2525
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
@@ -376,8 +376,15 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
376376
goto fn_exit;
377377
}
378378

379-
if (NULL != results) {
380-
PMIX_VALUE_GET_NUMBER(rc, &results[0].value, cid_base, size_t);
379+
for (size_t i=0; i<nresults; i++) {
380+
if (PMIX_CHECK_KEY(&results[i], PMIX_GROUP_CONTEXT_ID)) {
381+
PMIX_VALUE_GET_NUMBER(rc, &results[i].value, cid_base, size_t);
382+
if(PMIX_SUCCESS != rc) {
383+
ret = opal_pmix_convert_status(rc);
384+
goto fn_exit;
385+
}
386+
break;
387+
}
381388
}
382389

383390
rc = PMIx_Group_destruct (tag, NULL, 0);

0 commit comments

Comments
 (0)