diff --git a/dglc/dglc_datamode_noevolve_mod.F90 b/dglc/dglc_datamode_noevolve_mod.F90 index c33daa49..1c6a332d 100644 --- a/dglc/dglc_datamode_noevolve_mod.F90 +++ b/dglc/dglc_datamode_noevolve_mod.F90 @@ -595,7 +595,7 @@ end subroutine dglc_datamode_noevolve_restart_write !=============================================================================== subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, & - logunit, my_task, main_task, mpicom, & + logunit, my_task, main_task, & pio_subsystem, io_type, nx_global, ny_global, rc) ! input/output arguments @@ -605,7 +605,6 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, integer , intent(in) :: logunit integer , intent(in) :: my_task integer , intent(in) :: main_task - integer , intent(in) :: mpicom type(iosystem_desc_t) , pointer :: pio_subsystem ! pio info integer , intent(in) :: io_type ! pio info integer , intent(in) :: nx_global(:) @@ -630,13 +629,16 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Determine restart file + call ESMF_VMGetCurrent(vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine restart file + ! + ! Note that we first determine existence only on the main task, then broadcast this to + ! other tasks. + exists = .false. if (trim(restfilem) == trim(nullstr)) then - exists = .false. - call ESMF_VMGetCurrent(vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return if (my_task == main_task) then write(logunit,'(a)') subname//' restart filename from rpointer '//trim(rpfile) open(newunit=nu, file=trim(rpfile), form='formatted') @@ -644,7 +646,7 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, close(nu) inquire(file=trim(restfilem), exist=exists) endif - call ESMF_VMBroadCast(vm, restfilem, CL, main_task, rc=rc) + call ESMF_VMBroadCast(vm, restfilem, len(restfilem), main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! use namelist already read @@ -655,9 +657,13 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, endif tmp = 0 if(exists) tmp=1 + call ESMF_VMBroadCast(vm, tmp, 1, main_task, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return exists = (tmp(1) == 1) - if (.not. exists .and. my_task == main_task) then - write(logunit, '(a)') subname//' file not found, skipping '//trim(restfilem) + if (.not. exists) then + if (my_task == main_task) then + write(logunit, '(a)') subname//' file not found, skipping '//trim(restfilem) + end if return end if diff --git a/dglc/glc_comp_nuopc.F90 b/dglc/glc_comp_nuopc.F90 index e7ada695..d5d81879 100644 --- a/dglc/glc_comp_nuopc.F90 +++ b/dglc/glc_comp_nuopc.F90 @@ -554,7 +554,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va call shr_get_rpointer_name(gcomp, 'glc', target_ymd, target_tod, rpfile, 'read', rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dglc_datamode_noevolve_restart_read(model_meshes, restfilm, rpfile, & - logunit, my_task, main_task, mpicom, & + logunit, my_task, main_task, & sdat(1)%pio_subsystem, sdat(1)%io_type, nx_global, ny_global, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index f36ee48b..a8856150 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -616,7 +616,7 @@ subroutine dshr_restart_read(rest_filem, rpfile, & close(nu) inquire(file=trim(rest_filem), exist=exists) endif - call ESMF_VMBroadCast(vm, rest_filem, CL, main_task, rc=rc) + call ESMF_VMBroadCast(vm, rest_filem, len(rest_filem), main_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! use namelist already read