Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parallel netcdf for regional applications #175

Merged
merged 4 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions io/module_wrt_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module module_wrt_grid_comp
n_group, num_files, app_domain, &
filename_base, output_grid, output_file, &
imo,jmo,ichunk2d,jchunk2d,write_nemsioflip,&
ichunk3d,jchunk3d,kchunk3d, &
ichunk3d,jchunk3d,kchunk3d,nbits, &
nsout => nsout_io, &
cen_lon, cen_lat, &
lon1, lat1, lon2, lat2, dlon, dlat, &
Expand Down Expand Up @@ -683,7 +683,7 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
!
! get output file name
call ESMF_AttributeGet(fcstField(i), convention="NetCDF", purpose="FV3", &
call ESMF_AttributeGet(fcstField(j), convention="NetCDF", purpose="FV3", &
name="output_file", value=outfile_name, rc=rc)

if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
Expand Down Expand Up @@ -1619,7 +1619,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc)
write(*,'(A,F10.5,A,I4.2,A,I2.2)')' mask_fields time is ',wend-wbeg
endif

if (trim(output_file(nbdl)) == 'netcdf') then
if (trim(output_file(nbdl)) == 'netcdf' .and. nbits==0) then

wbeg = MPI_Wtime()
call write_netcdf(file_bundle,wrt_int_state%wrtFB(nbdl),trim(filename), &
Expand All @@ -1631,10 +1631,32 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc)
,' at Fcst ',NF_HOURS,':',NF_MINUTES
endif

else if (trim(output_file(nbdl)) == 'netcdf_parallel' .and. nbits==0) then

#ifdef NO_PARALLEL_NETCDF
rc = ESMF_RC_NOT_IMPL
print *,'netcdf_parallel not available on this machine'
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__)) return
#endif
wbeg = MPI_Wtime()
call write_netcdf_parallel(file_bundle,wrt_int_state%wrtFB(nbdl), &
trim(filename), wrt_mpi_comm,wrt_int_state%mype,imo,jmo,&
ichunk2d,jchunk2d,ichunk3d,jchunk3d,kchunk3d,rc)
wend = MPI_Wtime()
if (lprnt) then
write(*,'(A,F10.5,A,I4.2,A,I2.2)')' parallel netcdf Write Time is ',wend-wbeg &
,' at Fcst ',NF_HOURS,':',NF_MINUTES
endif
else ! unknown output_file

call ESMF_LogWrite("wrt_run: Unknown output_file",ESMF_LOGMSG_ERROR,rc=RC)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if( nbits /= 0) then
call ESMF_LogWrite("wrt_run: lossy compression is not supported for regional grids",ESMF_LOGMSG_ERROR,rc=RC)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
else
call ESMF_LogWrite("wrt_run: Unknown output_file",ESMF_LOGMSG_ERROR,rc=RC)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
endif

endif

Expand Down
5 changes: 3 additions & 2 deletions module_fv3_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ module module_fv3_config
implicit none
!
integer :: nfhout, nfhout_hf, nsout, dt_atmos
integer :: nfhmax, nfhmax_hf, first_kdt
integer :: nfhmax_hf, first_kdt
integer :: num_restart_interval
integer :: frestart(1000)
real :: nfhmax
type(ESMF_Alarm) :: alarm_output_hf, alarm_output
type(ESMF_TimeInterval) :: output_hfmax
type(ESMF_TimeInterval) :: output_interval,output_interval_hf
Expand All @@ -26,7 +27,7 @@ module module_fv3_config
logical :: force_date_from_configure
logical :: restart_endfcst
!
integer,dimension(:),allocatable :: restart_interval
real,dimension(:),allocatable :: restart_interval
character(esmf_maxstr),dimension(:),allocatable :: filename_base
character(17) :: calendar=' '
integer :: calendar_type = -99
Expand Down