Repository navigation
Fix mpi io data leak - #2114
Open
thierrydaoud wants to merge 4 commits into
Open
Fix mpi io data leak#2114thierrydaoud wants to merge 4 commits into
thierrydaoud wants to merge 4 commits into
Conversation
Each target allocated an interior-sized array for every MPI_IO_DATA%var(i)%sf and then set sf => null(), leaving the array unreachable. The arrays were never used: s_initialize_mpi_data points each sf at the q_cons_vf, beta or pb/mv slices before every MPI-IO read or write, and sf defaults to null(). simulation lost sys_size arrays per rank in every MPI build, plus sys_size + 1 more with Lagrangian bubbles (384 MB and 832 MB per rank for a single-fluid 3D case at 200^3). Measured on 100^3, 1 rank: heap 1,108,359,392 B -> 1,060,286,992 B (6 x 8 MB).
thierrydaoud
requested review from
sbryngelson
and removed request for
a team
October 27, 2026 17:02
|
Claude Code Review Head SHA: ecc5f16 The review produced no output (Claude step: failure). Run and transcript: https://github.com/MFlowCode/MFC/actions/runs/40546783749 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2114 +/- ##
==========================================
- Coverage 62.02% 62.02% -0.01%
==========================================
Files 86 86
Lines 22936 22910 -26
Branches 3370 3372 +2
==========================================
- Hits 14226 14209 -17
+ Misses 6210 6205 -5
+ Partials 2500 2496 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
s_initialize_mpi_data points MPI_IO_IB_DATA%var%sf at ib_markers before every parallel IB read or write, so the interior-sized integer array allocated at init was orphaned and never freed. The serial paths read and write ib_markers directly.
Lines of Code
|
sbryngelson
approved these changes
Oct 28, 2026
This branch has not been deployed
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.
Description
s_initialize_global_parameters_modulein all three targets allocates an interior-sized array for eachMPI_IO_DATA%var(i)%sfand then immediately doessf => null(). The arrays become unreachable and are never freed. The arrays are also never needed:s_initialize_mpi_data/s_initialize_mpi_data_ds(src/common/m_mpi_common.fpp) point everysfat the existingq_cons_vf,beta,pb/mvslices before each MPI-IO read or write (in post_process throughs_setup_mpi_io_params), andsfalready defaults tonull()inscalar_field.This PR deletes those allocate-then-nullify loops. The
MPI_IO_DATA%var/%viewarrays themselves are still allocated as before.Memory lost per rank before this change, with (m+1)(n+1)(p+1) × 8 bytes per array:
parallel_io)sys_size; withbubbles_lagrange,sys_size+sys_size + 12*nb*nnodesys_size(if notdown_sample)sys_size(larger withdown_sample)Example: 3D, single fluid (
sys_size= 6), 200³ cells per rank: 384 MB of host memory lost per rank, and 832 MB with Lagrangian bubbles. On APUs (MI300A) host and device share the same HBM.Testing
simulationmid-run (macOSheap), 3D single-fluid shock tube, 100³ cells, 1 rank:e95a827a: 1,108,359,392 B./mfc.sh test -j 8, CPU, macOS): 726 passed, 0 failed, 39 skipped