Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedyn_adv_umx.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedyn_adv_umx.F90	(revision 10358)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icedyn_adv_umx.F90	(revision 10359)
@@ -73,5 +73,5 @@
       INTEGER  ::   ipl                     ! third dimention of tracer array
 
-      REAL(wp) ::   zcfl , zusnit, zdt      !   -      -
+      REAL(wp) ::   zcfl(2), zusnit, zdt      !   -      -
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zudy, zvdx, zcu_box, zcv_box
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zpato
@@ -86,15 +86,12 @@
       !     When needed, the advection split is applied at the next time-step in order to avoid blocking global comm.
       !     ...this should not affect too much the stability... Was ok on the tests we did...
-      zcfl =            MAXVAL( ABS( pu_ice(:,:) ) * rdt_ice * r1_e1u(:,:) )
-      zcfl = MAX( zcfl, MAXVAL( ABS( pv_ice(:,:) ) * rdt_ice * r1_e2v(:,:) ) )
-      IF( zcfl > 0.5 ) THEN   ;   l_split_advumx(1) = .TRUE.    ! split advection time-step if CFL violated
-      ELSE                    ;   l_split_advumx(1) = .FALSE.
-      ENDIF
+      zcfl(1) =               MAXVAL( ABS( pu_ice(:,:) ) * rdt_ice * r1_e1u(:,:) )
+      zcfl(1) = MAX( zcfl(1), MAXVAL( ABS( pv_ice(:,:) ) * rdt_ice * r1_e2v(:,:) ) )
       
-      ! non-blocking global communication send l_split_advumx(1) and receive l_split_advumx(2)
-      IF( lk_mpp )   CALL mpp_ilor( l_split_advumx, ldlast = kt == nitend - nn_fsbc + 1 )
-
-      IF( l_split_advumx(2) ) THEN   ;   initad = 2   ;   zusnit = 0.5_wp    ! split defined at the previous time-step
-      ELSE                           ;   initad = 1   ;   zusnit = 1.0_wp
+      ! non-blocking global communication send zcfl(1) and receive zcfl(2)
+      IF( lk_mpp )   CALL mpp_delay_max( 'icedyn_adv_umx', 'advumx_delay', zcfl, kt == nitend - nn_fsbc + 1 )
+
+      IF( zcfl(2) > .5 ) THEN   ;   initad = 2   ;   zusnit = 0.5_wp   ! zcfl(2) corresponding to zcfl(1) of the previous time-step
+      ELSE                      ;   initad = 1   ;   zusnit = 1.0_wp
       ENDIF
 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icerst.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icerst.F90	(revision 10358)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/ICE/icerst.F90	(revision 10359)
@@ -98,5 +98,5 @@
       INTEGER, INTENT(in) ::   kt     ! number of iteration
       !!
-      INTEGER ::   jk ,jl   ! dummy loop indices
+      INTEGER ::   ji, jk ,jl   ! dummy loop indices
       INTEGER ::   iter
       CHARACTER(len=25) ::   znam
@@ -118,4 +118,7 @@
       CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step 
       CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ) )      ! date
+      DO ji = 1, nbdelay
+         CALL iom_rstput( iter, nitrst, numriw, c_delaylist(ji), todelay(ji) )
+      END DO
 
       ! Prognostic variables
@@ -169,5 +172,5 @@
       !! ** purpose  :   read restart file
       !!----------------------------------------------------------------------
-      INTEGER           ::   jk, jl
+      INTEGER           ::   ji, jk, jl
       LOGICAL           ::   llok
       INTEGER           ::   id1            ! local integer
@@ -240,9 +243,11 @@
       zcfl =            MAXVAL( ABS( u_ice(:,:) ) * rdt_ice * r1_e1u(:,:) )
       zcfl = MAX( zcfl, MAXVAL( ABS( v_ice(:,:) ) * rdt_ice * r1_e2v(:,:) ) )
-      ! define split from previous run, so we ca used mpp_ilor
-      IF( zcfl > 0.5 ) THEN   ;   l_split_advumx(1) = .TRUE.
-      ELSE                    ;   l_split_advumx(1) = .FALSE.
-      ENDIF
-      IF( lk_mpp )   CALL mpp_ilor( l_split_advumx )   ! non-blocking global communication send l_split_advumx(1)
+
+      DO ji = 1, nbdelay
+         IF( iom_varid( numrir, c_delaylist(ji), ldstop = .FALSE. ) > 0 )  THEN
+            CALL iom_get( numrir, c_delaylist(ji), todelay(ji) )
+            ndelayid(ji) = 0   ! set to 0 to speficy that the value was read in the restart
+         ENDIF
+      END DO
 
       ! fields needed for Met Office (Jules) coupling
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/IOM/restart.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/IOM/restart.F90	(revision 10358)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/IOM/restart.F90	(revision 10359)
@@ -143,7 +143,11 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time-step
+      INTEGER             :: ji
       !!----------------------------------------------------------------------
                      IF(lwxios) CALL iom_swap(      cwxios_context          )
                      CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rdt       , ldxios = lwxios)   ! dynamics time step
