Skip to content

Commit

Permalink
faster io on juwels through chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
JanStreffing committed Jun 30, 2020
1 parent d4139d9 commit 9bce28a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ elif [[ $LOGINHOST = ubuntu ]]; then
STRATEGY="ubuntu"
elif [[ $LOGINHOST = bsc ]]; then
STRATEGY="bsc"
elif [[ $LOGINHOST =~ ^juwels[0-9]+\.fz\-juelich\.de$ ]]; then
elif [[ $LOGINHOST =~ ^juwels[0-9]+\.ib\.juwels\.fzj\.de$ ]]; then
STRATEGY="juwels"
else
echo "can not determine environment for host: "$LOGINHOST
Expand Down
22 changes: 11 additions & 11 deletions src/ice_thermo_cpl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ subroutine thermodynamics(mesh)
rsf = 0._WP
#endif

#if defined (__oifs)
!---- different lead closing parameter for NH and SH
call r2g(geolon, geolat, coord_nod2d(1,inod), coord_nod2d(2,inod))
if (geolat.lt.0.) then
h0min = 0.75
h0max = 1.0
else
h0min = 0.5
h0max = 0.75
endif
#endif /* (__oifs) */
!#if defined (__oifs)
! !---- different lead closing parameter for NH and SH
! call r2g(geolon, geolat, coord_nod2d(1,inod), coord_nod2d(2,inod))
! if (geolat.lt.0.) then
! h0min = 0.75
! h0max = 1.0
! else
! h0min = 0.5
! h0max = 0.75
! endif
!#endif /* (__oifs) */

call ice_growth
#if defined (__oifs)
Expand Down
7 changes: 7 additions & 0 deletions src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,13 @@ subroutine create_new_file(entry)
entry%error_status(c) = nf_put_att_real(entry%ncid, entry%varID, 'scale_factor', NF_REAL, 1, entry%scale_factor); c=c+1
entry%error_status(c) = nf_put_att_real(entry%ncid, entry%varID, 'add_offset', NF_REAL, 1, entry%add_offset); c=c+1
endif

if (entry%ndim==1) then
entry%error_status(c) = nf_def_var_chunking(entry%ncid, entry%varID, NF_CHUNKED, (/1/)); c=c+1
elseif (entry%ndim==2) then
entry%error_status(c) = nf_def_var_chunking(entry%ncid, entry%varID, NF_CHUNKED, (/1, entry%glsize(1)/)); c=c+1
endif

entry%error_status(c)=nf_put_att_text(entry%ncid, entry%varID, 'description', len_trim(entry%description), entry%description); c=c+1
entry%error_status(c)=nf_put_att_text(entry%ncid, entry%varID, 'units', len_trim(entry%units), entry%units); c=c+1
entry%error_status(c)=nf_close(entry%ncid); c=c+1
Expand Down
17 changes: 14 additions & 3 deletions src/io_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,14 @@ subroutine create_new_file(id)
do l=1, id%ndim ! list all defined dimensions
if (kdim==id%dim(l)%size) dimid(k)=id%dim(l)%code
end do
!________write(*,*) kdim, ' -> ', dimid(k)__________________________________
!write(*,*) "j",j,kdim, ' -> ', dimid(k)
end do
id%error_status(c) = nf_def_var(id%ncid, trim(id%var(j)%name), NF_DOUBLE, id%var(j)%ndim+1, &
(/dimid(1:n), id%rec/), id%var(j)%code); c=c+1
id%error_status(c) = nf_def_var(id%ncid, trim(id%var(j)%name), NF_DOUBLE, id%var(j)%ndim+1, (/dimid(1:n), id%rec/), id%var(j)%code); c=c+1
if (n==1) then
id%error_status(c)=nf_def_var_chunking(id%ncid, id%var(j)%code, NF_CHUNKED, (/1/)); c=c+1
elseif (n==2) then
id%error_status(c)=nf_def_var_chunking(id%ncid, id%var(j)%code, NF_CHUNKED, (/1, id%dim(1)%size/)); c=c+1
end if
id%error_status(c)=nf_put_att_text(id%ncid, id%var(j)%code, 'description', len_trim(id%var(j)%longname), id%var(j)%longname); c=c+1
id%error_status(c)=nf_put_att_text(id%ncid, id%var(j)%code, 'units', len_trim(id%var(j)%units), id%var(j)%units); c=c+1
end do
Expand Down Expand Up @@ -430,6 +434,7 @@ subroutine write_restart(id, istep, mesh)
real(kind=WP), allocatable :: aux(:), laux(:)
integer :: i, lev, size1, size2, shape
integer :: c
real(kind=WP) :: t0, t1, t2, t3

#include "associate_mesh.h"

Expand All @@ -451,6 +456,7 @@ subroutine write_restart(id, istep, mesh)
if (shape==1) then
size1=id%var(i)%dims(1)
if (mype==0) allocate(aux(size1))
t0=MPI_Wtime()
if (size1==nod2D) call gather_nod (id%var(i)%pt1, aux)
if (size1==elem2D) call gather_elem(id%var(i)%pt1, aux)
if (mype==0) then
Expand All @@ -468,11 +474,16 @@ subroutine write_restart(id, istep, mesh)
laux=id%var(i)%pt2(lev,:)
! if (size1==nod2D .or. size2==nod2D) call gather_nod (id%var(i)%pt2(lev,:), aux)
! if (size1==elem2D .or. size2==elem2D) call gather_elem(id%var(i)%pt2(lev,:), aux)
t0=MPI_Wtime()
if (size1==nod2D .or. size2==nod2D) call gather_nod (laux, aux)
if (size1==elem2D .or. size2==elem2D) call gather_elem(laux, aux)
t1=MPI_Wtime()
if (mype==0) then
id%error_status(c)=nf_put_vara_double(id%ncid, id%var(i)%code, (/lev, 1, id%rec_count/), (/1, size2, 1/), aux, 1); c=c+1
end if
t2=MPI_Wtime()
if (mype==0 .and. size2==nod2D) write(*,*) 'nvar: ', i, 'lev: ', lev, 'gather_nod: ', t1-t0
if (mype==0 .and. size2==nod2D) write(*,*) 'nvar: ', i, 'lev: ', lev, 'nf_put_var: ', t2-t1
end do
deallocate(laux)
if (mype==0) deallocate(aux)
Expand Down

0 comments on commit 9bce28a

Please sign in to comment.