Skip to content

Commit

Permalink
Merge pull request #1352 from ESMCI/jayeshkrishna/bring_latest_pio1
Browse files Browse the repository at this point in the history
Bring in latest version of PIO1 to CIME. This merge includes,

*    A new interface to set rearranger options
*    Cleanup of the pio1 cmake configure files

Test suite: X case
Test baseline: NA
Test namelist changes: None
Test status: bit for bit

User interface changes?: New PIO1 interface to set rearranger options

Code review: @jedwards4b
  • Loading branch information
jayeshkrishna authored Apr 14, 2017
2 parents 9240cf2 + 6b6d50c commit be0f9a4
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/externals/pio1/pio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -29,11 +29,8 @@ 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)
FIND_PACKAGE(NetCDF "4.3.3" COMPONENTS Fortran)
IF (${NetCDF_Fortran_FOUND})
MESSAGE("Building PIO with netcdf support ")
SET(pio_include_dirs_ ${pio_include_dirs_} ${NetCDF_Fortran_INCLUDE_DIR})
Expand All @@ -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 ()
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/externals/pio1/pio/pio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand Down
73 changes: 73 additions & 0 deletions src/externals/pio1/pio/piolib_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module piolib_mod
public :: PIO_init, &
PIO_finalize, &
PIO_initdecomp, &
PIO_set_rearr_opts,&
PIO_openfile, &
PIO_syncfile, &
PIO_createfile, &
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit be0f9a4

Please sign in to comment.