From 6710b88a35881e66adee82730d1156ae87239b52 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Thu, 12 Jan 2023 15:44:55 -0500 Subject: [PATCH 1/4] fixes issue #1923 --- CHANGELOG.md | 2 + base/NCIO.F90 | 103 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 68 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7c1d956647..e50c18e8b27a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed bug when writing 4D fields to checkpoint files with the via the WRITE_RESTART_BY_OSERVER option + ### Removed ### Deprecated diff --git a/base/NCIO.F90 b/base/NCIO.F90 index f85a4a699681..617ea77ec258 100644 --- a/base/NCIO.F90 +++ b/base/NCIO.F90 @@ -620,15 +620,32 @@ subroutine MAPL_VarWriteNCpar_R4_4d(formatter, name, A, ARRDES, oClients, RC) integer :: status integer :: K, L + integer :: i1, j1, in, jn, global_dim(3) + type(ArrayReference) :: ref - ! MORE HERE - do K = 1,size(A,4) - do L = 1,size(A,3) - call MAPL_VarWrite(formatter, name, A(:,:,L,K), arrdes=arrdes, & - & oClients=oClients, lev=l, offset2=k, rc=status) - _VERIFY(status) + if (arrdes%write_restart_by_oserver) then + _ASSERT(present(oClients), "output server is needed") + call MAPL_GridGet(arrdes%grid,globalCellCountPerDim=global_dim,rc=status) + _VERIFY(status) + call MAPL_Grid_interior(arrdes%grid,i1,in,j1,jn) + _ASSERT( i1 == arrdes%I1(arrdes%NX0), "interior starting i not match") + _ASSERT( j1 == arrdes%j1(arrdes%NY0), "interior starting j not match") + ref = ArrayReference(A) + _ASSERT( size(a,1) == in-i1+1, "size not match") + _ASSERT( size(a,2) == jn-j1+1, "size not match") + call oClients%collective_stage_data(arrdes%collection_id,trim(arrdes%filename),trim(name), & + ref,start=[i1,j1,1,1], & + global_start=[1,1,1,1], global_count=[global_dim(1),global_dim(2),size(a,3),size(a,4)]) + else + + do K = 1,size(A,4) + do L = 1,size(A,3) + call MAPL_VarWrite(formatter, name, A(:,:,L,K), arrdes=arrdes, & + & oClients=oClients, lev=l, offset2=k, rc=status) + _VERIFY(status) + end do end do - end do + end if _RETURN(ESMF_SUCCESS) end subroutine MAPL_VarWriteNCpar_R4_4d @@ -643,19 +660,35 @@ subroutine MAPL_VarWriteNCpar_R8_4d(formatter, name, A, ARRDES, oClients, RC) integer, optional , intent( OUT) :: RC integer :: status + integer :: K, L + integer :: i1, j1, in, jn, global_dim(3) + type(ArrayReference) :: ref - ! MORE HERE - do K = 1,size(A,4) - do L = 1,size(A,3) - call MAPL_VarWrite(formatter, name, A(:,:,L,K), arrdes=arrdes, & - & oClients=oClients, lev=l, offset2=k, rc=status) - _VERIFY(status) + if (arrdes%write_restart_by_oserver) then + _ASSERT(present(oClients), "output server is needed") + call MAPL_GridGet(arrdes%grid,globalCellCountPerDim=global_dim,rc=status) + _VERIFY(status) + call MAPL_Grid_interior(arrdes%grid,i1,in,j1,jn) + _ASSERT( i1 == arrdes%I1(arrdes%NX0), "interior starting i not match") + _ASSERT( j1 == arrdes%j1(arrdes%NY0), "interior starting j not match") + ref = ArrayReference(A) + _ASSERT( size(a,1) == in-i1+1, "size not match") + _ASSERT( size(a,2) == jn-j1+1, "size not match") + call oClients%collective_stage_data(arrdes%collection_id,trim(arrdes%filename),trim(name), & + ref,start=[i1,j1,1,1], & + global_start=[1,1,1,1], global_count=[global_dim(1),global_dim(2),size(a,3),size(a,4)]) + else + do K = 1,size(A,4) + do L = 1,size(A,3) + call MAPL_VarWrite(formatter, name, A(:,:,L,K), arrdes=arrdes, & + & oClients=oClients, lev=l, offset2=k, rc=status) + _VERIFY(status) + end do end do - end do + end if _RETURN(ESMF_SUCCESS) - ! MORE HERE end subroutine MAPL_VarWriteNCpar_R8_4d !--------------------------- @@ -673,29 +706,25 @@ subroutine MAPL_VarWriteNCpar_R4_3d(formatter, name, A, ARRDES, oClients, RC) integer :: i1, j1, in, jn, global_dim(3) type(ArrayReference) :: ref - if (present(arrdes)) then - if (arrdes%write_restart_by_oserver) then - _ASSERT(present(oClients), "output server is needed") - call MAPL_GridGet(arrdes%grid,globalCellCountPerDim=global_dim,rc=status) + if (arrdes%write_restart_by_oserver) then + _ASSERT(present(oClients), "output server is needed") + call MAPL_GridGet(arrdes%grid,globalCellCountPerDim=global_dim,rc=status) + _VERIFY(status) + call MAPL_Grid_interior(arrdes%grid,i1,in,j1,jn) + _ASSERT( i1 == arrdes%I1(arrdes%NX0), "interior starting i not match") + _ASSERT( j1 == arrdes%j1(arrdes%NY0), "interior starting j not match") + ref = ArrayReference(A) + _ASSERT( size(a,1) == in-i1+1, "size not match") + _ASSERT( size(a,2) == jn-j1+1, "size not match") + call oClients%collective_stage_data(arrdes%collection_id,trim(arrdes%filename),trim(name), & + ref,start=[i1,j1,1], & + global_start=[1,1,1], global_count=[global_dim(1),global_dim(2),size(a,3)]) + else + do l=1,size(a,3) + call MAPL_VarWrite(formatter,name,A(:,:,l), arrdes=arrdes,lev=l, rc=status) _VERIFY(status) - call MAPL_Grid_interior(arrdes%grid,i1,in,j1,jn) - _ASSERT( i1 == arrdes%I1(arrdes%NX0), "interior starting i not match") - _ASSERT( j1 == arrdes%j1(arrdes%NY0), "interior starting j not match") - ref = ArrayReference(A) - _ASSERT( size(a,1) == in-i1+1, "size not match") - _ASSERT( size(a,2) == jn-j1+1, "size not match") - call oClients%collective_stage_data(arrdes%collection_id,trim(arrdes%filename),trim(name), & - ref,start=[i1,j1,1], & - global_start=[1,1,1], global_count=[global_dim(1),global_dim(2),size(a,3)]) - _RETURN(_SUCCESS) - endif + enddo endif - - do l=1,size(a,3) - call MAPL_VarWrite(formatter,name,A(:,:,l), arrdes=arrdes,lev=l, rc=status) - _VERIFY(status) - enddo - _RETURN(ESMF_SUCCESS) end subroutine MAPL_VarWriteNCpar_R4_3d @@ -830,7 +859,7 @@ subroutine MAPL_VarWriteNCpar_R4_2d(formatter, name, A, ARRDES, lev, offset2, oC ref,start=[i1,j1], & global_start=[1,1], global_count=[global_dim(1),global_dim(2)]) _RETURN(_SUCCESS) - endif + end if endif AM_WRITER = .false. From 1c0a29511144f9f168b5fe98b5a482131ad6b488 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Thu, 12 Jan 2023 15:50:32 -0500 Subject: [PATCH 2/4] make r4_3d and r8_3d the same --- base/NCIO.F90 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/base/NCIO.F90 b/base/NCIO.F90 index 617ea77ec258..b0660558c282 100644 --- a/base/NCIO.F90 +++ b/base/NCIO.F90 @@ -781,14 +781,12 @@ subroutine MAPL_VarWriteNCpar_R8_3d(formatter, name, A, ARRDES, oClients, RC) call oClients%collective_stage_data(arrdes%collection_id,trim(arrdes%filename),trim(name), & ref,start=[i1,j1,1], & global_start=[1,1,1], global_count=[global_dim(1),global_dim(2),size(a,3)]) - _RETURN(_SUCCESS) - endif - - do l=1,size(a,3) - call MAPL_VarWrite(formatter,name,A(:,:,l),arrdes,lev=l, rc=status) - _VERIFY(status) - enddo - + else + do l=1,size(a,3) + call MAPL_VarWrite(formatter,name,A(:,:,l),arrdes,lev=l, rc=status) + _VERIFY(status) + enddo + end if _RETURN(ESMF_SUCCESS) end subroutine MAPL_VarWriteNCpar_R8_3d From d9b625715761eb16401dda222f6a41b949ac1c22 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Thu, 12 Jan 2023 16:14:34 -0500 Subject: [PATCH 3/4] fix typo in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50c18e8b27a..4aba902cb6ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed bug when writing 4D fields to checkpoint files with the via the WRITE_RESTART_BY_OSERVER option +- Fixed bug when writing 4D fields to checkpoint files with the PFIO server via the WRITE_RESTART_BY_OSERVER option ### Removed From 14bbfd6e63c9840ea985d1a9aa061f7bfba5a292 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 13 Jan 2023 10:21:29 -0500 Subject: [PATCH 4/4] Prepare for 2.34.1 release --- CHANGELOG.md | 8 ++++++-- CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aba902cb6ca..cee214b80442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed bug when writing 4D fields to checkpoint files with the PFIO server via the WRITE_RESTART_BY_OSERVER option - ### Removed ### Deprecated +## [2.34.1] - 2023-01-13 + +### Fixed + +- Fixed bug when writing 4D fields to checkpoint files with the PFIO server via the WRITE_RESTART_BY_OSERVER option + ## [2.34.0] - 2023-01-05 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eabbd63a9e5..81964eb7ae4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW) project ( MAPL - VERSION 2.34.0 + VERSION 2.34.1 LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF # Set the default build type to release