Skip to content

Commit

Permalink
#441: add scalene optimization suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Oct 10, 2023
1 parent 9a9f218 commit b213f5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
18 changes: 6 additions & 12 deletions src/lbaf/Applications/LBAF_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,6 @@ def run(self):
self.__logger, phase_id, reader=reader)
phase.populate_from_log(phase_id)
phases[phase_id] = phase
phase = Phase(
self.__logger, phase_id, reader=reader)
phase.populate_from_log(phase_id)
phases[phase_id] = phase
else:
n_ranks = self.__parameters.n_ranks
phase_id = 0
Expand Down Expand Up @@ -523,7 +519,7 @@ def run(self):
self.__logger.warning(
"No rebalancing took place for offline load-balancing")
else:
# Determine if a phase with same index was present
# Determine if a phase with the same index was present
if _existing_phase := phases.get(p_id := rebalanced_phase.get_id()):
# Apply object timings to rebalanced phase
self.__logger.info(
Expand Down Expand Up @@ -555,13 +551,11 @@ def run(self):
raise SystemExit(1)

# Look for prescribed QOI bounds
qoi_request = [self.__parameters.rank_qoi]
qoi_request.append(
self.__parameters.work_model.get(
"parameters").get(
"upper_bounds", {}).get(
self.__parameters.rank_qoi))
qoi_request.append(self.__parameters.object_qoi)
qoi_request = [
self.__parameters.rank_qoi,
self.__parameters.work_model.get("parameters", {}).get("upper_bounds", {}).get(self.__parameters.rank_qoi),
self.__parameters.object_qoi
]

# Instantiate and execute visualizer
visualizer = Visualizer(
Expand Down
20 changes: 9 additions & 11 deletions src/lbaf/Execution/lbsInformAndTransferAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def execute(self, p_id: int, phases: list, distributions: dict, statistics: dict
# Set phase to be used by transfer criterion
self.__transfer_criterion.set_phase(self._rebalanced_phase)

# Retrieve totat work from computed statistics
# Retrieve total work from computed statistics
total_work = statistics["total work"][-1]

# Perform requested number of load-balancing iterations
Expand Down Expand Up @@ -214,20 +214,19 @@ def execute(self, p_id: int, phases: list, distributions: dict, statistics: dict

# Compute and report iteration work statistics
stats = print_function_statistics(
self._rebalanced_phase.get_ranks(),
lambda x: self._work_model.compute(x), # pylint:disable=W0108:unnecessary-lambda
f"iteration {i + 1} rank work",
self._logger)
self._rebalanced_phase.get_ranks(),
self._work_model.compute,
f"iteration {i + 1} rank work",
self._logger)

# Update run distributions and statistics
self._update_distributions_and_statistics(distributions, statistics)

# Compute current arrangement
arrangement = tuple(
v for _, v in sorted(
{o.get_id(): p.get_id()
for p in self._rebalanced_phase.get_ranks()
for o in p.get_objects()}.items()))
arrangement = tuple(sorted(
{o.get_id(): p.get_id()
for p in self._rebalanced_phase.get_ranks()
for o in p.get_objects()}.values()))
self._logger.debug(f"Iteration {i + 1} arrangement: {arrangement}")

# Report minimum Hamming distance when minimax optimum is available
Expand All @@ -241,7 +240,6 @@ def execute(self, p_id: int, phases: list, distributions: dict, statistics: dict
if stats.statistics["imbalance"] <= self.__target_imbalance:
self._logger.info(f"Reached target imbalance of {self.__target_imbalance} after {i + 1} iterations.")
break
end_time = time.time()

# Calculate the duration of the iteration
end_time = time.time()
Expand Down

0 comments on commit b213f5c

Please sign in to comment.