Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/synthetic-blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ algorithm:
n_rounds: 2
fanout: 2
order_strategy: arbitrary
transfer_strategy: Recursive
transfer_strategy: Clustering
max_subclusters: 4
criterion: Tempered
max_objects_per_transfer: 8
deterministic_transfer: true
Expand Down
5 changes: 3 additions & 2 deletions src/lbaf/Execution/lbsClusteringTransferStrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,15 @@ def execute(self, known_peers, phase: Phase, ave_load: float, max_load: float):
continue

# Perform feasible subcluster swaps from given rank to possible targets
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)
if self.__max_subclusters > 0:
self.__transfer_subclusters(phase, r_src, targets, ave_load, max_load)

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

# Perform subclustering when it was not previously done
if self.__separate_subclustering:
if self.__max_subclusters > 0 and self.__separate_subclustering:
# In non-deterministic case skip subclustering when swaps passed
if self.__n_swaps and not self._deterministic_transfer:
self.__n_sub_skipped += len(rank_targets)
Expand Down
4 changes: 2 additions & 2 deletions src/lbaf/IO/lbsConfigurationValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def __init__(self, config_to_validate: dict, logger: Logger):
error="Should be of type 'float' and > 0.0"),
Optional("max_subclusters"): And(
int,
lambda x: x > 0.0,
error="Should be of type 'int' and > 0"),
lambda x: x >= 0,
error="Should be of type 'int' and >= 0"),
Optional("separate_subclustering"): bool,
"criterion": And(
str,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/IO/test_configuration_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,15 @@ def test_config_validator_wrong_max_subclusters_type(self):
configuration = yaml.safe_load(yaml_str)
with self.assertRaises(SchemaError) as err:
ConfigurationValidator(config_to_validate=configuration, logger=get_logger()).main()
self.assertEqual(err.exception.args[0], "Should be of type 'int' and > 0")
self.assertEqual(err.exception.args[0], "Should be of type 'int' and >= 0")

def test_config_validator_wrong_max_subclusters_mag(self):
with open(os.path.join(self.config_dir, "conf_wrong_max_subclusters_mag.yml"), "rt", encoding="utf-8") as config_file:
yaml_str = config_file.read()
configuration = yaml.safe_load(yaml_str)
with self.assertRaises(SchemaError) as err:
ConfigurationValidator(config_to_validate=configuration, logger=get_logger()).main()
self.assertEqual(err.exception.args[0], "Should be of type 'int' and > 0")
self.assertEqual(err.exception.args[0], "Should be of type 'int' and >= 0")

def test_config_validator_wrong_separate_subclustering(self):
with open(os.path.join(self.config_dir, "conf_wrong_separate_subclustering.yml"), "rt", encoding="utf-8") as config_file:
Expand Down
Loading