Skip to content

Commit

Permalink
psets: fix some problems with PMIX_QUERY_PSET_MEMBERSHIP
Browse files Browse the repository at this point in the history
query.

Related to open-mpi/ompi#10862

Signed-off-by: Howard Pritchard <[email protected]>
(cherry picked from commit 5cb219c)
  • Loading branch information
hppritcha authored and rhc54 committed Jan 11, 2024
1 parent 0919656 commit 9010542
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/prted/pmix/pmix_server_queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 IBM Corporation. All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* Copyright (c) 2024 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -624,11 +626,12 @@ static void _query(int sd, short args, void *cbdata)
ret = PMIX_ERR_NOT_FOUND;
goto done;
}
/* define the array that holds the membership - no need to allocate anything */
/* define the array that holds the membership - no need to allocate anything if we are careful */
dry.array = psptr->members;
dry.type = PMIX_PROC_RANK;
dry.type = PMIX_PROC;
dry.size = psptr->num_members;
PMIX_INFO_LIST_ADD(rc, results, PMIX_QUERY_PSET_MEMBERSHIP, &dry, PMIX_DATA_ARRAY);
dry.array = NULL; /* say no to array destructor freeing the pset members array */
PMIX_DATA_ARRAY_DESTRUCT(&dry);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
Expand Down
5 changes: 5 additions & 0 deletions src/prted/pmix/pmix_server_register_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2020 IBM Corporation. All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* Copyright (c) 2024 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -422,12 +424,15 @@ int prte_pmix_server_register_nspace(prte_job_t *jdata)
pmix_list_append(&members, &nm->super);
}
}
pset->num_members = pmix_list_get_size(&members);
if (0 < (i = pmix_list_get_size(&members))) {
PMIX_DATA_ARRAY_CONSTRUCT(&darray, i, PMIX_PROC);
procptr = (pmix_proc_t*)darray.array;
k = 0;
pset->members = (pmix_proc_t *)malloc(i * sizeof (pmix_proc_t));
PMIX_LIST_FOREACH(nm, &members, prte_namelist_t) {
PMIX_LOAD_PROCID(&procptr[k], nm->name.nspace, nm->name.rank);
PMIX_LOAD_PROCID(&pset->members[k], nm->name.nspace, nm->name.rank);
++k;
}
PMIX_INFO_LIST_ADD(ret, iarray, PMIX_PSET_MEMBERS, &darray, PMIX_DATA_ARRAY);
Expand Down

0 comments on commit 9010542

Please sign in to comment.