-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
[GSOC] Benchmarking and Performance Improvement: objective 1 #2547
Changes from 6 commits
42ea40a
476b4c1
f31b95a
b0cc777
a38b3ed
78eb1c8
8f42743
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,9 @@ Gaurav Gautam <[email protected]> gautam1168 <[email protected]> | |
Gerrit Leck <[email protected]> | ||
Gerrit Leck <[email protected]> Gerrit Leck <[email protected]> | ||
|
||
Haleel Sada <[email protected]> | ||
Haleel Sada <[email protected]> haleelsada <[email protected]> | ||
|
||
Isaac Smith <[email protected]> | ||
Isaac Smith <[email protected]> Isaac Smith <[email protected]> | ||
Isaac Smith <[email protected]> smithis7 <[email protected]> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,39 @@ | |
import os | ||
from tardis.io.configuration.config_reader import Configuration | ||
from tardis import run_tardis | ||
from astropy import units as u | ||
|
||
class Benchmarkruntardis: | ||
"""Class to benchmark the run_tardis function. | ||
""" | ||
timeout = 200 | ||
|
||
def setup(self): | ||
params = ['branch85_w7', 'uniform','power_law','exponential'] | ||
param_names = ['Density'] | ||
|
||
def setup(self, d): | ||
filename = "tardis_configv1_benchmark.yml" | ||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
path = os.path.join(dir_path, "data", filename) | ||
config = Configuration.from_yaml(path) | ||
config.atom_data = "kurucz_cd23_chianti_H_He.h5" | ||
config.model.structure.density.type = d | ||
config.model.structure.velocity.start = 1000 * u.km/u.s | ||
config.model.structure.velocity.stop = 2000 * u.km/u.s | ||
config.model.structure.velocity.num = 20 | ||
if d == 'uniform': | ||
config.model.structure.density.time_0 = 1 * u.day | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If many of these settings are the same, they don't need to be in the if statements There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added the common settings outside the if clause and anything that differ from default inside the if clause. I thought it would be better for readability. |
||
config.model.structure.density.value = 5e-10 * u.kg/u.cm**3 | ||
elif d == 'power_law': | ||
config.model.structure.density.time_0 = 1 * u.day | ||
config.model.structure.density.rho_0 = 5e-10 * u.kg/u.cm**3 | ||
config.model.structure.density.v_0 = 500 * u.km/u.s | ||
config.model.structure.density.exponent = -2 | ||
elif d == 'exponential': | ||
config.model.structure.density.time_0 = 1 * u.day | ||
config.model.structure.density.rho_0 = 5e-10 * u.kg/u.cm**3 | ||
config.model.structure.density.v_0 = 500 * u.km/u.s | ||
self.config = config | ||
|
||
def time_run_tardis(self): | ||
sim = run_tardis(self.config, log_level="ERROR", show_progress_bars=False) | ||
|
||
def time_run_tardis(self,d): | ||
sim = run_tardis(self.config, log_level="ERROR", | ||
show_progress_bars=False) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
from tardis.io.configuration.config_reader import Configuration | ||
from tardis import run_tardis | ||
from tardis.visualization import SDECPlotter | ||
|
||
|
||
class BenchmarkSDECplotter: | ||
"""Class to benchmark Spectral element DEComposition (SDEC) Plot. | ||
""" | ||
timeout = 200 | ||
|
||
def setup(self): | ||
filename = "tardis_configv1_benchmark.yml" | ||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
path = os.path.join(dir_path, "data", filename) | ||
config = Configuration.from_yaml(path) | ||
config.atom_data = "kurucz_cd23_chianti_H_He.h5" | ||
self.config = config | ||
self.sim = run_tardis(self.config, virtual_packet_logging=True) | ||
|
||
def time_sdec_plot_mpl(self): | ||
plotter = SDECPlotter.from_simulation(self.sim) | ||
plotter.generate_plot_mpl() | ||
|
||
def time_sdec_plot_ply(self): | ||
plotter = SDECPlotter.from_simulation(self.sim) | ||
plotter.generate_plot_ply() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d
is not a good variable name, please use something more descriptiveThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it.