Skip to content

Commit 576c468

Browse files
ppebaycwschilly
authored andcommitted
#607: Add homing (delta) term (#608)
* #607: added delta everywhere it needs to * #607: updated documentation for delta * #607: updated configs * #607: fixed CI error * #607: completed implementation of homing cost, tested it, created PR608 * #607: fixed incomplete implementation of some stats when delta is non-0 * #607: fixed undefined variable * #607: fixed incorrect variable * #607: added better instrumentation
1 parent da6e89a commit 576c468

16 files changed

+93
-42
lines changed

config/challenging-toy-fewer-tasks.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ work_model:
1212
parameters:
1313
beta: 0.0
1414
gamma: 0.0
15+
delta: 0.0
1516
upper_bounds:
1617
max_memory_usage: 8.0e+9
1718

config/challenging-toy-hundreds-tasks.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ work_model:
1212
parameters:
1313
beta: 0.0
1414
gamma: 0.0
15+
delta: 0.0
1516
upper_bounds:
1617
max_memory_usage: 8000000000.0
1718

config/conf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ work_model:
1111
parameters:
1212
beta: 0.0
1313
gamma: 0.0
14+
delta: 0.0
1415

1516
# Specify algorithm
1617
algorithm:

config/synthetic-blocks.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ work_model:
1212
parameters:
1313
beta: 0.0
1414
gamma: 0.0
15+
delta: 0.1
1516
upper_bounds:
1617
max_memory_usage: 45.0
1718

@@ -44,7 +45,7 @@ visualization:
4445
y_ranks: 2
4546
z_ranks: 1
4647
object_jitter: 0.5
47-
rank_qoi: load
48+
rank_qoi: homing
4849
object_qoi: shared_id
4950
save_meshes: true
5051
force_continuous_object_qoi: true

docs/pages/configuration.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Example configuration
7676
parameters:
7777
beta: 0.
7878
gamma: 0.
79+
delta: 0.
7980
8081
# Specify balancing algorithm
8182
algorithm:

docs/pages/testing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Synthetic Blocks Test Configuration
7070
parameters:
7171
beta: 0.
7272
gamma: 0.
73+
delta: 0.
7374
7475
# Specify balancing algorithm
7576
algorithm:

src/lbaf/Applications/LBAF_app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ def __print_statistics(self, phase: Phase, phase_name: str, work_model: WorkMode
390390
f"{phase_name} node maximum memory usage",
391391
self.__logger)
392392
if r_shared_mem_stats.get_maximum():
393+
lbstats.print_function_statistics(
394+
phase.get_ranks(),
395+
lambda x: x.get_homing(),
396+
f"{phase_name} homing cost",
397+
self.__logger)
393398
lbstats.print_function_statistics(
394399
phase.get_ranks(),
395400
lambda x: x.get_homed_blocks_ratio(),

src/lbaf/Execution/lbsAlgorithmBase.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def __init__(self, work_model: WorkModelBase, parameters: dict, logger: Logger):
9999
self.__statistics = {
100100
("ranks", lambda x: x.get_load()): {
101101
"maximum load": "maximum"},
102+
("ranks", lambda x: self._work_model.compute(x)): {
103+
"maximum work": "maximum"},
102104
("ranks", lambda x: self._work_model.compute(x)): {
103105
"total work": "sum"}}
104106

src/lbaf/Execution/lbsBruteForceAlgorithm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ def execute(self, p_id: int, phases: list, statistics: dict):
7676
n_ranks = len(phase_ranks)
7777
affine_combination = isinstance(
7878
self._work_model, AffineCombinationWorkModel)
79-
alpha, beta, gamma = [
79+
alpha, beta, gamma, delta = [
8080
self._work_model.get_alpha() if affine_combination else 1.0,
8181
self._work_model.get_beta() if affine_combination else 0.0,
82-
self._work_model.get_gamma() if affine_combination else 0.0]
82+
self._work_model.get_gamma() if affine_combination else 0.0,
83+
self._work_model.get_delta() if affine_combination else 0.0]
8384
_n_a, _w_min_max, a_min_max = compute_min_max_arrangements_work(
84-
objects, alpha, beta, gamma, n_ranks,
85+
objects, alpha, beta, gamma, delta, n_ranks,
8586
logger=self._logger)
8687

8788
# Skip object transfers when requested

src/lbaf/Execution/lbsInformAndTransferAlgorithm.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,10 @@ def execute(self, p_id: int, phases: list, statistics: dict):
233233
# Set phase to be used by transfer criterion
234234
self.__transfer_criterion.set_phase(self._rebalanced_phase)
235235

236-
# Retrieve total work from computed statistics
237-
total_work = statistics["total work"][-1]
238-
239236
# Perform requested number of load-balancing iterations
237+
s_name = "maximum work"
240238
for i in range(self.__n_iterations):
241-
self._logger.info(f"Starting iteration {i + 1} with total work of {total_work}")
239+
self._logger.info(f"Starting iteration {i + 1} with {s_name} of {statistics[s_name][-1]:.6g}")
242240

243241
# Time the duration of each iteration
244242
start_time = time.time()

0 commit comments

Comments
 (0)