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

Benchmark run_tardis with track_rpacket enabled #2720

Merged
merged 5 commits into from
Jul 31, 2024
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
8 changes: 8 additions & 0 deletions benchmarks/benchmark_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def tardis_config_verysimple(self):
YAMLLoader,
)

@property
def config_rpacket_tracking(self):
config = Configuration.from_yaml(
f"{self.example_configuration_dir}/tardis_configv1_verysimple.yml"
)
config.montecarlo.tracking.track_rpacket = True
Copy link
Contributor Author

@Sumit112192 Sumit112192 Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only changing the track_rpacket to True and keeping everything else the same, so it can be checked how much the simulation takes extra with tracking enabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this function decorator to @functools.cached_property? You will need to import functools library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

return config

@property
def tardis_ref_path(self):
# TODO: This route is fixed but needs to get from the arguments given in the command line.
Expand Down
8 changes: 8 additions & 0 deletions benchmarks/run_tardis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from benchmarks.benchmark_base import BenchmarkBase
from tardis import run_tardis


class BenchmarkRunTardis(BenchmarkBase):
"""
Class to benchmark the `run tardis` function.
Expand All @@ -16,3 +17,10 @@ def time_run_tardis(self):
atom_data=self.atomic_dataset,
show_convergence_plots=False,
)

def time_run_tardis_rpacket_tracking(self):
run_tardis(
self.config_rpacket_tracking,
atom_data=self.atomic_dataset,
show_convergence_plots=False,
)
Loading