Skip to content

Commit fc97c06

Browse files
committed
libtaskmap: allow unequal tasks per rank in taskmap_check()
Problem: taskmap_check() treats taskmaps as incompatible if nodes have differing task counts. However, this strict requirement is unnecessary and blocks valid use cases where tasks may need to be redistributed across nodes. Remove the check that tasks per node are equal in the old and new taskmaps in taskmap_check(). Update an expected failure in the unit tests to an expected success.
1 parent 1c825b8 commit fc97c06

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/common/libtaskmap/taskmap.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -973,16 +973,6 @@ int taskmap_check (const struct taskmap *old,
973973
"got %d total tasks, expected %d",
974974
ntasks_new,
975975
ntasks_old);
976-
for (int i = 0; i < nnodes_old; i++) {
977-
ntasks_old = taskmap_ntasks (old, i);
978-
ntasks_new = taskmap_ntasks (new, i);
979-
if (ntasks_old != ntasks_new)
980-
return errprintf (errp,
981-
"node %d has %d tasks, expected %d",
982-
i,
983-
ntasks_new,
984-
ntasks_old);
985-
}
986976
return 0;
987977
}
988978

src/common/libtaskmap/taskmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ int taskmap_nnodes (const struct taskmap *map);
9090
int taskmap_total_ntasks (const struct taskmap *map);
9191

9292
/* Check if 'a' and 'b' taskmaps are compatible, i.e. they
93-
* have equivalent numbers of total tasks, total nodes, and tasks assigned
94-
* to each node.
93+
* have equivalent numbers of total tasks and total nodes.
94+
*
9595
* Returns 0 on success, -1 with error message in 'errp' on failure.
9696
*/
9797
int taskmap_check (const struct taskmap *a,

src/common/libtaskmap/test/taskmap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,11 @@ struct check_test check_tests[] = {
522522
{ "[[0,4,4,1]]", "[[0,4,1,4]]", 0, NULL },
523523
{ "[[0,4,4,1]]", "[[0,4,2,2]]", 0, NULL },
524524
{ "[[0,4,4,1]]", "[[0,4,3,1],[0,4,1,1]]", 0, NULL },
525+
{ "[[0,4,4,1]]", "[[0,2,4,1],[2,1,3,1],[3,1,5,1]]", 0, NULL },
525526
{ "[[0,4,4,1]]", "[[0,4,3,1]]", -1,
526527
"got 12 total tasks, expected 16" },
527528
{ "[[0,4,4,1]]", "[[0,2,8,1]]", -1,
528529
"got 2 nodes, expected 4" },
529-
{ "[[0,4,4,1]]", "[[0,2,4,1],[2,1,3,1],[3,1,5,1]]", -1,
530-
"node 2 has 3 tasks, expected 4" },
531530
{ NULL, NULL, 0, NULL },
532531
};
533532

0 commit comments

Comments
 (0)