fix: High memory usage from sample-level result accumulators#109
Open
akrivi wants to merge 2 commits into
Open
fix: High memory usage from sample-level result accumulators#109akrivi wants to merge 2 commits into
akrivi wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #109 +/- ##
==========================================
- Coverage 83.13% 82.22% -0.92%
==========================================
Files 45 45
Lines 2325 2368 +43
==========================================
+ Hits 1933 1947 +14
- Misses 392 421 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Previously, each thread allocated sample-level accumulators sized for the full Monte Carlo sample count. For sample-based result specs like
ShortfallSamples,FlowSamples,StorageEnergySamples,GeneratorAvailability, this caused memory usage to scale asO(regions x timesteps x samples x threads).This PR changes threaded execution so sample-based result accumulators are partitioned by each worker’s assigned sample range.
Example for 3 threads:
Before, each thread allocated the whole sample matrix:
Now, samples are split into ranges:
Benchmarks
System: Guam 2028, 13 regions, 8760 timestamps, hourly resolution
Simulation: Run on HPC, using
standardnodes (104 cores, 250 GB)Result:
ShortfallSamples()1000 MC Samples
10000 MC Samples