From 71646d03f169c9786db9eba75e15365837e268fc Mon Sep 17 00:00:00 2001 From: thierrydaoud Date: Tue, 27 Oct 2026 13:01:03 -0400 Subject: [PATCH 1/2] Remove the leaked MPI_IO_DATA scratch allocations 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). --- src/post_process/m_global_parameters.fpp | 15 --------------- src/pre_process/m_global_parameters.fpp | 13 ------------- src/simulation/m_global_parameters.fpp | 18 ------------------ 3 files changed, 46 deletions(-) diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index bd90c28ed8..70ec6f5247 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -458,21 +458,6 @@ contains allocate (MPI_IO_DATA%var(1:sys_size)) end if - do i = 1, sys_size - if (down_sample) then - allocate (MPI_IO_DATA%var(i)%sf(-1:m + 1,-1:n + 1,-1:p + 1)) - else - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - end if - MPI_IO_DATA%var(i)%sf => null() - end do - if (qbmm .and. .not. polytropic) then - do i = sys_size + 1, sys_size + 2*nb*nnode - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - end if - if (ib) allocate (MPI_IO_IB_DATA%var%sf(0:m,0:n,0:p)) #endif diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index b358516fbf..a7451322bd 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -562,19 +562,6 @@ contains allocate (MPI_IO_DATA%view(1:sys_size)) allocate (MPI_IO_DATA%var(1:sys_size)) end if - - if (.not. down_sample) then - do i = 1, sys_size - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - end if - if (qbmm .and. .not. polytropic) then - do i = sys_size + 1, sys_size + 2*nb*nnode - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - end if #endif ! Allocating grid variables for the x-direction diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 6157db87ef..ca63ca2407 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -900,24 +900,6 @@ contains allocate (MPI_IO_DATA%var(1:sys_size)) end if - if (.not. down_sample) then - do i = 1, sys_size - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - end if - if (bubbles_euler .and. qbmm .and. .not. polytropic) then - do i = sys_size + 1, sys_size + 2*nb*nnode - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - else if (bubbles_lagrange) then - do i = 1, sys_size + 1 - allocate (MPI_IO_DATA%var(i)%sf(0:m,0:n,0:p)) - MPI_IO_DATA%var(i)%sf => null() - end do - end if - ! Configure WENO averaging flag (arithmetic mean vs. unaltered values) wa_flg = 0._wp; if (weno_avg) wa_flg = 1._wp $:GPU_UPDATE(device='[wa_flg]') From 8fdf8005d6c4efce92a11e610742d16df9b65a58 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 28 Oct 2026 15:07:53 -0500 Subject: [PATCH 2/2] Remove the leaked MPI_IO_IB_DATA scratch allocation 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. --- src/post_process/m_global_parameters.fpp | 2 -- src/simulation/m_global_parameters.fpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 70ec6f5247..12957a26fb 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -457,8 +457,6 @@ contains allocate (MPI_IO_DATA%view(1:sys_size)) allocate (MPI_IO_DATA%var(1:sys_size)) end if - - if (ib) allocate (MPI_IO_IB_DATA%var%sf(0:m,0:n,0:p)) #endif ! Size of the ghost zone layer is non-zero only when post-processing the raw simulation data of a parallel multidimensional diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index c12033975c..dc97528812 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -911,8 +911,6 @@ contains wenojs = .not. (mapped_weno .or. wenoz .or. teno) #:endif - if (ib) allocate (MPI_IO_IB_DATA%var%sf(0:m,0:n,0:p)) - if (hypoelasticity .or. mhd .or. probe_wrt .or. ib .or. bubbles_lagrange) then fd_number = max(1, fd_order/2) end if