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 fix for github actions #2702

Merged
merged 1 commit into from
Jul 15, 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
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
)
Loading