+                     DO ji = 1, nbdelay
+                        CALL iom_rstput( kt, nitrst, numrow, c_delaylist(ji), todelay(ji), ldxios = lwxios)
+                     END DO
 
       IF ( .NOT. ln_diurnal_only ) THEN
@@ -251,5 +255,5 @@
       !!----------------------------------------------------------------------
       REAL(wp) ::   zrdt
-      INTEGER  ::   jk
+      INTEGER  ::   ji, jk
       REAL(wp), DIMENSION(jpi, jpj, jpk) :: w3d
       !!----------------------------------------------------------------------
@@ -263,4 +267,11 @@
       ENDIF
 
+      DO ji = 1, nbdelay
+         IF( iom_varid( numror, c_delaylist(ji), ldstop = .FALSE. ) > 0 )  THEN
+            CALL iom_get( numror, c_delaylist(ji), todelay(ji), ldxios = lrxios )
+            ndelayid(ji) = 0   ! set to 0 to speficy that the value was read in the restart
+         ENDIF
+      END DO
+      
       ! Diurnal DSST 
       IF( ln_diurnal ) CALL iom_get( numror, jpdom_autoglo, 'Dsst' , x_dsst, ldxios = lrxios ) 
Index: /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90
===================================================================
--- /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90	(revision 10358)
+++ /NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/OCE/LBC/lib_mpp.F90	(revision 10359)
@@ -83,5 +83,5 @@
    PUBLIC   mpp_lbc_north_icb
    PUBLIC   mpp_min, mpp_max, mpp_sum, mpp_minloc, mpp_maxloc
-   PUBLIC   mpp_ilor
+   PUBLIC   mpp_delay_max
    PUBLIC   mppscatter, mppgather
    PUBLIC   mpp_ini_znl
@@ -164,4 +164,9 @@
    INTEGER, PUBLIC                               ::   numcom = -1                  !: logical unit for communicaton report
    LOGICAL, PUBLIC                               ::   l_full_nf_update = .FALSE.   !: logical for a full (2lines) update of bc at North fold report
+   INTEGER,                    PARAMETER, PUBLIC ::   nbdelay = 1       !: number of delayed operations
+   CHARACTER(len=32), DIMENSION(nbdelay), PUBLIC ::   c_delaylist       !: name (used as id) of allreduce-delayed operations
+   DATA c_delaylist(1) / 'advumx_delay' /
+   REAL(wp),          DIMENSION(nbdelay), PUBLIC ::   todelay           !: current value of the delayed operations
+   INTEGER,           DIMENSION(nbdelay), PUBLIC ::   ndelayid = -1     !: mpi request id of the delayed operations
 
    ! timing summary report
@@ -566,30 +571,51 @@
    END SUBROUTINE mppscatter
 
-   !!
-   SUBROUTINE mpp_ilor( ld_switch, ldlast, kcom )
-      ! WARNING: must be used only once (by ice_dyn_adv_umx) because ll_switch and ireq are SAVE
-      !!----------------------------------------------------------------------
-      LOGICAL, INTENT(inout), DIMENSION(2) ::   ld_switch
-      LOGICAL, INTENT(in   ), OPTIONAL     ::   ldlast
-      INTEGER, INTENT(in   ), OPTIONAL     ::   kcom 
-      INTEGER  ::   ierror, ilocalcomm
-      LOGICAL, SAVE ::   ll_switch , lllast
-      INTEGER, SAVE ::   ireq = -1
+  
+   SUBROUTINE mpp_delay_max( cdname, cdelay, pinout, ldlast, kcom )
+      !!----------------------------------------------------------------------
+      !!                   ***  routine mpp_delay_max  ***
+      !!
+      !! ** Purpose :   performed delayed mpp_max, the result is received on next call
+      !!
+      !!----------------------------------------------------------------------
+      CHARACTER(len=*), INTENT(in   )               ::   cdname  ! name of the calling subroutine
+      CHARACTER(len=*), INTENT(in   )               ::   cdelay  ! name (used as id) of the delayed operation
+      REAL(wp),         INTENT(inout), DIMENSION(2) ::   pinout  ! pinout(1): in data, pinout(2): out data
+      LOGICAL,          INTENT(in   )               ::   ldlast  ! true if this is the last time we call this routine
+      INTEGER,          INTENT(in   ), OPTIONAL     ::   kcom
+      !!
+      INTEGER ::   ji
+      INTEGER ::   idvar
+      INTEGER ::   ierror, ilocalcomm
       !!----------------------------------------------------------------------
       ilocalcomm = mpi_comm_oce
