Skip to content

Commit

Permalink
Benchmark fix for github actions (tardis-sn#2702)
Browse files Browse the repository at this point in the history
fix benchmark

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
  • Loading branch information
officialasishkumar authored and sarthak-dv committed Jul 16, 2024
1 parent bdd1b4b commit d8bbb8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
11 changes: 5 additions & 6 deletions benchmarks/run_tardis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ class BenchmarkRunTardis(BenchmarkBase):
Class to benchmark the `run tardis` function.
"""

def __init__(self):
super().__init__()
filename = "data/tardis_configv1_benchmark.yml"
self.path = self.get_relative_path(filename)

def time_run_tardis(self):
run_tardis(self.path, log_level="ERROR", show_progress_bars=False)
run_tardis(
self.config_verysimple,
atom_data=self.atomic_dataset,
show_convergence_plots=False,
)
31 changes: 7 additions & 24 deletions benchmarks/transport_montecarlo_numba_formal_integral_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import tardis.transport.montecarlo.formal_integral as formal_integral
from benchmarks.benchmark_base import BenchmarkBase
from tardis import constants as c
from tardis import run_tardis
from tardis.io.configuration.config_reader import Configuration
from tardis.model.geometry.radial1d import NumbaRadial1DGeometry

config.THREADING_LAYER='workqueue'
Expand All @@ -20,22 +18,6 @@ class BenchmarkMontecarloMontecarloNumbaNumbaFormalIntegral(BenchmarkBase):
Class to benchmark the numba formal integral function.
"""

def __init__(self):
super().__init__()

self.config = None
filename = "data/tardis_configv1_benchmark.yml"
path = self.get_relative_path(filename)
self.config = Configuration.from_yaml(path)

self.Simulation = run_tardis(
self.config, log_level="ERROR", show_progress_bars=False
)

self.FormalIntegrator = formal_integral.FormalIntegrator(
self.Simulation.simulation_state, self.Simulation.plasma, self.Simulation.transport
)

@parameterize(
{
"Parameters": [
Expand Down Expand Up @@ -123,12 +105,13 @@ def time_calculate_p_values(self, N):

# Benchmark for functions in FormalIntegrator class
def time_FormalIntegrator_functions(self):
self.FormalIntegrator.calculate_spectrum(
self.Simulation.transport.transport_state.spectrum.frequency
FormalIntegrator = formal_integral.FormalIntegrator(
self.simulation_verysimple.simulation_state, self.simulation_verysimple.plasma, self.simulation_verysimple.transport
)
self.FormalIntegrator.make_source_function()
self.FormalIntegrator.generate_numba_objects()
self.FormalIntegrator.formal_integral(
self.Simulation.transport.transport_state.spectrum.frequency,
FormalIntegrator.calculate_spectrum(self.simulation_verysimple.transport.transport_state.spectrum.frequency)
FormalIntegrator.make_source_function()
FormalIntegrator.generate_numba_objects()
FormalIntegrator.formal_integral(
self.simulation_verysimple.transport.transport_state.spectrum.frequency,
1000
)

0 comments on commit d8bbb8f

Please sign in to comment.