Skip to content

Commit

Permalink
test new
Browse files Browse the repository at this point in the history
* 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]>

* fix error in formal integral

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

* more cache

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

* sort by ratio

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

* cache in setup function

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

* changes to me

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 Aug 2, 2024
1 parent 91ee195 commit 4f0ab22
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ jobs:
- name: Run benchmarks for last 4 commits if not PR
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
git log -n 1 --pretty=format:"%H" >> tag_commits.txt
asv run -a rounds=1 HASHFILE:tag_commits.txt --bench transport_montecarlo_single_packet_loop | tee asv-output.log
if grep -q failed asv-output.log; then
echo "Some benchmarks have failed!"
exit 1
Expand Down
1 change: 0 additions & 1 deletion benchmarks/spectrum_formal_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from benchmarks.benchmark_base import BenchmarkBase
from tardis.spectrum import formal_integral

config.THREADING_LAYER = "workqueue"

class BenchmarkTransportMontecarloFormalIntegral(BenchmarkBase):
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/transport_montecarlo_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Basic TARDIS Benchmark.
"""

import functools

import tardis.transport.montecarlo.interaction as interaction
from benchmarks.benchmark_base import BenchmarkBase

Expand All @@ -11,7 +13,7 @@ class BenchmarkTransportMontecarloInteraction(BenchmarkBase):
"""
Class to benchmark the numba interaction function.
"""

repeat = 3

def setup(self):
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/transport_montecarlo_main_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Basic TARDIS Benchmark.
"""

import functools

from benchmarks.benchmark_base import BenchmarkBase
from tardis.transport.montecarlo.montecarlo_main_loop import (
montecarlo_main_loop,
Expand All @@ -15,6 +17,7 @@ class to benchmark montecarlo_main_loop function.

repeat = 3

@functools.cache
def setup(self):
self.packet_collection = self.transport_state.packet_collection
self.geometry_state = self.transport_state.geometry_state
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/transport_montecarlo_packet_trackers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Basic TARDIS Benchmark.
"""
import functools

from asv_runner.benchmarks.mark import parameterize

from benchmarks.benchmark_base import BenchmarkBase
Expand All @@ -15,6 +17,7 @@ class BenchmarkTransportMontecarloPacketTrackers(BenchmarkBase):

repeat = 2

@functools.cache
def setup(self, num_packets, length):
sim = self.simulation_rpacket_tracking_enabled
self.TransportState = sim.transport.transport_state
Expand All @@ -23,7 +26,6 @@ def time_rpacket_trackers_to_dataframe(self, num_packets, length):
packet_trackers.rpacket_trackers_to_dataframe(
self.TransportState.rpacket_tracker
)

def time_generate_rpacket_tracker_list(self, num_packets, length):
packet_trackers.generate_rpacket_tracker_list(num_packets, length)

Expand Down

0 comments on commit 4f0ab22

Please sign in to comment.