-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and add more benchmarks for montecarlo (#2640)
* benchmark for energy input package Signed-off-by: Asish Kumar <[email protected]> * refactor benchmark - remove assert Signed-off-by: Asish Kumar <[email protected]> * remove energy input source Signed-off-by: Asish Kumar <[email protected]> * intensity_black_body and test_reverse_binary_search function benchmark Signed-off-by: Asish Kumar <[email protected]> * add name and email in .mailmap Signed-off-by: Asish Kumar <[email protected]> * fix import error of Configuration Signed-off-by: Asish Kumar <[email protected]> * refactor transport_montecarlo_packet.py Signed-off-by: Asish Kumar <[email protected]> * refactor transport_montecarlo_numba_formal_integral_p.py Signed-off-by: Asish Kumar <[email protected]> * add FormalIntegrator benchmark Signed-off-by: Asish Kumar <[email protected]> * add calculate_spectrum benchmark Signed-off-by: Asish Kumar <[email protected]> * add make_source_function and generate_numba_objects in benchmark Signed-off-by: Asish Kumar <[email protected]> * add formal_integral from FormalIntegrator class benchmark Signed-off-by: Asish Kumar <[email protected]> * add trace_vpacket_volley benchmark Signed-off-by: Asish Kumar <[email protected]> * add single_packet_loop benchmark Signed-off-by: Asish Kumar <[email protected]> * refactor vpacket benchmark Signed-off-by: Asish Kumar <[email protected]> * refactor r_packet benchmark Signed-off-by: Asish Kumar <[email protected]> * add montecarlo_main_loop benchmark Signed-off-by: Asish Kumar <[email protected]> * refactor VPacketCollection_add_packet benchmark Signed-off-by: Asish Kumar <[email protected]> * refactor transport_montecarlo_packet.py Signed-off-by: Asish Kumar <[email protected]> * refactor numba_formal_integral benchmark Signed-off-by: Asish Kumar <[email protected]> * fix benchmark_base path bug Signed-off-by: Asish Kumar <[email protected]> * migrate calculate distance functions to a new file Signed-off-by: Asish Kumar <[email protected]> * bug fix benchmarking Signed-off-by: Asish Kumar <[email protected]> * removed duplicate function Signed-off-by: Asish Kumar <[email protected]> * skip benchmark with GNU error * benchmark single packet loop Signed-off-by: Asish Kumar <[email protected]> * fix benchmark trace_vpacket_volley Signed-off-by: Asish Kumar <[email protected]> * fix benchmark single_packet_loop Signed-off-by: Asish Kumar <[email protected]> * change docstring Signed-off-by: Asish Kumar <[email protected]> * fix benchmark formal_integral functions Signed-off-by: Asish Kumar <[email protected]> --------- Signed-off-by: Asish Kumar <[email protected]>
- Loading branch information
1 parent
5d22754
commit 17b1da4
Showing
12 changed files
with
305 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ Alice Harpole <[email protected]> | |
Alice Harpole <[email protected]> Alice Harpole <[email protected]> | ||
|
||
Aman Kumar <[email protected]> | ||
Asish Kumar <[email protected]> | ||
|
||
Andreas Flörs <[email protected]> | ||
Andreas Flörs <[email protected]> Andreas Flörs <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from asv_runner.benchmarks.mark import parameterize | ||
|
||
import tardis.transport.frame_transformations as frame_transformations | ||
import tardis.transport.geometry.calculate_distances as calculate_distances | ||
from benchmarks.benchmark_base import BenchmarkBase | ||
|
||
|
||
class BenchmarkTransportGeometryCalculateDistances(BenchmarkBase): | ||
""" | ||
Class to benchmark the calculate distances function. | ||
""" | ||
|
||
@property | ||
def model(self): | ||
return 5.2e7 | ||
|
||
def time_calculate_distance_boundary(self): | ||
mu = 0.3 | ||
r = 7.5e14 | ||
|
||
calculate_distances.calculate_distance_boundary( | ||
r, mu, self.geometry.r_inner[0], self.geometry.r_outer[0] | ||
) | ||
|
||
@parameterize( | ||
{ | ||
"Parameters": [ | ||
{ | ||
"packet": { | ||
"nu_line": 0.1, | ||
"is_last_line": True | ||
}, | ||
"enable_full_relativity": True, | ||
}, | ||
{ | ||
"packet": { | ||
"nu_line": 0.2, | ||
"is_last_line": False | ||
}, | ||
"enable_full_relativity": True, | ||
} | ||
] | ||
} | ||
) | ||
def time_calculate_distance_line(self, parameters): | ||
packet_params = parameters["packet"] | ||
nu_line = packet_params["nu_line"] | ||
is_last_line = packet_params["is_last_line"] | ||
enable_full_relativity = parameters["enable_full_relativity"] | ||
|
||
time_explosion = self.model | ||
|
||
doppler_factor = frame_transformations.get_doppler_factor( | ||
self.static_packet.r, | ||
self.static_packet.mu, | ||
time_explosion, | ||
enable_full_relativity | ||
) | ||
comov_nu = self.static_packet.nu * doppler_factor | ||
|
||
calculate_distances.calculate_distance_line( | ||
self.static_packet, | ||
comov_nu, | ||
is_last_line, | ||
nu_line, | ||
time_explosion, | ||
enable_full_relativity | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Basic TARDIS Benchmark. | ||
""" | ||
|
||
from benchmarks.benchmark_base import BenchmarkBase | ||
from tardis.transport.montecarlo.montecarlo_main_loop import montecarlo_main_loop | ||
|
||
|
||
class BenchmarkTransportMontecarloMainLoop(BenchmarkBase): | ||
""" | ||
class to benchmark montecarlo_main_loop function. | ||
""" | ||
|
||
def time_montecarlo_main_loop(self): | ||
montecarlo_main_loop( | ||
self.transport_state.packet_collection, | ||
self.transport_state.geometry_state, | ||
self.verysimple_time_explosion, | ||
self.transport_state.opacity_state, | ||
self.montecarlo_configuration, | ||
self.transport_state.radfield_mc_estimators, | ||
self.transport_state.spectrum_frequency.value, | ||
self.montecarlo_configuration.NUMBER_OF_VPACKETS, | ||
iteration=0, | ||
show_progress_bars=False, | ||
total_iterations=0 | ||
) |
Oops, something went wrong.