Skip to content

Partition anisotropic lines onto one rank and fix adjoint mpi ranks - #2980

Open
bigfooted wants to merge 8 commits into
developfrom
feature_parmetis_anisotropy
Open

bigfooted wants to merge 8 commits into
developfrom
feature_parmetis_anisotropy

Conversation

@bigfooted

Copy link
Copy Markdown
Contributor

This PR splits off the parmetis improvements from #2931. It turns out that this parmetis improvement is 'almost' always better, and in the worst case performs equally well. It improves MPI performance for cases with inflation layers.

PARMETIS_ANISOTROPY_WEIGHT (default YES) weights the ParMETIS graph edges by cell aspect ratio, gives the edges that chain points into wall-normal lines the largest weight, and moves each line to the rank holding most of its points after partitioning. Lines are then not split between ranks, which keeps the block-Jacobi ILU and line-based agglomeration from seeing fragments of lines.

On stretched boundary-layer meshes this turned stalled or diverging parallel runs into converging ones (2D shear layer, 2D bump, 3D bump, flat plate with multigrid) and made iteration counts match the serial run more closely, with no case that converged without it failing with it. The load imbalance stays within 1.01-1.05 in 2D and up to about 1.3 on a large 3D mesh. The option has no effect on isotropic meshes or without ParMETIS; a warning is printed when it is set explicitly in a build without ParMETIS.

Proposed Changes

Give a brief overview of your contribution here in a few sentences.

Related Work

Resolve any issues (bug fix or feature request), note any related PRs, or mention interactions with the work of others, if any.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • 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.

PARMETIS_ANISOTROPY_WEIGHT (default YES) weights the ParMETIS graph edges by
cell aspect ratio, gives the edges that chain points into wall-normal lines
the largest weight, and moves each line to the rank holding most of its
points after partitioning. Lines are then not split between ranks, which
keeps the block-Jacobi ILU and line-based agglomeration from seeing
fragments of lines.

On stretched boundary-layer meshes this turned stalled or diverging parallel
runs into converging ones (2D shear layer, 2D bump, 3D bump, flat plate with
multigrid) and made iteration counts match the serial run more closely, with
no case that converged without it failing with it. The load imbalance stays
within 1.01-1.05 in 2D and up to about 1.3 on a large 3D mesh. The option has
no effect on isotropic meshes or without ParMETIS; a warning is printed when
it is set explicitly in a build without ParMETIS.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bigfooted

Copy link
Copy Markdown
Contributor Author

I bumped black up a version and precommit removed a couple of empty lines in some python files.

bigfooted and others added 2 commits October 18, 2026 09:06
…eights

In AD builds MPI_DOUBLE maps to AMPI_ADOUBLE, which expects active su2double
buffers. The passivedouble buffers were overrun, corrupting the heap and
crashing the AD regression cases that partition with ParMETIS.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bigfooted and others added 2 commits October 18, 2026 19:33
Every rank holds a copy of the pressure drop, so the adjoint extracted on
one rank was only its local contribution and Adjoint_SolExtra depended on
the partition. The extracted adjoint is now summed over the ranks, and the
seed is divided by the number of ranks because the reverse Allreduce of the
massflow sums the seeds of all copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TransposeInPlace turns the blocks of halo rows into owned rows of the
transposed matrix. Boundary conditions modify only owned rows (symmetry
planes project out the normal momentum, walls delete velocity, energy and
turbulence rows), so wherever a partition boundary met such a boundary the
adjoint linear system had spurious couplings. The primal never reads halo
rows and was unaffected.

On da_sp_pinArray_cht_2d_mf at CFL 100 this made the adjoint diverge on
some partitions (2 ranks with anisotropic ParMETIS weights, 3 and 4 ranks
without), with the adjoint linear solver reaching only 1e-1.4 instead of
1e-3. All partitions from 1 to 4 ranks now give the same results. The
reference values of that case are updated, they include the pressure drop
adjoint fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bigfooted bigfooted changed the title Partition anisotropic lines onto one rank and make it the default Partition anisotropic lines onto one rank and fix adjoint mpi ranks Oct 18, 2026
TransposeInPlace now takes the geometry and copies the owner rows into the
halo rows itself, so the two callers cannot forget it. Comments shortened
and the new code run through clang-format.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bigfooted

Copy link
Copy Markdown
Contributor Author

there was also an mpi error in AD that popped up with this PR, it is fixed with 50639a4

This branch has not been deployed

No deployments
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