Skip to content

Commit 7783498

Browse files
authored
Merge pull request #610 from DARMA-tasking/609-add-latest-changes-to-main
#609: add latest changes to master
2 parents b495695 + 576c468 commit 7783498

20 files changed

+435
-175
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: 4 additions & 3 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

@@ -20,12 +21,12 @@ algorithm:
2021
name: InformAndTransfer
2122
phase_id: 0
2223
parameters:
23-
n_iterations: 8
24-
n_rounds: 4
24+
n_iterations: 4
25+
n_rounds: 3
2526
fanout: 4
2627
order_strategy: arbitrary
2728
transfer_strategy: Clustering
28-
max_subclusters: 10
29+
max_subclusters: 0
2930
cluster_swap_rtol: 0.05
3031
criterion: Tempered
3132
max_objects_per_transfer: 500

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/lbsClusteringTransferStrategy.py

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def __init__(self, criterion, parameters: dict, lgr: Logger):
7676
self._logger.info(
7777
f"Percentage of maximum load required for subclustering: {self.__subclustering_threshold}")
7878

79-
# Initialize fraction of local imbalance that must be resolved by subcluster
79+
# Initialize fraction of local imbalance to be resolved by subcluster
8080
self.__subclustering_minimum_improvement = parameters.get("subclustering_minimum_improvement", 0.0)
8181
self._logger.info(
82-
"Fraction of local imbalance that must be resolved by subcluster: "
82+
"Local imbalance fraction to be resolved by subcluster: "
8383
f"{self.__subclustering_minimum_improvement}")
8484

8585
# Initialize cluster swap relative threshold
@@ -201,7 +201,7 @@ def __swap_clusters(self, phase: Phase, r_src: Rank, clusters_src:dict, targets:
201201
self._n_rejects += len(o_src) + len(o_try)
202202

203203
# Return number of swaps performed from rank
204-
n_rank_swaps = 0
204+
return n_rank_swaps
205205

206206
def __transfer_subclusters(self, phase: Phase, r_src: Rank, targets: set, ave_load: float, max_load: float) -> None:
207207
"""Perform feasible subcluster transfers from given rank to possible targets."""
@@ -257,16 +257,13 @@ def execute(self, known_peers, phase: Phase, ave_load: float, max_load: float):
257257
rank_targets = self._get_ranks_to_traverse(phase.get_ranks(), known_peers)
258258

259259
# Iterate over ranks
260+
n_ranks = len(phase.get_ranks())
260261
for r_src, targets in rank_targets.items():
261262
# Cluster migratable objects on source rank
262263
clusters_src = self.__build_rank_clusters(r_src, True)
263264
self._logger.debug(
264265
f"Constructed {len(clusters_src)} migratable clusters on source rank {r_src.get_id()}")
265266

266-
# Skip subclustering for this rank when it must be done later
267-
if self.__separate_subclustering:
268-
continue
269-
270267
# Perform feasible cluster swaps from given rank to possible targets
271268
if (n_rank_swaps := self.__swap_clusters(phase, r_src, clusters_src, targets)):
272269
# Report on swaps when some occurred
@@ -280,30 +277,36 @@ def execute(self, known_peers, phase: Phase, ave_load: float, max_load: float):
280277
continue
281278

282279
# Perform feasible subcluster swaps from given rank to possible targets
283-
if self.__max_subclusters > 0:
284-
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)
280+
if not self.__separate_subclustering:
281+
if self.__max_subclusters > 0:
282+
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)
283+
else:
284+
self.__n_sub_skipped += 1
285285

286286
# Report on new load and exit from rank
287287
self._logger.debug(
288288
f"Rank {r_src.get_id()} load: {r_src.get_load()} after {self._n_transfers} object transfers")
289289

290290
# Perform subclustering when it was not previously done
291-
if self.__max_subclusters > 0 and self.__separate_subclustering:
292-
# In non-deterministic case skip subclustering when swaps passed
293-
if self.__n_swaps and not self._deterministic_transfer:
294-
self.__n_sub_skipped += len(rank_targets)
291+
if self.__separate_subclustering:
292+
if self.__max_subclusters > 0:
293+
# In non-deterministic case skip subclustering when swaps passed
294+
if self.__n_swaps and not self._deterministic_transfer:
295+
self.__n_sub_skipped = n_ranks
296+
else:
297+
# Iterate over ranks
298+
for r_src, targets in rank_targets.items():
299+
# Perform feasible subcluster swaps from given rank to possible targets
300+
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)
301+
302+
# Report on new load and exit from rank
303+
self._logger.debug(
304+
f"Rank {r_src.get_id()} load: {r_src.get_load()} after {self._n_transfers} object transfers")
295305
else:
296-
# Iterate over ranks
297-
for r_src, targets in rank_targets.items():
298-
# Perform feasible subcluster swaps from given rank to possible targets
299-
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)
300-
301-
# Report on new load and exit from rank
302-
self._logger.debug(
303-
f"Rank {r_src.get_id()} load: {r_src.get_load()} after {self._n_transfers} object transfers")
306+
# Subclustering is skipped altogether for all ranks
307+
self.__n_sub_skipped = n_ranks
304308

305309
# Report on global transfer statistics
306-
n_ranks = len(phase.get_ranks())
307310
self._logger.info(
308311
f"Swapped {self.__n_swaps} cluster pairs amongst {self.__n_swap_tries} tries "
309312
f"({100 * self.__n_swaps / self.__n_swap_tries:.2f}%)")

0 commit comments

Comments
 (0)