Skip to content

Error on MPI+CUDA, compatibility with Newton-Krylov, fix OpenMP deadlock in Newton-Krylov - #2887

Merged
pcarruscag merged 4 commits into
developfrom
pedro/gpu_improvements
Sep 7, 2026
Merged

Error on MPI+CUDA, compatibility with Newton-Krylov, fix OpenMP deadlock in Newton-Krylov#2887
pcarruscag merged 4 commits into
developfrom
pedro/gpu_improvements

Conversation

@pcarruscag

Copy link
Copy Markdown
Member

Proposed Changes

All in the title.

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

pcarruscag and others added 3 commits September 5, 2026 22:50
…e GPU

Three CUDA combinations that silently produced wrong results now fail at
config time instead:

- More than one MPI rank. The solver keeps its work vectors on the device
  for the whole Krylov iteration (CSysSolve::UploadSystem) while the halo
  exchange is host-side, so a partitioned run converges to the wrong answer.
- The AD and direct differentiation solvers. nvcc cannot compile the
  CoDiPack types, so the kernels are only linked into the primal libraries
  (SU2_ENABLE_CUDA_KERNELS). This used to fail minutes into the run with a
  message claiming CUDA had not been compiled in, which is misleading for a
  build configured with -Denable-cuda=true; GPUNotAvailable now tells the
  two cases apart as well.

Newton-Krylov was the third, and is fixed rather than rejected. Its outer
matrix-vector product is matrix free and host resident, but the
preconditioner is an ordinary CSysMatrix operation that the device can do.
It went through neither CSysSolve::Solve (so the vectors were never
uploaded) nor CSysMatrixVectorProduct (so the Jacobian was never uploaded),
and every linear solve exited immediately having done nothing, with all
preconditioners giving identical results. The Jacobian is now uploaded
before Build(), and ApplyPreconditionerOnDevice (the mirror of the existing
ApplyPreconditionerOnHost) transfers the vectors around the apply. Device
expressions are enabled for the duration so a nested Krylov solve offloads
too: verified with Tracy that all of its matrix-vector products and inner
preconditioner applies run on the device, for the nested FGMRES, BCGSTAB and
SMOOTHER inner solvers. On ONERA M6 RANS the GPU results track the CPU ones
to 5-6 significant figures and are 1.3-1.9x faster per iteration.

Also drops the SU2_OMP_MASTER around the force calculations, which #2870
parallelized with OpenMP.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pcarruscag
pcarruscag merged commit 1344619 into develop Sep 7, 2026
1 check passed
@pcarruscag
pcarruscag deleted the pedro/gpu_improvements branch September 7, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant