Performance Optimization: Memory Pool & Early Termination#10
Merged
Conversation
- Initialize radius array to 0.0 with only t=0 set to initial radius - Add early exit when pellet fully ablated with info logging - Simplify pellet_density calls by removing NaN checks
Switch from JSON to HDF5 format for template_D3D_1layer_2species test data. HDF5 provides better memory efficiency during loading, which will be beneficial for precompilation and reducing test overhead. Changes: - Add template_D3D_1layer_2species.h5 - Update runtests.jl to use hdf2imas() instead of json2imas() - Add equality test between JSON and HDF5 formats - Apply HDF5 format to OMFIT PAM comparison tests Benefits: - Lower memory footprint during test initialization - Faster loading times with HDF5 binary format - Better compatibility with precompilation strategies
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10 +/- ##
==========================================
+ Coverage 70.82% 70.95% +0.13%
==========================================
Files 1 1
Lines 329 334 +5
==========================================
+ Hits 233 237 +4
- Misses 96 97 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
you should have merge permissions @avdeevag ;) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Optimize
PAM's pellet ablation routine (ablate!) with significant memory reduction and improved computational efficiency through allocation pooling and early termination logic.Performance Improvements
Memory Allocation Reduction
ablate!function optimization:Key Changes
1. Allocation Pool Pattern
Pre-allocate and reuse buffers for
pellet_densitycalculations across iterations.Implementation:
Impact:
2. Early Termination Logic
Detect pellet full ablation and terminate simulation immediately.
Implementation:
Impact:
3. Test Infrastructure
Performance Profiling Note
While
ablate!showed significant improvement (97% memory reduction), overall runtime is bottlenecked byIMAS.trace_surfaces, which consumes the majority of execution time inrun_PAM.Profiling breakdown:
IMAS.trace_surfaces: ~85-90% of total runtimeablate!(optimized): ~10-15% of total runtimeFuture optimization opportunities lie in the
IMAS.trace_surfacesimplementation.