Skip to content

Commit

Permalink
Some birds aren't meant to be caged there features are just too bright (
Browse files Browse the repository at this point in the history
#77)

* added setup function

Signed-off-by: Asish Kumar <[email protected]>

* refactor geometry calculate distances

Signed-off-by: Asish Kumar <[email protected]>

* Refactor montecarlo estimators in benchmark code

Signed-off-by: Asish Kumar <[email protected]>

* add cache and setup functions

Signed-off-by: Asish Kumar <[email protected]>

* add cache and setup functions

Signed-off-by: Asish Kumar <[email protected]>

* ran ruff linter

Signed-off-by: Asish Kumar <[email protected]>

* Thou hath vanquished the redundant variables and functions

Signed-off-by: Asish Kumar <[email protected]>

* fix bugs

Signed-off-by: Asish Kumar <[email protected]>

* change benchmark yml

Signed-off-by: Asish Kumar <[email protected]>

* repeat in class

Signed-off-by: Asish Kumar <[email protected]>

* Benchmark run_tardis with track_rpacket enabled (tardis-sn#2720)

* Benchmark run_tardis with track_rpacket enabled

* Update config to resemble time_run_tardis config

* Fix Benchmark error

* Cache Benchmark Property

* Remove Cached Property decorator

* rounds in benchmarks

Signed-off-by: Asish Kumar <[email protected]>

* fix

Signed-off-by: Asish Kumar <[email protected]>

---------

Signed-off-by: Asish Kumar <[email protected]>
Co-authored-by: Sumit Gupta <[email protected]>
  • Loading branch information
officialasishkumar and Sumit112192 authored Jul 31, 2024
1 parent 9255013 commit da0429d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
if: github.event_name != 'pull_request_target'
run: |
git log -n 4 --pretty=format:"%H" >> tag_commits.txt
asv run -a rounds=1 HASHFILE:tag_commits.txt | tee asv-output.log
asv run -a rounds=1 HASHFILE:tag_commits.txt | tee asv-output.log
if grep -q failed asv-output.log; then
echo "Some benchmarks have failed!"
exit 1
Expand Down
22 changes: 20 additions & 2 deletions benchmarks/benchmark_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from tardis import run_tardis
from tardis.io.atom_data import AtomData
from tardis.io.configuration.config_reader import Configuration
from tardis.io.util import YAMLLoader, yaml_load_file
from tardis.model.geometry.radial1d import NumbaRadial1DGeometry
from tardis.simulation import Simulation
from tardis.tests.fixtures.atom_data import DEFAULT_ATOM_DATA_UUID
Expand Down Expand Up @@ -40,12 +41,29 @@ def get_absolute_path(self, partial_path):

return self.get_relative_path(partial_path)

@property
def tardis_config_verysimple(self):
filename = self.get_absolute_path(
"tardis/io/configuration/tests/data/tardis_configv1_verysimple.yml"
)
return yaml_load_file(
filename,
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
return config

@property
def tardis_ref_path(self):
ref_data_path = Path(
Path(__file__).parent.parent,
"benchmarks",
"data", # remind me to change it
"tardis-refdata"
).resolve()
return ref_data_path

Expand Down
8 changes: 7 additions & 1 deletion benchmarks/run_tardis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tardis import run_tardis
from tardis.io.atom_data import AtomData


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

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

0 comments on commit da0429d

Please sign in to comment.