Skip to content

Commit

Permalink
Merge pull request #1925 from GEOS-ESM/hotfix/bmauer/fixes-#1923
Browse files Browse the repository at this point in the history
fixes issue #1923
  • Loading branch information
mathomp4 authored Jan 13, 2023
2 parents 14b9789 + 14bbfd6 commit 5d0c6ec
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### 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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
117 changes: 72 additions & 45 deletions base/NCIO.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
!---------------------------

Expand All @@ -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

Expand Down Expand Up @@ -752,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
Expand Down Expand Up @@ -830,7 +857,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.
Expand Down

0 comments on commit 5d0c6ec

Please sign in to comment.