-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Refactor and add more benchmarks for montecarlo #2640
Merged
andrewfullard
merged 32 commits into
tardis-sn:master
from
officialasishkumar:refactor-benchmarks
Jul 12, 2024
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
d61d905
benchmark for energy input package
officialasishkumar 1664b38
refactor benchmark - remove assert
officialasishkumar d40cfea
remove energy input source
officialasishkumar bd9a8f6
intensity_black_body and test_reverse_binary_search function benchmark
officialasishkumar 75e2b0e
add name and email in .mailmap
officialasishkumar ab13842
fix import error of Configuration
officialasishkumar 4c86741
refactor transport_montecarlo_packet.py
officialasishkumar f5ebda4
refactor transport_montecarlo_numba_formal_integral_p.py
officialasishkumar 48d164d
add FormalIntegrator benchmark
officialasishkumar edc5dce
add calculate_spectrum benchmark
officialasishkumar 4a909f0
add make_source_function and generate_numba_objects in benchmark
officialasishkumar 76cb1cf
add formal_integral from FormalIntegrator class benchmark
officialasishkumar 247add4
add trace_vpacket_volley benchmark
officialasishkumar 8c2fa52
add single_packet_loop benchmark
officialasishkumar 4974f89
refactor vpacket benchmark
officialasishkumar e3d52ba
refactor r_packet benchmark
officialasishkumar 293d183
add montecarlo_main_loop benchmark
officialasishkumar b4e01ce
refactor VPacketCollection_add_packet benchmark
officialasishkumar 70119f4
refactor transport_montecarlo_packet.py
officialasishkumar 3ae39a0
refactor numba_formal_integral benchmark
officialasishkumar fad45f3
fix benchmark_base path bug
officialasishkumar e95c3d2
migrate calculate distance functions to a new file
officialasishkumar 72be045
Merge branch 'master' into refactor-benchmarks
officialasishkumar 928c16e
Merge branch 'master' into refactor-benchmarks
officialasishkumar ed46872
bug fix benchmarking
officialasishkumar 14f29ad
removed duplicate function
officialasishkumar a245a7d
skip benchmark with GNU error
officialasishkumar 09e3032
benchmark single packet loop
officialasishkumar ea6175a
fix benchmark trace_vpacket_volley
officialasishkumar 5bae9d4
fix benchmark single_packet_loop
officialasishkumar 72340d1
change docstring
officialasishkumar fbae4cc
fix benchmark formal_integral functions
officialasishkumar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -12,6 +12,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 | ||
officialasishkumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(Can be future work) Setting up a separate config property or a yml file is cleaner.