From d710062cfb5890b751ac562ad28c1fb67cd80543 Mon Sep 17 00:00:00 2001 From: JanStreffing Date: Fri, 3 Jul 2020 11:22:53 +0200 Subject: [PATCH] improvements and more output --- src/io_meandata.F90 | 22 ++++++++++++++++++++-- src/io_restart.F90 | 14 +++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/io_meandata.F90 b/src/io_meandata.F90 index 809627dd9..c9e6039fe 100644 --- a/src/io_meandata.F90 +++ b/src/io_meandata.F90 @@ -593,8 +593,9 @@ subroutine create_new_file(entry) endif if (entry%ndim==1) then - entry%error_status(c) = nf_def_var_chunking(entry%ncid, entry%varID, NF_CHUNKED, (/1/)); c=c+1 + entry%error_status(c) = nf_def_var_chunking(entry%ncid, entry%varID, NF_CONTIGUOUS, (/1/)); c=c+1 elseif (entry%ndim==2) then + write(*,*) "size: ", entry%glsize(1) entry%error_status(c) = nf_def_var_chunking(entry%ncid, entry%varID, NF_CHUNKED, (/1, entry%glsize(1)/)); c=c+1 endif @@ -672,13 +673,14 @@ subroutine write_mean(entry, mesh) type(t_mesh), intent(in) , target :: mesh integer :: i, size1, size2 integer :: c, lev + real(kind=WP) :: t0, t1, t2, t3 #include "associate_mesh.h" ! Serial output implemented so far if (mype==0) then c=1 - write(*,*) 'writing mean record for ', trim(entry%name), '; rec. count = ', entry%rec_count + write(*,*) 'writing mean record for ', trim(entry%name), '; rec. count = ', entry%rec_count, '; bytes = ', entry%accuracy entry%error_status(c)=nf_open(entry%filename, nf_write, entry%ncid); c=c+1 entry%error_status(c)=nf_put_vara_double(entry%ncid, entry%Tid, entry%rec_count, 1, ctime, 1); c=c+1 end if @@ -693,16 +695,22 @@ subroutine write_mean(entry, mesh) if (mype==0) then entry%error_status(c)=nf_put_vara_double(entry%ncid, entry%varID, (/1, entry%rec_count/), (/size1, 1/), aux_r8, 1); c=c+1 end if + if (mype==0) deallocate(aux_r8) !___________writing real 4 byte real _________________________________________ elseif (entry%accuracy == i_real4) then if (mype==0) allocate(aux_r4(size1)) + t0=MPI_Wtime() if (size1==nod2D) call gather_nod (entry%local_values_r4(1:entry%lcsize(1),1), aux_r4) if (size1==elem2D) call gather_elem(entry%local_values_r4(1:entry%lcsize(1),1), aux_r4) + t1=MPI_Wtime() if (mype==0) then entry%error_status(c)=nf_put_vara_real(entry%ncid, entry%varID, (/1, entry%rec_count/), (/size1, 1/), aux_r4, 1); c=c+1 end if + t2=MPI_Wtime() + if (mype==0) write(*,*) 'size: ', size1, 'gather_nod: ', t1-t0 + if (mype==0) write(*,*) 'size: ', size1, 'nf_put_var: ', t2-t1 if (mype==0) deallocate(aux_r4) !___________writing real as 2 byte integer _________________________________________ @@ -729,22 +737,32 @@ subroutine write_mean(entry, mesh) if (entry%accuracy == i_real8) then if (mype==0) allocate(aux_r8(size2)) do lev=1, size1 + t0=MPI_Wtime() if (size1==nod2D .or. size2==nod2D) call gather_nod (entry%local_values_r8(lev,1:entry%lcsize(2)), aux_r8) if (size1==elem2D .or. size2==elem2D) call gather_elem(entry%local_values_r8(lev,1:entry%lcsize(2)), aux_r8) + t1=MPI_Wtime() if (mype==0) then entry%error_status(c)=nf_put_vara_double(entry%ncid, entry%varID, (/lev, 1, entry%rec_count/), (/1, size2, 1/), aux_r8, 1); c=c+1 end if + t2=MPI_Wtime() + if (mype==0) write(*,*) 'size: ', size2, 'lev: ', lev, 'gather_nod: ',t1-t0 + if (mype==0) write(*,*) 'size: ', size2, 'lev: ', lev, 'nf_put_var: ',t2-t1 end do if (mype==0) deallocate(aux_r8) !___________writing real 4 byte real _________________________________________ elseif (entry%accuracy == i_real4) then if (mype==0) allocate(aux_r4(size2)) do lev=1, size1 + t0=MPI_Wtime() if (size1==nod2D .or. size2==nod2D) call gather_nod (entry%local_values_r4(lev,1:entry%lcsize(2)), aux_r4) if (size1==elem2D .or. size2==elem2D) call gather_elem(entry%local_values_r4(lev,1:entry%lcsize(2)), aux_r4) + t1=MPI_Wtime() if (mype==0) then entry%error_status(c)=nf_put_vara_real(entry%ncid, entry%varID, (/lev, 1, entry%rec_count/), (/1, size2, 1/), aux_r4, 1); c=c+1 end if + t2=MPI_Wtime() + if (mype==0) write(*,*) 'size: ', size2, 'lev: ', lev, 'gather_nod: ',t1-t0 + if (mype==0) write(*,*) 'size: ', size2, 'lev: ', lev, 'nf_put_var: ',t2-t1 end do if (mype==0) deallocate(aux_r4) !___________writing real as 2 byte integer _________________________________________ diff --git a/src/io_restart.F90 b/src/io_restart.F90 index 915da0a4b..811b37756 100644 --- a/src/io_restart.F90 +++ b/src/io_restart.F90 @@ -310,9 +310,9 @@ subroutine create_new_file(id) !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 - 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 + !if (n==1) then + ! id%error_status(c)=nf_def_var_chunking(id%ncid, id%var(j)%code, NF_CHUNKED, (/1/)); c=c+1 + if (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 @@ -459,9 +459,13 @@ subroutine write_restart(id, istep, mesh) 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) + t1=MPI_Wtime() if (mype==0) then id%error_status(c)=nf_put_vara_double(id%ncid, id%var(i)%code, (/1, id%rec_count/), (/size1, 1/), aux, 1); c=c+1 end if + t2=MPI_Wtime() + if (mype==0) write(*,*) 'nvar: ', i, 'size: ', size1, 'gather_nod: ', t1-t0 + if (mype==0) write(*,*) 'nvar: ', i, 'size: ', size1, 'nf_put_var: ', t2-t1 if (mype==0) deallocate(aux) !_______writing 3D fields________________________________________________ elseif (shape==2) then @@ -482,8 +486,8 @@ subroutine write_restart(id, istep, mesh) 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 + if (mype==0) write(*,*) 'nvar: ', i, 'size: ', size2, 'lev: ', lev, 'gather_nod: ', t1-t0 + if (mype==0) write(*,*) 'nvar: ', i, 'size: ', size2, 'lev: ', lev, 'nf_put_var: ', t2-t1 end do deallocate(laux) if (mype==0) deallocate(aux)