Removed separation of MPI ranks during boozXform #442
Merged
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.
Currently, only MPI leaders run the majority of the
run
method of the BoozXform. This would be fine, except there is no use of MPI broadcast to send the all results of the run to the MPI workers. For example, on line 168 the MPI leaders will setself.bx.asym = bool(wout.lasym)
(a boolean for stellarator symmetry), whereas the MPI workers will still be stuck with the default value ofself.bx.asym
since they never run this line. This can cause downstream problems in codes that depend on these properties, such as theBoozerRadialInterpolant
class.This PR proposes to allow all MPI cores to run the entire function, rather than just the leaders.
Downsides
Upsides
Alternatives
Minimal working example
The error can be seen by running this code with two MPI ranks, i.e.
mpiexec -n 2 python test.py
. The error will be caused by using a single MPI partition. In my case, i find that the error is not deterministic, i.e. you may have to run this code multiple times to find that it fails. This is because, the default value ofself.booz.bx.asym
is not deterministic, switching between0
and1
.Expected output when the script fails (rank 1 gets stuck in the boozerRadialInterpolant)
Expected output when the script succeeds,