Skip to content

Fix MPI Divergent Grid Stretching#1625

Open
danieljvickers wants to merge 2 commits into
MFlowCode:masterfrom
danieljvickers:fix-mpi-divergent-grid-stretching
Open

Fix MPI Divergent Grid Stretching#1625
danieljvickers wants to merge 2 commits into
MFlowCode:masterfrom
danieljvickers:fix-mpi-divergent-grid-stretching

Conversation

@danieljvickers

@danieljvickers danieljvickers commented Jul 2, 2026

Copy link
Copy Markdown
Member

Description

When we run grid stretching in MFC pre-processing, we first normalize the cell boundary array by the local length of the mpi rank. We then convert back later. This has the clear flaw that as we add more MPI ranks then the grid is stretched in different ways. For example, a case that runs fine in 32 ranks will suddenly break at 128 ranks because the grid was stretched more to infinity. This can also cause some frustration because the grid stretching has to be completely recomputed in order to properly strong-scale a case. When more ranks are added, it doesn't just double the resolution, it may just increase the domain size and leave the same resolution.

Both of the issues above make this clearly undesired/unintended behavior. To fix this, I added a global domain boundary in pre-processing that is used to normalize the array, instead of the local domain length. This eliminates the processor-rank-number-dependent domain stretching and makes it a little easier to set up proper grid-stretching cases.

Type of change (delete unused ones)

  • Bug fix

Testing

Ran on 1 and 1024 ranks, but obtained the same grid size.

Checklist

Check these like this [x] to indicate which of the below applies.

  • I added or updated tests for new behavior

See the developer guide for full coding standards.

GPU changes (expand if you modified src/simulation/)

This is a CPU-only change.

@danieljvickers danieljvickers marked this pull request as ready for review July 2, 2026 22:11
@sbryngelson

Copy link
Copy Markdown
Member

it baffles me that this was broken. surely we've done multirank grid stretching before, but the fix looks correct.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.43%. Comparing base (66254db) to head (6dd5701).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1625   +/-   ##
=======================================
  Coverage   60.43%   60.43%           
=======================================
  Files          83       83           
  Lines       19868    19871    +3     
  Branches     2956     2956           
=======================================
+ Hits        12007    12010    +3     
  Misses       5860     5860           
  Partials     2001     2001           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants