Skip to content

Commit

Permalink
#575: qois: fix rank qois
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Dec 24, 2024
1 parent 23fff49 commit 055943d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/lbaf/IO/lbsVTDataWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _json_serializer(self, rank_phases_double) -> str:
}

# JSON can not handle nan so make this ratio -1 when it's not valid
homed_ratio = -1
homed_ratio = -1.0
if not math.isnan(rank_info.get_homed_blocks_ratio()):
homed_ratio = rank_info.get_homed_blocks_ratio()
phase_data["user_defined"]["num_homed_ratio"] = homed_ratio
Expand All @@ -325,9 +325,22 @@ def _json_serializer(self, rank_phases_double) -> str:
if r_id != it_r.get_id():
continue

rank_qois = it_r.get_qois()

# Add task data for current rank in iteration
iteration_data["tasks"] = self.__create_task_data(it_r)

iteration_data["user_defined"] = {
qoi_name: qoi_getter() for qoi_name, qoi_getter in rank_qois.items()
if qoi_name != "homed_blocks_ratio" # omit for now because it might be nan
}

# JSON can not handle nan so make this ratio -1 when it's not valid
homed_ratio = -1.0
if not math.isnan(it_r.get_homed_blocks_ratio()):
homed_ratio = it_r.get_homed_blocks_ratio()
iteration_data["user_defined"]["num_homed_ratio"] = homed_ratio

# Add communication data if present
communications = self.__get_communications(it, it_r)
if communications:
Expand Down
4 changes: 3 additions & 1 deletion src/lbaf/Model/lbsRank.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ def remove_migratable_object(self, o: Object):
@qoi
def get_load(self) -> float:
"""Return total load on rank."""
return sum(o.get_load() for o in self.__migratable_objects.union(self.__sentinel_objects))
val : float = 0.0
val += sum(o.get_load() for o in self.__migratable_objects.union(self.__sentinel_objects))
return val

@qoi
def get_migratable_load(self) -> float:
Expand Down

0 comments on commit 055943d

Please sign in to comment.