Repository navigation
Parallelization of Weight Window Update - #3467
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR parallelizes the weight window update function in OpenMC to improve performance for large models by replacing xtensor vector operations with iterative OpenMP-parallelized loops.
- Replaces serial xtensor calls with parallelized for loops for initializing, computing, and normalizing weight window arrays
- Implements separate parallel loops for both MAGIC and FW-CADIS processing methods
- Adjusts computation of mean and relative error, as well as normalization across energy groups
ahnaf-tahmid-chowdhury
pushed a commit
to ahnaf-tahmid-chowdhury/OpenMC
that referenced
this pull request
Jul 7, 2025
apingegno
pushed a commit
to apingegno/openmc
that referenced
this pull request
May 7, 2026
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.
Description
Currently, updates to weight window values are computed serially in OpenMC. This is not a problem on smaller models and/or if using a very coarse mesh, but for larger models at finer mesh resolutions (where you can easily have 100 million or more bins), the weight window update times can become pretty significant in serial.
This PR parallelizes the weight window update function across threads. As the original function made heavy usage of xtensor views and vector operations, this parallelization required a few additional lines so as to convert the vector calls to iterative
forloops that could be parallelized with OpenMP.Note that this PR should not be changing any results -- it is only intended to speed things up via parallelization.
Impact
I did some performance analysis on the JET model with this PR along with the last several optimizations on WW generation with FW-CADIS. Runtimes are given for total runtime (of the adjoint solve) on a single CPU node (for 5 inactive + 5 active batches, with extremely low ray density, and a 10cm resolution weight window mesh). Below is the summary:
As can be seen above, the new parallelization scheme gives an additional 2x overall performance boost.
Checklist