Skip to content

Commit

Permalink
PDAF: refactor cime/mct routines
Browse files Browse the repository at this point in the history
- remove commented out debug output
- small style changes with the goal of being close to CIME tag
  `cime5.6.47`
  • Loading branch information
jjokella committed Jun 19, 2024
1 parent c434963 commit 48d6e96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/csm_share/mct/seq_comm_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -611,15 +611,11 @@ subroutine comp_comm_init(driver_comm, comp_rootpe, comp_nthreads, comp_layout,
pelist(2,1) = cmax(n)
pelist(3,1) = cstr(n)
endif
#ifdef USE_PDAF
!write(*,*) "before seq_comm_set_comm bcast", pelist, DRIVER_COMM
#endif
call mpi_bcast(pelist, size(pelist), MPI_INTEGER, 0, DRIVER_COMM, ierr)

#ifdef USE_PDAF
if (present(pdaf_id) .and. present(pdaf_max)) then
!write(*,*) "before seq_comm_setcomm", pdaf_id, pdaf_max, mype, n, &
! COMPID(n), pelist, comp_nthreads, name
call seq_comm_setcomm(COMPID(n),pelist,nthreads=comp_nthreads,iname=name,inst=pdaf_id,tinst=pdaf_max)
call seq_comm_setcomm(COMPID(n),pelist,nthreads=comp_nthreads,iname=name,inst=pdaf_id,tinst=pdaf_max)
else if (present(drv_comm_id)) then
#else
if (present(drv_comm_id)) then
Expand Down
15 changes: 8 additions & 7 deletions src/eclm/cime_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module cime_comp_mod
#if defined(USE_OASIS)
use mod_oasis
#endif

!----------------------------------------------------------------------------
! component model interfaces (init, run, final methods)
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -591,24 +592,26 @@ subroutine cime_pre_init1(esmf_log_option)
#endif
use shr_pio_mod, only : shr_pio_init1, shr_pio_init2
use seq_comm_mct, only: num_inst_driver

!----------------------------------------------------------
!| Initialize MCT and MPI communicators and IO
!----------------------------------------------------------

character(CS), intent(out) :: esmf_log_option ! For esmf_logfile_kind

#ifdef USE_PDAF
integer, optional, intent(in) :: pdaf_comm
integer, optional, intent(in) :: pdaf_id
integer, optional, intent(in) :: pdaf_max
#endif

integer, dimension(num_inst_total) :: comp_id, comp_comm, comp_comm_iam
logical :: comp_iamin(num_inst_total)
character(len=seq_comm_namelen) :: comp_name(num_inst_total)
integer :: it
integer :: driver_id, oas_comp_id
integer :: driver_id
integer :: driver_comm
#if defined(USE_OASIS)
integer :: oas_comp_id
#endif

#ifndef USE_PDAF
call mpi_init(ierr)
Expand All @@ -628,7 +631,6 @@ subroutine cime_pre_init1(esmf_log_option)
#ifdef USE_PDAF
if (present(pdaf_comm)) then
global_comm = pdaf_comm
!write(*,*) "PDAF_COMM present"
else
call mpi_comm_dup(MPI_COMM_WORLD, global_comm, ierr)
call shr_mpi_chkerr(ierr,subname//' mpi_comm_dup')
Expand Down Expand Up @@ -4320,10 +4322,9 @@ subroutine cime_cpl_init(comm_in, comm_out, num_inst_driver, id)
end if

#ifdef USE_PDAF
!write(*,*) "just before split", comm_in, pdaf_id, mype, numpes, comm_out
if (pdaf_max > 1) then
call mpi_comm_split(comm_in, pdaf_id, 0, comm_out, ierr)
call shr_mpi_chkerr(ierr,subname//' mpi_comm_split')
call mpi_comm_split(comm_in, pdaf_id, 0, comm_out, ierr)
call shr_mpi_chkerr(ierr,subname//' mpi_comm_split')
else if (num_inst_driver == 1) then
#else
if (num_inst_driver == 1) then
Expand Down

0 comments on commit 48d6e96

Please sign in to comment.