Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regenerate option for applications #106

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Example for a config file:

application:
config:
regenerate:
- False
nodes:
- 3
name: TSP
Expand All @@ -169,6 +171,11 @@ Example for a config file:

One handy thing to do is to use the interactive mode once to create a config file.
Then you can change the values of this config file and use it to start the framework.
The ``regenerate`` key can be set for every application and defines whether you want to regenerate the application
instance for every repetition. When this key is missing, the default value is ``True``. This option can be handy if you
are using random seeds in the creation of the application instance and you want to have the same instance for every
repetition. If you want to change the default behavior for your application, you have to add the ``regenerate`` key to
your ``get_parameter_options`` function.


Run as Container
Expand Down
9 changes: 6 additions & 3 deletions src/BenchmarkManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
comm = get_comm()



class BenchmarkManager:
"""
The benchmark manager is the main component of QUARK, orchestrating the overall benchmarking process.
Expand Down Expand Up @@ -133,6 +132,9 @@ def run_benchmark(self, benchmark_backlog: list, repetitions: int):
Path(path).mkdir(parents=True, exist_ok=True)
with open(f"{path}/application_config.json", 'w') as filehandler:
json.dump(backlog_item["config"], filehandler, indent=2)

problem = None
preprocessing_time = None
for i in range(1, repetitions + 1):
logging.info(f"Running backlog item {idx_backlog + 1}/{len(benchmark_backlog)},"
f" Iteration {i}/{repetitions}:")
Expand All @@ -143,8 +145,9 @@ def run_benchmark(self, benchmark_backlog: list, repetitions: int):
git_revision_number, git_uncommitted_changes,
i, repetitions)
self.application.metrics.set_module_config(backlog_item["config"])
problem, preprocessing_time = self.application.preprocess(None, backlog_item["config"],
store_dir=path, rep_count=i)
if problem is None or backlog_item["config"].get("regenerate", True):
problem, preprocessing_time = self.application.preprocess(None, backlog_item["config"],
store_dir=path, rep_count=i)
self.application.metrics.set_preprocessing_time(preprocessing_time)
self.application.save(path, i)

Expand Down
3 changes: 3 additions & 0 deletions tests/configs/valid/TSP.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
application:
config:
regenerate:
- True
- False
nodes:
- 6
name: TSP
Expand Down
Loading