Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/cfgs/SHARED/namelist_ref
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/cfgs/SHARED/namelist_ref	(revision 11397)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/cfgs/SHARED/namelist_ref	(revision 11398)
@@ -1304,7 +1304,9 @@
 &nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi")
 !-----------------------------------------------------------------------
+   ln_listonly =  .false.  !  do nothing else than listing the best domain decompositions (with land domains suppression)
+   !                       !  if T: the largest number of cores tested is defined by max(mppsize, jpni*jpnj)
    ln_nnogather =  .true.  !  activate code to avoid mpi_allgather use at the northfold
-   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
-   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpni        =   0       !  number of processors following i (set automatically if < 1), see also ln_listonly = T
+   jpnj        =   0       !  number of processors following j (set automatically if < 1), see also ln_listonly = T
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/lib_mpp.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/lib_mpp.F90	(revision 11397)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/lib_mpp.F90	(revision 11398)
@@ -663,5 +663,5 @@
 
 
-   SUBROUTINE mppstop( ldfinal, ld_force_abort ) 
+   SUBROUTINE mppstop( ld_abort ) 
       !!----------------------------------------------------------------------
       !!                  ***  routine mppstop  ***
@@ -670,16 +670,13 @@
       !!
       !!----------------------------------------------------------------------
-      LOGICAL, OPTIONAL, INTENT(in) :: ldfinal    ! source process number
-      LOGICAL, OPTIONAL, INTENT(in) :: ld_force_abort    ! source process number
-      LOGICAL ::   llfinal, ll_force_abort
+      LOGICAL, OPTIONAL, INTENT(in) :: ld_abort    ! source process number
+      LOGICAL ::   ll_abort
       INTEGER ::   info
       !!----------------------------------------------------------------------
-      llfinal = .FALSE.
-      IF( PRESENT(ldfinal) ) llfinal = ldfinal
-      ll_force_abort = .FALSE.
-      IF( PRESENT(ld_force_abort) ) ll_force_abort = ld_force_abort
-      !
-#if defined key_mpp_mpi
-      IF(ll_force_abort) THEN
+      ll_abort = .FALSE.
+      IF( PRESENT(ld_abort) ) ll_abort = ld_abort
+      !
+#if defined key_mpp_mpi
+      IF(ll_abort) THEN
          CALL mpi_abort( MPI_COMM_WORLD )
       ELSE
@@ -688,5 +685,5 @@
       ENDIF
 #endif
-      IF( .NOT. llfinal ) STOP 123
+      IF( ll_abort ) STOP 123
       !
    END SUBROUTINE mppstop
@@ -1118,5 +1115,5 @@
          WRITE(numout,*)  'huge E-R-R-O-R : immediate stop'
          WRITE(numout,*)  
-         CALL mppstop( ld_force_abort = .true. )
+         CALL mppstop( ld_abort = .true. )
       ENDIF
       !
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/mppini.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/mppini.F90	(revision 11397)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/LBC/mppini.F90	(revision 11398)
@@ -154,4 +154,5 @@
       LOGICAL ::   llbest, llauto
       LOGICAL ::   llwrtlay
+      LOGICAL ::   ln_listonly
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   iin, ii_nono, ii_noea          ! 1D workspace
       INTEGER, ALLOCATABLE, DIMENSION(:)     ::   ijn, ii_noso, ii_nowe          !  -     -
@@ -168,5 +169,5 @@
            &             rn_ice_tem, rn_ice_sal, rn_ice_age,                     &
            &             ln_vol, nn_volctl, nn_rimwidth
-      NAMELIST/nammpp/ jpni, jpnj, ln_nnogather
+      NAMELIST/nammpp/ jpni, jpnj, ln_nnogather, ln_listonly
       !!----------------------------------------------------------------------
       !
@@ -206,4 +207,6 @@
       IF(               ln_read_cfg ) CALL iom_open( cn_domcfg,    numbot )
       IF( ln_bdy .AND. ln_mask_file ) CALL iom_open( cn_mask_file, numbdy )
+      !
+      IF( ln_listonly )   CALL mpp_init_bestpartition( MAX(mppsize,jpni*jpnj), ldlist = .TRUE. )   ! must be done by all core
       !
       !  1. Dimension arrays for subdomains
