From eb8f4e3d99052118ffc5cea6abc0ce82c31da771 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Fri, 27 Jan 2023 15:29:46 +0000 Subject: [PATCH 1/2] inline post bug fix: deallocate ifi arrays before next iteration of post --- sorc/ncep_post.fd/DEALLOCATE.f | 3 +++ sorc/ncep_post.fd/IFI.F | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/sorc/ncep_post.fd/DEALLOCATE.f b/sorc/ncep_post.fd/DEALLOCATE.f index 4c0c0d094..75301bfc5 100644 --- a/sorc/ncep_post.fd/DEALLOCATE.f +++ b/sorc/ncep_post.fd/DEALLOCATE.f @@ -139,6 +139,9 @@ SUBROUTINE DE_ALLOCATE deallocate(stc) deallocate(sh2o) deallocate(SLDPTH) + deallocate(CAPE) + deallocate(CIN) + deallocate(IFI_APCP) deallocate(RTDPTH) deallocate(SLLEVEL) ! diff --git a/sorc/ncep_post.fd/IFI.F b/sorc/ncep_post.fd/IFI.F index 6df7215d1..6fa255b0d 100644 --- a/sorc/ncep_post.fd/IFI.F +++ b/sorc/ncep_post.fd/IFI.F @@ -21,6 +21,9 @@ subroutine set_ifi_dims() ! Bogus fill value for flight levels to prevent a crash ifi_nflight = 60 + if(allocated(ifi_flight_levels)) then + deallocate(ifi_flight_levels) + endif allocate(ifi_flight_levels(ifi_nflight)) do i=1,ifi_nflight ifi_flight_levels(i) = 500*i @@ -176,10 +179,27 @@ subroutine make_communicators ! 929 format('Rank ',I0,' ista=',I0,' jsta=',I0) ! print 929,grid_rank,ista,jsta + if(allocated(ista_grid)) then + deallocate(ista_grid) + deallocate(jsta_grid) + deallocate(rearrange) + deallocate(rearrange_row1d) + deallocate(rearrange_row2d) + deallocate(row_ista) + deallocate(row_iend) + deallocate(row_comm_count) + deallocate(row_comm_displ) + deallocate(col_jsta) + deallocate(col_jend) + deallocate(col_comm_count) + deallocate(col_comm_displ) + endif + ! Get the start locations on every rank. We need this for the key, ! and for determining root ranks. allocate(ista_grid(size)) allocate(jsta_grid(size)) + ista_grid=-1 jsta_grid=-1 call MPI_Allgather(ista,1,MPI_INTEGER,ista_grid,1,MPI_INTEGER,mpi_comm_comp,ierr) @@ -508,6 +528,9 @@ subroutine set_ifi_dims() ! Convert from integer to real: ifi_nflight = size(config_flight_levels_feet) + if(allocated(ifi_flight_levels)) then + deallocate(ifi_flight_levels) + endif allocate(ifi_flight_levels(ifi_nflight)) ifi_flight_levels = config_flight_levels_feet From d96b67ba097d5949101f70982aa644a8ddba1a0a Mon Sep 17 00:00:00 2001 From: "Samuel Trahan (NOAA contractor)" <39415369+SamuelTrahanNOAA@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:14:09 -0500 Subject: [PATCH 2/2] Update sorc/ncep_post.fd/IFI.F --- sorc/ncep_post.fd/IFI.F | 1 - 1 file changed, 1 deletion(-) diff --git a/sorc/ncep_post.fd/IFI.F b/sorc/ncep_post.fd/IFI.F index 6fa255b0d..2b910cc99 100644 --- a/sorc/ncep_post.fd/IFI.F +++ b/sorc/ncep_post.fd/IFI.F @@ -199,7 +199,6 @@ subroutine make_communicators ! and for determining root ranks. allocate(ista_grid(size)) allocate(jsta_grid(size)) - ista_grid=-1 jsta_grid=-1 call MPI_Allgather(ista,1,MPI_INTEGER,ista_grid,1,MPI_INTEGER,mpi_comm_comp,ierr)