Add ability to run each of a calculation's base sources sequentially instead - #11677
Open
CB-quakemodel wants to merge 63 commits into
Open
Add ability to run each of a calculation's base sources sequentially instead#11677CB-quakemodel wants to merge 63 commits into
CB-quakemodel wants to merge 63 commits into
Conversation
Contributor
|
I don't like the idea of changing the source model logic tree file. The logic tree should stay unchanged; the calculation logic can be controlled by the job.ini instead. For instance there could be a flag |
CB-quakemodel
marked this pull request as draft
August 4, 2026 14:57
CB-quakemodel
marked this pull request as ready for review
August 12, 2026 16:57
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.
If
sequential_source_models=truein the config, then both the preclassical and the classical stages are ran sequentially (all the preclassical batches first, then all the classical batches), one base source model at a time.This is important for very large logic trees like the BC Hydro NVA model - in both the classical and the preclassical, it is seemingly tricky to avoid an OOM issue (or similar bottlenecking type problems) without this sequential approach, even with sampling.
For example, with 16,000 samples we can get through the preclassical stage on the hazard workstation without the sequential approach, but at 20,000 samples we OOM without this sequential approach given the preclassical fails.
One-to-one comparison on the hazard workstation is therefore seemingly limited to 16,000 samples, where the calculation takes about 9 hours for sequential in only classical, 11 hours for sequential in both preclassical and classical and about 9 hours for regular approaches - with 20,000 samples it is possible with only the sequential approach given it can complete the preclassical stage without OOM.
A new QA test is added (logictree/case_24) which ensures it obtains identical results in both full enumeration and sampling to the "regular" approach. An existing QA test (logictree/case_83) which uses
extendModelis expanded to check identical results are obtained when using full enumeration and sampling here versus the "regular" approach too.NOTE: This batching only works if the source groups are not shared amongst the base sources - an explicit error is raised if this is not true to guard against it.
NOTE:
ExtendModelis supported. This is the only case that shared source groups amongst the base sources are permitted whensequential_source_models=true- this is because a final batch is ran on the shared source groups (shared over the different base sources) separately in this case (with the potential limitation that if the logic tree heavily relies on extend model the memory footprint might be similar (or equal) the footprint of the "regular" approach.NOTE: Currently it only works in classical and disagg given it's (probably) most useful for large logic trees used in site-specific PSHAs (i.e., when using the classical calculator). An error is raised to prevent use in other calculator types. Expanding to other calculators is probably best done so in additional PRs.
NOTE: Some dtype widening is included from #11709 so I can run the model on the hazard workstation using this branch (the PRs are separate for clarity).