Skip to content

Commit 964e1cc

Browse files
committed
dpm: set default rankby order if not specified by caller
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]>
1 parent 1c579e5 commit 964e1cc

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

ompi/dpm/dpm.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* and Technology (RIST). All rights reserved.
2222
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
2323
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
24-
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
24+
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
2525
* reserved.
2626
* Copyright (c) 2022 IBM Corporation. All rights reserved.
2727
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
@@ -852,6 +852,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
852852
#if PMIX_NUMERIC_VERSION >= 0x00040000
853853
const char *checkkey;
854854
#endif
855+
bool found_pmix_rankby_item = false;
855856

856857
/* parse the info object */
857858
/* check potentially for
@@ -1358,6 +1359,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
13581359
/* check for 'rank_by' - job-level key */
13591360
ompi_info_get(array_of_info[i], "rank_by", &info_str, &flag);
13601361
if ( flag ) {
1362+
found_pmix_rankby_item = true;
13611363
rc = dpm_convert(&job_info, "rank_by", PMIX_RANKBY, info_str->string, NULL, false);
13621364
OBJ_RELEASE(info_str);
13631365
if (OMPI_SUCCESS != rc) {
@@ -1369,6 +1371,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
13691371
}
13701372
ompi_info_get(array_of_info[i], "PMIX_RANKBY", &info_str, &flag);
13711373
if ( flag ) {
1374+
found_pmix_rankby_item = true;
13721375
info = OBJ_NEW(opal_info_item_t);
13731376
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
13741377
opal_list_append(&job_info, &info->super);
@@ -1378,13 +1381,13 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
13781381
checkkey = PMIx_Get_attribute_string("PMIX_RANKBY");
13791382
ompi_info_get(array_of_info[i], checkkey, &info_str, &flag);
13801383
if ( flag ) {
1384+
found_pmix_rankby_item = true;
13811385
info = OBJ_NEW(opal_info_item_t);
13821386
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, info_str->string, PMIX_STRING);
13831387
opal_list_append(&job_info, &info->super);
13841388
OBJ_RELEASE(info_str);
13851389
}
13861390
#endif
1387-
13881391
/* check for 'bind_to' - job-level key */
13891392
ompi_info_get(array_of_info[i], "bind_to", &info_str, &flag);
13901393
if ( flag ) {
@@ -1541,6 +1544,18 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
15411544
#endif
15421545
}
15431546

1547+
/*
1548+
* If the application has not specified otherwise, we want to get
1549+
* the behavior of MPI_Comm_spawn_multiple ranking as specified in the
1550+
* Process Creation and Management chapter of the MPI standard.
1551+
* See section 11.8.3 of the MPI 4.1 standard.
1552+
*/
1553+
if (false == found_pmix_rankby_item) {
1554+
info = OBJ_NEW(opal_info_item_t);
1555+
PMIX_INFO_LOAD(&info->info, PMIX_RANKBY, "slot", PMIX_STRING);
1556+
opal_list_append(&job_info, &info->super);
1557+
}
1558+
15441559
/* default value: If the user did not tell us where to look for the
15451560
* executable, we assume the current working directory
15461561
*/

0 commit comments

Comments
 (0)