@@ -268,5 +271,4 @@
          CALL ctl_stop( ctmp1, ctmp2, ctmp3, ' ', ctmp4, ' ' )
          CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
-         CALL ctl_stop( 'STOP' )
       ENDIF
 
@@ -293,5 +295,4 @@
          ENDIF
          CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core
-         CALL ctl_stop( 'STOP' )
       ENDIF
 
@@ -843,5 +844,5 @@
       INTEGER :: isziref, iszjref
       INTEGER :: inbij, iszij
-      INTEGER :: inbimax, inbjmax, inbijmax
+      INTEGER :: inbimax, inbjmax, inbijmax, inbijold
       INTEGER :: isz0, isz1
       INTEGER, DIMENSION(  :), ALLOCATABLE :: indexok
@@ -968,25 +969,37 @@
       DEALLOCATE( indexok, inbi1, inbj1, iszi1, iszj1 )
 
-      IF( llist ) THEN  ! we print about 21 best partitions
+      IF( llist ) THEN
          IF(lwp) THEN
             WRITE(numout,*)
-            WRITE(numout,         *) '                  For your information:'
-            WRITE(numout,'(a,i5,a)') '  list of the best partitions around ',   knbij, ' mpi processes'
-            WRITE(numout,         *) '  --------------------------------------', '-----', '--------------'
+            WRITE(numout,*) '                  For your information:'
+            WRITE(numout,*) '  list of the best partitions including land supression'
+            WRITE(numout,*) '  -----------------------------------------------------'
             WRITE(numout,*)
          END IF
-         iitarget = MINLOC( inbi0(:)*inbj0(:), mask = inbi0(:)*inbj0(:) >= knbij, dim = 1 )
-         DO ji = MAX(1,iitarget-10), MIN(isz0,iitarget+10)
+         ji = isz0   ! initialization with the largest value
+         ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
+         CALL mpp_init_isoce( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
+         inbijold = COUNT(llisoce)
+         DEALLOCATE( llisoce )
+         DO ji =isz0-1,1,-1
             ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
             CALL mpp_init_isoce( inbi0(ji), inbj0(ji), llisoce ) ! Warning: must be call by all cores (call mpp_sum)
             inbij = COUNT(llisoce)
             DEALLOCATE( llisoce )
-            IF(lwp) WRITE(numout,'(a, i5, a, i5, a, i4, a, i4, a, i9, a, i5, a, i5, a)')    &
-               &     'nb_cores ' , inbij,' oce + ', inbi0(ji)*inbj0(ji) - inbij             &
-               &                                , ' land ( ', inbi0(ji),' x ', inbj0(ji),   &
-               & ' ), nb_points ', iszi0(ji)*iszj0(ji),' ( ', iszi0(ji),' x ', iszj0(ji),' )'
+            IF(lwp .AND. inbij < inbijold) THEN
+               WRITE(numout,'(a, i6, a, i6, a, f4.1, a, i9, a, i6, a, i6, a)')                                 &
+                  &   'nb_cores oce: ', inbij, ', land domains excluded: ', inbi0(ji)*inbj0(ji) - inbij,       &
+                  &   ' (', REAL(inbi0(ji)*inbj0(ji) - inbij,wp) / REAL(inbi0(ji)*inbj0(ji),wp) *100.,         &
+                  &   '%), largest oce domain: ', iszi0(ji)*iszj0(ji), ' ( ', iszi0(ji),' x ', iszj0(ji), ' )'
+               inbijold = inbij
+            END IF
          END DO
          DEALLOCATE( inbi0, inbj0, iszi0, iszj0 )
-         RETURN
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*)  '  -----------------------------------------------------------'
+         ENDIF
+         CALL mppsync
+         CALL mppstop( ld_abort = .TRUE. )
       ENDIF
       
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/nemogcm.F90	(revision 11397)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/nemogcm.F90	(revision 11398)
@@ -242,5 +242,5 @@
 #else
       IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS
-      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications
+      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop      ! end mpp communications
       ENDIF
 #endif
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/nemogcm.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/nemogcm.F90	(revision 11397)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/nemogcm.F90	(revision 11398)
@@ -164,5 +164,5 @@
 #else
       IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS
-      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications
+      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop        ! end mpp communications
       ENDIF
 #endif
