Repository navigation
GPU: update num_procs and proc_rank on the default device too (fixes NVHPC OpenMP multi-GPU after #2371) - #2384
Merged
Conversation
… binding MFlowCode#2371 moved this update after each rank is bound to its GPU, which fixed the bound device's copy under OpenACC. Under NVHPC OpenMP offload, a rank whose first device operation comes after omp_set_default_device moves it to another GPU then fails its first allocation with CUDA_ERROR_INVALID_CONTEXT (two ranks on two GPUs). Keep the update after binding and restore the earlier one.
sbryngelson
requested review from
danieljvickers
and removed request for
a team
November 21, 2026 22:07
sbryngelson
marked this pull request as draft
November 21, 2026 22:07
|
Claude Code Review Head SHA: 2e9caa6 Files changed:
Findings:
|
Lines of Code
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2384 +/- ##
==========================================
+ Coverage 65.72% 65.80% +0.07%
==========================================
Files 111 111
Lines 30549 30681 +132
Branches 4673 4692 +19
==========================================
+ Hits 20079 20190 +111
+ Misses 6699 6692 -7
- Partials 3771 3799 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sbryngelson
marked this pull request as ready for review
November 22, 2026 04:43
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.
AI-assisted (Claude Code). Follow-up to #2371.
What
Restores the
GPU_UPDATE(device='[num_procs, proc_rank]')at the end ofs_mpi_initializethat #2371 removed, and keeps #2371's update after each rank is bound to its GPU ins_initialize_mpi_domain. Each rank now updates the default device first and its bound device second.Why
Since #2371, NVHPC OpenMP offload runs with more than one GPU fail at the first step:
This is what turns the Phoenix
gpu-ompbenchmark red on every PR since #2371 merged: the benchmark builds current master for its baseline, andviscous_weno5_sgb_acoustic(2 ranks on 2 GPUs) fails there, while the PR side, built against an older master, passes.My reading, not confirmed against the NVHPC runtime: with #2371 a rank's first device operation comes after
omp_set_default_devicemoved it to another GPU, and under NVHPC OpenMP that leaves the later allocations without a valid context. Before #2371 the first operation went to the default device.How it was checked
wingtip, NVIDIA A100, NVHPC 25.5, 2 ranks with
-g 2 3(one GPU per rank). The benchmark case isbenchmarks/viscous_weno5_sgb_acoustic/case.py -- --gbpp 1 --steps 5. The collision tests are the five 2-rank IBM tests from #2371 (09FDDC81, 04FB9E91, 9C0CAF25, 50B98DBF, 5E746B78).CUDA_ERROR_INVALID_CONTEXTThe collision tests are the ones #2371 fixed (contact forces applied twice when the second rank's device copy of
num_procswas uninitialised), so that fix still holds../mfc.sh precheckpasses.Not checked
omp_set_default_devicemoves nothing there.