Skip to content

Commit

Permalink
Fix parallel load balancing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaanDesai committed Feb 11, 2025
1 parent 2c61fa9 commit a685a29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions micro_manager/adaptivity/global_adaptivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def _get_ranks_of_sims(self) -> np.ndarray:
Returns
-------
ranks_of_sim : np.ndarray
ranks_of_sims : np.ndarray
Array of ranks on which simulations exist.
"""
local_gids_to_rank = dict()
Expand All @@ -469,9 +469,9 @@ def _get_ranks_of_sims(self) -> np.ndarray:

ranks_maps_as_list = self._comm.allgather(local_gids_to_rank)

ranks_of_sim = np.zeros(self._global_number_of_sims, dtype=np.intc)
ranks_of_sims = np.zeros(self._global_number_of_sims, dtype=np.intc)
for ranks_map in ranks_maps_as_list:
for gid, rank in ranks_map.items():
ranks_of_sim[gid] = rank
ranks_of_sims[gid] = rank

return ranks_of_sim
return ranks_of_sims
6 changes: 3 additions & 3 deletions tests/unit/test_global_adaptivity_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_redistribute_active_sims_four_ranks_two_steps(self):
expected_global_ids = [4, 5, 6, 7, 12]
elif self._rank == 2:
global_ids = [8, 9, 10, 11]
expected_global_ids = [0, 8, 9, 10, 11]
expected_global_ids = [8, 9, 10, 11, 0]
elif self._rank == 3:
global_ids = [12, 13, 14]
expected_global_ids = [13, 14]
Expand Down Expand Up @@ -293,10 +293,10 @@ def test_redistribute_inactive_sims_four_ranks(self):
expected_global_ids = [6, 7, 12]
elif self._rank == 2:
global_ids = [0, 8, 9, 10, 11]
expected_global_ids = [0, 3, 8, 11]
expected_global_ids = [0, 8, 11, 3]
elif self._rank == 3:
global_ids = [13, 14]
expected_global_ids = [5, 13, 14]
expected_global_ids = [13, 14, 5]

expected_ranks_of_sims = [2, 0, 0, 2, 0, 3, 1, 1, 2, 0, 0, 2, 1, 3, 3]

Expand Down

0 comments on commit a685a29

Please sign in to comment.