-      IF( PRESENT(  kcom) )   ilocalcomm = kcom
-      lllast = .FALSE.
-      IF( PRESENT(ldlast) )   lllast = ldlast
-      
-      IF ( ireq /= -1 ) THEN   ! get ld_switch(2) from ll_switch (from previous call)
-         IF( ln_timing ) CALL tic_tac(.TRUE., ld_global = .TRUE.)
-         CALL mpi_wait(ireq, MPI_STATUS_IGNORE, ierror )
-         ld_switch(2) = ll_switch
+      IF( PRESENT(kcom) )   ilocalcomm = kcom
+
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ld_glb = .TRUE. )
+
+      idvar = -1
+      DO ji = 1, nbdelay
+         IF( TRIM(cdelay) == trim(c_delaylist(ji)) ) idvar = ji
+      END DO
+      IF ( idvar == -1 )   CALL ctl_stop( 'STOP',' mpp_delay_max : please add a new delayed exchange for '//TRIM(cdname) )
+
+      IF( ndelayid(idvar) == -1 ) THEN        ! first call without restart: get pinout(2) from pinout(1) with a blocking allreduce
+         CALL mpi_allreduce(      pinout(1), pinout(2), 1, MPI_DOUBLE_PRECISION, mpi_max, ilocalcomm, ierror )
+      ELSE IF ( ndelayid(idvar) == 0 ) THEN   ! first call    with restart: get pinout(2) from todelay with a blocking allreduce
+         CALL mpi_allreduce( todelay(idvar), pinout(2), 1, MPI_DOUBLE_PRECISION, mpi_max, ilocalcomm, ierror )
+      ELSE                                    ! from the second call, get value from previous time step
+         IF( ln_timing ) CALL tic_tac( .TRUE., ld_global = .TRUE.)
+         CALL mpi_wait(ndelayid(idvar), MPI_STATUS_IGNORE, ierror )   ! make sure todelay(idvar) is received
          IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.)
-      ENDIF
-      IF( .NOT. lllast ) &     ! send ll_switch to be received on next call
-         CALL mpi_iallreduce( ld_switch(1), ll_switch, 1, MPI_LOGICAL, mpi_lor, ilocalcomm, ireq, ierror )
-
-   END SUBROUTINE mpp_ilor
+         pinout(2) = todelay(idvar)           ! send back pinout(2) from todelay(idvar) defined at previous call
+      ENDIF
+
+      IF( ldlast ) THEN      ! last call: put pinout(1) in todelay that will be stored in the restart files
+         todelay(idvar) = pinout(1)
+      ELSE                   ! send pinout(1) to todelay(idvar), to be received at next call
+         CALL mpi_iallreduce( pinout(1), todelay(idvar), 1, MPI_DOUBLE_PRECISION, mpi_max, ilocalcomm, ndelayid(idvar), ierror )
+      ENDIF
+
+   END SUBROUTINE mpp_delay_max
    
    !!----------------------------------------------------------------------
@@ -1473,4 +1499,9 @@
    LOGICAL, PUBLIC            ::   ln_nnogather          !: namelist control of northfold comms (needed here in case "key_mpp_mpi" is not used)
    INTEGER, PUBLIC            ::   mpi_comm_oce          ! opa local communicator
+
+   INTEGER, PARAMETER, PUBLIC               ::   nbdelay = 0   ! make sure we don't enter loops: DO ji = 1, nbdelay
+   CHARACTER(len=32), DIMENSION(1), PUBLIC  ::   c_delaylist = 'empty'
+   REAL(wp), PUBLIC, DIMENSION(1)           ::   todelay
+   INTEGER,  PUBLIC, DIMENSION(1)           ::   ndelayid = -1
    !!----------------------------------------------------------------------
 CONTAINS
@@ -1640,10 +1671,12 @@
 #  undef OPERATION_MAXLOC
 
-   SUBROUTINE mpp_ilor( ld_switch, ldlast, kcom )
-      LOGICAL, INTENT(in   ), DIMENSION(2) ::   ld_switch
-      LOGICAL, INTENT(in   ), OPTIONAL     ::   ldlast
-      INTEGER, INTENT(in   ), OPTIONAL     ::   kcom    ! ???
-      WRITE(*,*) 'mpp_ilor: You should not have seen this print! error?', ld_switch
-   END SUBROUTINE mpp_ilor
+   SUBROUTINE mpp_delay_max( cdname, cdelay, pinout, ldlast, kcom )
+      CHARACTER(len=*), INTENT(in   )               ::   cdname  ! name of the calling subroutine
+      CHARACTER(len=*), INTENT(in   )               ::   cdelay  ! name (used as id) of the delayed operation
+      REAL(wp),         INTENT(inout), DIMENSION(2) ::   pinout  ! pinout(1): in data, pinout(2): out data
+      LOGICAL,          INTENT(in   )               ::   ldlast  ! true if this is the last time we call this routine
+      INTEGER,          INTENT(in   ), OPTIONAL     ::   kcom
+      WRITE(*,*) 'mpp_delay_max: You should not have seen this print! error?', cdname
+   END SUBROUTINE mpp_delay_max
 
    SUBROUTINE mppstop( ldfinal, ld_force_abort )
