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 PnetCDF Non-blocking APIs to Perform I/O #2058

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions Registry/registry.io_boilerplate
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ rconfig logical self_test_domain namelist,time_control 1
rconfig character history_outname namelist,time_control 1 "wrfout_d<domain>_<date>" - "name of history outfile" "" ""
rconfig character history_inname namelist,time_control 1 "wrfhist_d<domain>_<date>" - "name of history infile" "" ""
rconfig logical use_netcdf_classic namelist,time_control 1 .false. - "use_netcdf_classic" "" ""
rconfig logical enable_pnetcdf_bput namelist,time_control 1 .false. - "enable_pnetcdf_bput" "" ""

rconfig integer history_interval_d namelist,time_control max_domains 0 h "history_interval_d" "" "DAYS"
rconfig integer history_interval_h namelist,time_control max_domains 0 h "history_interval_h" "" "HOURS"
Expand Down
2 changes: 1 addition & 1 deletion external/io_pnetcdf/ext_pnc_put_dom_ti.code
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ IF ( ncd_ok_to_put_dom_ti( DataHandle ) ) THEN
return
endif
elseif (DH%FileStatus == WRF_FILE_OPENED_FOR_WRITE) then
stat = NFMPI_REDEF(DH%NCID)
call try_redef(DH, stat)
call netcdf_err(stat,Status)
if(Status /= WRF_NO_ERR) then
write(msg,*) &
Expand Down
36 changes: 28 additions & 8 deletions external/io_pnetcdf/field_routines.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
!* Date: October 6, 2000
!*
!*----------------------------------------------------------------------------
subroutine ext_pnc_RealFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
subroutine ext_pnc_RealFieldIO(Coll,IO,NCID,VarID,VStart,VCount,EnableBput,Data,Status)
use wrf_data_pnc
use ext_pnc_support_routines
implicit none
Expand All @@ -45,16 +45,21 @@ subroutine ext_pnc_RealFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
integer ,intent(in) :: VarID
integer ,dimension(NVarDims),intent(in) :: VStart
integer ,dimension(NVarDims),intent(in) :: VCount
logical ,intent(in) :: EnableBput
real, dimension(*) ,intent(inout) :: Data
integer ,intent(out) :: Status
integer :: stat
!local
integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
integer :: BputReqID
VStart_mpi = VStart
VCount_mpi = VCount

if(IO == 'write') then
if(Coll)then
if(EnableBput)then
! Calling non-blocking buffered-version API
stat = NFMPI_BPUT_VARA_REAL(NCID,VarID,VStart_mpi,VCount_mpi,Data,BputReqID)
else if(Coll)then
stat = NFMPI_PUT_VARA_REAL_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
else
stat = NFMPI_PUT_VARA_REAL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
Expand All @@ -74,7 +79,7 @@ subroutine ext_pnc_RealFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
return
end subroutine ext_pnc_RealFieldIO

subroutine ext_pnc_DoubleFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
subroutine ext_pnc_DoubleFieldIO(Coll,IO,NCID,VarID,VStart,VCount,EnableBput,Data,Status)
use wrf_data_pnc
use ext_pnc_support_routines
implicit none
Expand All @@ -86,16 +91,21 @@ subroutine ext_pnc_DoubleFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
integer ,intent(in) :: VarID
integer ,dimension(NVarDims),intent(in) :: VStart
integer ,dimension(NVarDims),intent(in) :: VCount
logical ,intent(in) :: EnableBput
real*8 ,intent(inout) :: Data
integer ,intent(out) :: Status
integer :: stat
!local
integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
integer :: BputReqID
VStart_mpi = VStart
VCount_mpi = VCount

if(IO == 'write') then
if(Coll)then
if(EnableBput)then
! Calling non-blocking buffered-version API
stat = NFMPI_BPUT_VARA_DOUBLE(NCID,VarID,VStart_mpi,VCount_mpi,Data,BputReqID)
else if(Coll)then
stat = NFMPI_PUT_VARA_DOUBLE_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
else
stat = NFMPI_PUT_VARA_DOUBLE(NCID,VarID,VStart_mpi,VCount_mpi,Data)
Expand All @@ -115,7 +125,7 @@ subroutine ext_pnc_DoubleFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
return
end subroutine ext_pnc_DoubleFieldIO

subroutine ext_pnc_IntFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
subroutine ext_pnc_IntFieldIO(Coll,IO,NCID,VarID,VStart,VCount,EnableBput,Data,Status)
use wrf_data_pnc
use ext_pnc_support_routines
implicit none
Expand All @@ -127,16 +137,21 @@ subroutine ext_pnc_IntFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
integer ,intent(in) :: VarID
integer ,dimension(NVarDims),intent(in) :: VStart
integer ,dimension(NVarDims),intent(in) :: VCount
logical ,intent(in) :: EnableBput
integer ,intent(inout) :: Data
integer ,intent(out) :: Status
integer :: stat
!local
integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
integer :: BputReqID
VStart_mpi = VStart
VCount_mpi = VCount

if(IO == 'write') then
if(Coll)then
if(EnableBput)then
! Calling non-blocking buffered-version API
stat = NFMPI_BPUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Data,BputReqID)
else if(Coll)then
stat = NFMPI_PUT_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
else
stat = NFMPI_PUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Data)
Expand All @@ -156,7 +171,7 @@ subroutine ext_pnc_IntFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
return
end subroutine ext_pnc_IntFieldIO

subroutine ext_pnc_LogicalFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
subroutine ext_pnc_LogicalFieldIO(Coll,IO,NCID,VarID,VStart,VCount,EnableBput,Data,Status)
use wrf_data_pnc
use ext_pnc_support_routines
implicit none
Expand All @@ -168,13 +183,15 @@ subroutine ext_pnc_LogicalFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
integer ,intent(in) :: VarID
integer,dimension(NVarDims) ,intent(in) :: VStart
integer,dimension(NVarDims) ,intent(in) :: VCount
logical ,intent(in) :: EnableBput
logical,dimension(VCount(1),VCount(2),VCount(3)),intent(inout) :: Data
integer ,intent(out) :: Status
integer,dimension(:,:,:),allocatable :: Buffer
integer :: stat
integer :: i,j,k
!local
integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
integer :: BputReqID
VStart_mpi = VStart
VCount_mpi = VCount

Expand All @@ -197,7 +214,10 @@ subroutine ext_pnc_LogicalFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
enddo
enddo
enddo
if(Coll)then
if(EnableBput)then
! Calling non-blocking buffered-version API
stat = NFMPI_BPUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Buffer,BputReqID)
else if(Coll)then
stat = NFMPI_PUT_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
else
stat = NFMPI_PUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
Expand Down
Loading