diff --git a/src/externals/pio1/pio/CMakeLists.txt b/src/externals/pio1/pio/CMakeLists.txt index 3b10c1a2cbd..a23ee13b548 100644 --- a/src/externals/pio1/pio/CMakeLists.txt +++ b/src/externals/pio1/pio/CMakeLists.txt @@ -9,7 +9,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) IF (USER_CMAKE_MODULE_PATH) SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${USER_CMAKE_MODULE_PATH}) ELSE() - SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../pio2/cmake") + SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ENDIF() find_file( TESTFILE NAMES TryCSizeOf.f90 PATHS ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH) get_filename_component( TESTFILEPATH ${TESTFILE} PATH) @@ -29,9 +29,6 @@ IF(${WITH_CSIZEOF} STREQUAL FALSE) endif() # Netcdf is required - -SET (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../pio2/cmake" ${CMAKE_MODULE_PATH}) - #SET (NETCDF_FIND_COMPONENTS F90) FIND_PACKAGE(NetCDF "4.3.3" COMPONENTS C Fortran) IF (${NetCDF_Fortran_FOUND}) @@ -46,7 +43,7 @@ ENDIF () # PNetcdf is optional but used by default OPTION(WITH_PNETCDF "Whether to build with PnetCDF" TRUE) IF (${WITH_PNETCDF}) - FIND_PACKAGE(PnetCDF REQUIRED) + FIND_PACKAGE(PnetCDF REQUIRED COMPONENTS Fortran) ELSE () MESSAGE(WARNING "Warning: Not building with PNetcdf - cannot run all regression tests.") ENDIF () @@ -84,8 +81,8 @@ IF(NetCDF_Fortran_FOUND) ELSE() SET(bld_PIO_DEFINITIONS ${bld_PIO_DEFINITIONS} -D_NONETCDF) ENDIF() -IF(PnetCDF_C_FOUND) - SET(pio_include_dirs_ ${pio_include_dirs_} ${PNetCDF_INCLUDE_DIR}) +IF(PnetCDF_Fortran_FOUND) + SET(pio_include_dirs_ ${pio_include_dirs_} ${PnetCDF_Fortran_INCLUDE_DIRS}) SET(bld_PIO_DEFINITIONS ${bld_PIO_DEFINITIONS} -D_PNETCDF) ELSE() SET(bld_PIO_DEFINITIONS ${bld_PIO_DEFINITIONS} -D_NOPNETCDF) diff --git a/src/externals/pio1/pio/pio.F90 b/src/externals/pio1/pio/pio.F90 index bcc41a32e37..b8e3a828a30 100644 --- a/src/externals/pio1/pio/pio.F90 +++ b/src/externals/pio1/pio/pio.F90 @@ -12,7 +12,7 @@ module pio ! only pio_offset is intended for export from kinds use pio_kinds, only : pio_offset - use piolib_mod, only : pio_initdecomp, & + use piolib_mod, only : pio_initdecomp, pio_set_rearr_opts, & pio_openfile, pio_closefile, pio_createfile, pio_setdebuglevel, & pio_seterrorhandling, pio_setframe, pio_init, pio_get_local_array_size, & pio_freedecomp, pio_syncfile,pio_numtowrite,pio_numtoread,pio_setiotype, & diff --git a/src/externals/pio1/pio/pio_types.F90 b/src/externals/pio1/pio/pio_types.F90 index 3c6f0c78af6..02b0491a273 100644 --- a/src/externals/pio1/pio/pio_types.F90 +++ b/src/externals/pio1/pio/pio_types.F90 @@ -79,7 +79,7 @@ module pio_types !! @defgroup PIO_rearr_comm_fc_options PIO_rearr_comm_fc_options !! @brief Type that defines the PIO rearranger options !! @details -!! - enable_hs : Enable handshake (true/false) +!! - enable_hs : Enable handshake (true/false) !! - enable_isend : Enable Isends (true/false) !! - max_pend_req : Maximum pending requests (To indicated unlimited !! number of requests use PIO_REARR_COMM_UNLIMITED_PEND_REQ) diff --git a/src/externals/pio1/pio/piolib_mod.F90 b/src/externals/pio1/pio/piolib_mod.F90 index 85993aa9e38..46a8738b366 100644 --- a/src/externals/pio1/pio/piolib_mod.F90 +++ b/src/externals/pio1/pio/piolib_mod.F90 @@ -58,6 +58,7 @@ module piolib_mod public :: PIO_init, & PIO_finalize, & PIO_initdecomp, & + PIO_set_rearr_opts,& PIO_openfile, & PIO_syncfile, & PIO_createfile, & @@ -1602,7 +1603,7 @@ subroutine init_iosystem_rearr_options(iosystem) #ifdef _NO_FLOW_CONTROL iosystem%rearr_opts%fcd = PIO_rearr_comm_fc_2d_disable #else - ! We ignore the following flags + ! We ignore the following flags ! 1) _MPISERIAL : The flow control code is never used when _MPISERIAL is set ! 2) _USE_COMP2IO_FC/_USE_IO2COMP_FC : These flags are not currently used ! (These were experimental flags). The user can explicitly control @@ -1622,6 +1623,78 @@ subroutine init_iosystem_rearr_options(iosystem) end subroutine init_iosystem_rearr_options + function PIO_set_rearr_opts(iosystem, comm_type, fcd,& + enable_hs_c2i, enable_isend_c2i,& + max_pend_req_c2i,& + enable_hs_i2c, enable_isend_i2c,& + max_pend_req_i2c) result(ierr) + + use pio_types + + type (iosystem_desc_t), intent(inout) :: iosystem + integer, intent(in) :: comm_type, fcd + logical, intent(in) :: enable_hs_c2i, enable_hs_i2c + logical, intent(in) :: enable_isend_c2i, enable_isend_i2c + integer, intent(in) :: max_pend_req_c2i, max_pend_req_i2c + + integer :: ierr + + ierr = PIO_NOERR + + if(max_pend_req_c2i < 0) then + if(max_pend_req_c2i /= PIO_REARR_COMM_UNLIMITED_PEND_REQ) then + call piodie(__PIO_FILE__,__LINE__,& + "Invalid max pend req (comp to io) specified") + end if + end if + if(max_pend_req_i2c < 0) then + if(max_pend_req_i2c /= PIO_REARR_COMM_UNLIMITED_PEND_REQ) then + call piodie(__PIO_FILE__,__LINE__,& + "Invalid max pend req (io to comp) specified") + end if + end if + + iosystem%rearr_opts%comm_type = comm_type + + ! Reset to defaults + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_hs = .false. + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_isend = .false. + iosystem%rearr_opts%comm_fc_opts_comp2io%max_pend_req = DEF_P2P_MAXREQ + + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_hs = .false. + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_isend = .false. + iosystem%rearr_opts%comm_fc_opts_io2comp%max_pend_req = DEF_P2P_MAXREQ + if(iosystem%rearr_opts%comm_type == PIO_REARR_COMM_COLL) then + ! Init/Reset rest of the structure to valid values + iosystem%rearr_opts%fcd = PIO_REARR_COMM_FC_2D_DISABLE + else if(iosystem%rearr_opts%comm_type == PIO_REARR_COMM_P2P) then + iosystem%rearr_opts%fcd = fcd + if(iosystem%rearr_opts%fcd == PIO_REARR_COMM_FC_2D_DISABLE) then + ! Nothing to do here - the opts are already reset to defaults above + else if(iosystem%rearr_opts%fcd == PIO_REARR_COMM_FC_1D_COMP2IO) then + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_hs = enable_hs_c2i + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_isend = enable_isend_c2i + iosystem%rearr_opts%comm_fc_opts_comp2io%max_pend_req = max_pend_req_c2i + else if(iosystem%rearr_opts%fcd == PIO_REARR_COMM_FC_1D_IO2COMP) then + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_hs = enable_hs_i2c + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_isend = enable_isend_i2c + iosystem%rearr_opts%comm_fc_opts_io2comp%max_pend_req = max_pend_req_i2c + else if(iosystem%rearr_opts%fcd == PIO_REARR_COMM_FC_2D_ENABLE) then + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_hs = enable_hs_c2i + iosystem%rearr_opts%comm_fc_opts_comp2io%enable_isend = enable_isend_c2i + iosystem%rearr_opts%comm_fc_opts_comp2io%max_pend_req = max_pend_req_c2i + + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_hs = enable_hs_i2c + iosystem%rearr_opts%comm_fc_opts_io2comp%enable_isend = enable_isend_i2c + iosystem%rearr_opts%comm_fc_opts_io2comp%max_pend_req = max_pend_req_i2c + else + call piodie(__PIO_FILE__,__LINE__, "Invalid flow control dir specified") + end if + else + call piodie(__PIO_FILE__,__LINE__, "Invalid comm type specified") + end if + + end function PIO_set_rearr_opts !> !! @public diff --git a/src/externals/pio1/pio/pionfput_mod.F90.in b/src/externals/pio1/pio/pionfput_mod.F90.in index 1ce9353ba2a..02e87db6000 100644 --- a/src/externals/pio1/pio/pionfput_mod.F90.in +++ b/src/externals/pio1/pio/pionfput_mod.F90.in @@ -125,7 +125,6 @@ contains ierr = nfmpi_begin_indep_data(File%fh) if(Ios%io_rank==0 .and. (ierr==NF_EINDEP .or. ierr==PIO_NOERR)) then - print *,__PIO_FILE__,__LINE__,index,count,trim(ival) ierr = nfmpi_put_vara (File%fh, varid, int(index,kind=PIO_OFFSET), & int(count,kind=PIO_OFFSET), ival, int(count,kind=PIO_OFFSET), & MPI_CHARACTER)