Skip to content

Commit

Permalink
Set rearr opts using pio interface
Browse files Browse the repository at this point in the history
Instead of filling in and passing pio_rearr_opt_t type in pio_init,
we now use pio_set_rearr_opts() interface to set the rearranger
options.

This change decouples the cime shared code from pio by avoiding
accessing the internal pio type (pio_rearr_opt_t) to set the
rearranger options.

This change requires pio1 to support the pio_set_rearr_opts()
interface.

Fixes #1296
  • Loading branch information
jayeshkrishna committed Apr 14, 2017
1 parent cabec9b commit ac3e863
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions share/util/shr_pio_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ module shr_pio_mod
integer, allocatable :: io_compid(:)
integer :: pio_debug_level=0, pio_blocksize=0
integer(kind=pio_offset_kind) :: pio_buffer_size_limit=-1
type(pio_rearr_opt_t) :: pio_rearr_opts
integer :: pio_rearr_opt_comm_type, pio_rearr_opt_fcd
logical :: pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend
integer :: pio_rearr_opt_c2i_max_pend_req
logical :: pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend
integer :: pio_rearr_opt_i2c_max_pend_req
integer :: total_comps=0

#define DEBUGI 1
Expand Down Expand Up @@ -144,6 +148,7 @@ subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_ia
integer :: ncomps
character(len=shr_kind_cl) :: nlfilename, cname
type(iosystem_desc_t) :: iosys
integer :: ret
character(*), parameter :: subName = '(shr_pio_init2) '

if(pio_debug_level>0) then
Expand Down Expand Up @@ -177,7 +182,18 @@ subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_ia

if(pio_async_interface) then
#ifdef PIO1
call pio_init(total_comps,mpi_comm_world, comp_comm, io_comm, iosystems, rearr_opts=pio_rearr_opts)
call pio_init(total_comps,mpi_comm_world, comp_comm, io_comm, iosystems)
do i=1,total_comps
ret = pio_set_rearr_opts(iosystems(i), pio_rearr_opt_comm_type,&
pio_rearr_opt_fcd,&
pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend,&
pio_rearr_opt_c2i_max_pend_req,&
pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend,&
pio_rearr_opt_i2c_max_pend_req)
if(ret /= PIO_NOERR) then
write(shr_log_unit,*) "ERROR: Setting rearranger options failed"
end if
end do

#else
call pio_init(total_comps,mpi_comm_world, comp_comm, io_comm, iosystems)
Expand All @@ -199,7 +215,16 @@ subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_ia
call pio_init(comp_comm_iam(i), comp_comm(i), pio_comp_settings(i)%pio_numiotasks, 0, &
pio_comp_settings(i)%pio_stride, &
pio_comp_settings(i)%pio_rearranger, iosystems(i), &
base=pio_comp_settings(i)%pio_root, rearr_opts=pio_rearr_opts)
base=pio_comp_settings(i)%pio_root)
ret = pio_set_rearr_opts(iosystems(i), pio_rearr_opt_comm_type,&
pio_rearr_opt_fcd,&
pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend,&
pio_rearr_opt_c2i_max_pend_req,&
pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend,&
pio_rearr_opt_i2c_max_pend_req)
if(ret /= PIO_NOERR) then
write(shr_log_unit,*) "ERROR: Setting rearranger options failed"
end if
if(comp_comm_iam(i)==0) then
write(shr_log_unit,*) io_compname(i),' : pio_numiotasks = ',pio_comp_settings(i)%pio_numiotasks
write(shr_log_unit,*) io_compname(i),' : pio_stride = ',pio_comp_settings(i)%pio_stride
Expand Down Expand Up @@ -782,29 +807,29 @@ subroutine shr_pio_rearr_opts_set(comm, pio_rearr_comm_type, pio_rearr_comm_fcd,
! buf(6) = max_pend_req_io2comp
! buf(7) = enable_hs_io2comp
! buf(8) = enable_isend_io2comp
pio_rearr_opts%comm_type = buf(1)
pio_rearr_opts%fcd = buf(2)
pio_rearr_opts%comm_fc_opts_comp2io%max_pend_req = buf(3)
pio_rearr_opt_comm_type = buf(1)
pio_rearr_opt_fcd = buf(2)
pio_rearr_opt_c2i_max_pend_req = buf(3)
if(buf(4) == 0) then
pio_rearr_opts%comm_fc_opts_comp2io%enable_hs = .false.
pio_rearr_opt_c2i_enable_hs = .false.
else
pio_rearr_opts%comm_fc_opts_comp2io%enable_hs = .true.
pio_rearr_opt_c2i_enable_hs = .true.
end if
if(buf(5) == 0) then
pio_rearr_opts%comm_fc_opts_comp2io%enable_isend = .false.
pio_rearr_opt_c2i_enable_isend = .false.
else
pio_rearr_opts%comm_fc_opts_comp2io%enable_isend = .true.
pio_rearr_opt_c2i_enable_isend = .true.
end if
pio_rearr_opts%comm_fc_opts_io2comp%max_pend_req = buf(6)
pio_rearr_opt_i2c_max_pend_req = buf(6)
if(buf(7) == 0) then
pio_rearr_opts%comm_fc_opts_io2comp%enable_hs = .false.
pio_rearr_opt_i2c_enable_hs = .false.
else
pio_rearr_opts%comm_fc_opts_io2comp%enable_hs = .true.
pio_rearr_opt_i2c_enable_hs = .true.
end if
if(buf(8) == 0) then
pio_rearr_opts%comm_fc_opts_io2comp%enable_isend = .false.
pio_rearr_opt_i2c_enable_isend = .false.
else
pio_rearr_opts%comm_fc_opts_io2comp%enable_isend = .true.
pio_rearr_opt_i2c_enable_isend = .true.
end if
end subroutine
!===============================================================================
Expand Down

0 comments on commit ac3e863

Please sign in to comment.