Skip to content

Commit

Permalink
dpm: set default rankby order if not specified by caller
Browse files Browse the repository at this point in the history
The MPI standard defines a specific mappings of ranks in the MCW
of a set of processes started by MPI_Comm_spawn_multiple to the supplied commands.
See for example section 11.8.3 of the MPI 4.1 standard.

Something changed between orte in OMPI 4.1.x and prtte in OMPI 5 and main
that caused this to not be the default ordering of ranks to commands in
the MPI_Comm_spawn_multiple.  This resulted in the ompi-tests/ibm/dynamic/spawn_multiple
to fail with wrong mapping of arguments to ranks.

So, add a check in the ompi_dpm_spawn to set the PMIX_RANKBY attribute to
"slot" if the app has not specified some other ranking option.

Signed-off-by: Howard Pritchard <[email protected]>
  • Loading branch information
hppritcha committed Jan 13, 2025
1 parent 1c579e5 commit 964e1cc
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2022 IBM Corporation. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
Expand Down Expand Up @@ -852,6 +852,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
#if PMIX_NUMERIC_VERSION >= 0x00040000
const char *checkkey;
#endif
bool found_pmix_rankby_item = false;

/* parse the info object */
/* check potentially for
Expand Down Expand Up @@ -1358,6 +1359,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
/* check for 'rank_by' - job-level key */
ompi_info_get(array_of_info[i], "rank_by", &info_str, &flag);
if ( flag ) {
found_pmix_rankby_item = true;
rc = dpm_convert(&job_info, "rank_by", PMIX_RANKBY, info_str->string, NULL, false);
OBJ_RELEASE(info_str);
if (OMPI_SUCCESS != rc) {
Expand All @@ -1369,6 +1371,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
}
ompi_info_get(array_of_info[i], "PMIX_RANKBY", &info_str, &flag);
if ( flag ) {
found_pmix_rankby_item = true;
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
opal_list_append(&job_info, &info->super);
Expand All @@ -1378,13 +1381,13 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
checkkey = PMIx_Get_attribute_string("PMIX_RANKBY");
ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
if ( flag ) {
found_pmix_rankby_item = true;
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
opal_list_append(&job_info, &info->super);
OBJ_RELEASE(info_str);
}
#endif

/* check for 'bind_to' - job-level key */
ompi_info_get(array_of_info[i], "bind_to", &info_str, &flag);
if ( flag ) {
Expand Down Expand Up @@ -1541,6 +1544,18 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
#endif
}

/*
* If the application has not specified otherwise, we want to get
* the behavior of MPI_Comm_spawn_multiple ranking as specified in the
* Process Creation and Management chapter of the MPI standard.
* See section 11.8.3 of the MPI 4.1 standard.
*/
if (false == found_pmix_rankby_item) {
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, "slot", PMIX_STRING);
opal_list_append(&job_info, &info->super);
}

/* default value: If the user did not tell us where to look for the
* executable, we assume the current working directory
*/
Expand Down

0 comments on commit 964e1cc

Please sign in to comment.