New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 10616 – NEMO

Changeset 10616


Ignore:
Timestamp:
2019-01-31T18:15:59+01:00 (5 years ago)
Author:
smasson
Message:

v4: improve information/error messages in mppini

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/release-4.0/src/OCE/LBC/mppini.F90

    r10570 r10616  
    150150      INTEGER ::   ierr, ios                  !  
    151151      INTEGER ::   inbi, inbj, iimax,  ijmax, icnt1, icnt2 
    152       LOGICAL ::   llbest 
     152      LOGICAL ::   llbest, llauto 
    153153      LOGICAL ::   llwrtlay 
    154154      INTEGER, ALLOCATABLE, DIMENSION(:)     ::   iin, ii_nono, ii_noea          ! 1D workspace 
     
    185185      ! If dimensions of processor grid weren't specified in the namelist file 
    186186      ! then we calculate them here now that we have our communicator size 
     187      IF(lwp) THEN 
     188         WRITE(numout,*) 'mpp_init:' 
     189         WRITE(numout,*) '~~~~~~~~ ' 
     190         WRITE(numout,*) 
     191      ENDIF 
    187192      IF( jpni < 1 .OR. jpnj < 1 ) THEN 
    188          CALL mpp_init_bestpartition( mppsize, jpni, jpnj ) 
     193         CALL mpp_init_bestpartition( mppsize, jpni, jpnj )           ! best mpi decomposition for mppsize mpi processes 
     194         llauto = .TRUE. 
    189195         llbest = .TRUE. 
    190196      ELSE 
    191          CALL mpp_init_bestpartition( mppsize, inbi, inbj, icnt2 ) 
     197         llauto = .FALSE. 
     198         CALL mpp_init_bestpartition( mppsize, inbi, inbj, icnt2 )    ! best mpi decomposition for mppsize mpi processes 
     199         ! largest subdomain size for mpi decoposition jpni*jpnj given in the namelist 
    192200         CALL mpp_basic_decomposition( jpni, jpnj, jpimax, jpjmax ) 
     201         ! largest subdomain size for mpi decoposition inbi*inbj given by mpp_init_bestpartition 
    193202         CALL mpp_basic_decomposition( inbi, inbj,  iimax,  ijmax ) 
    194          IF( iimax*ijmax < jpimax*jpjmax ) THEN 
     203         icnt1 = jpni*jpnj - mppsize   ! number of land subdomains that should be removed to use mppsize mpi processes 
     204         IF(lwp) THEN 
     205            WRITE(numout,9000) '   The chosen domain decomposition ', jpni, ' x ', jpnj, ' with ', icnt1, ' land subdomains' 
     206            WRITE(numout,9002) '      - uses a total of ',  mppsize,' mpi process' 
     207            WRITE(numout,9000) '      - has mpi subdomains with a maximum size of (jpi = ', jpimax, ', jpj = ', jpjmax,   & 
     208               &                                                                ', jpi*jpj = ', jpimax*jpjmax, ')' 
     209            WRITE(numout,9000) '   The best domain decompostion ', inbi, ' x ', inbj, ' with ', icnt2, ' land subdomains' 
     210            WRITE(numout,9002) '      - uses a total of ',  inbi*inbj-icnt2,' mpi process' 
     211            WRITE(numout,9000) '      - has mpi subdomains with a maximum size of (jpi = ',  iimax, ', jpj = ',  ijmax,   & 
     212               &                                                             ', jpi*jpj = ',  iimax* ijmax, ')' 
     213         ENDIF 
     214         IF( iimax*ijmax < jpimax*jpjmax ) THEN   ! chosen subdomain size is larger that the best subdomain size 
    195215            llbest = .FALSE. 
    196             icnt1 = jpni*jpnj - mppsize 
    197             WRITE(ctmp1,9000) '   The chosen domain decomposition ', jpni, ' x ', jpnj, ' with ', icnt1, ' land sub-domains' 
    198             WRITE(ctmp2,9000) '   has larger MPI subdomains (jpi = ', jpimax, ', jpj = ', jpjmax, ', jpi*jpj = ', jpimax*jpjmax, ')' 
    199             WRITE(ctmp3,9000) '   than the following domain decompostion ', inbi, ' x ', inbj, ' with ', icnt2, ' land sub-domains' 
    200             WRITE(ctmp4,9000) '   which MPI subdomains size is jpi = ', iimax, ', jpj = ', ijmax, ', jpi*jpj = ', iimax*ijmax, ' ' 
    201             CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4, ' ', '    --- YOU ARE WASTING CPU... ---', ' ' ) 
     216            IF ( inbi*inbj-icnt2 < mppsize ) THEN 
     217               WRITE(ctmp1,*) '   ==> You could therefore have smaller mpi subdomains with less mpi processes' 
     218            ELSE 
     219               WRITE(ctmp1,*) '   ==> You could therefore have smaller mpi subdomains with the same number of mpi processes' 
     220            ENDIF 
     221            CALL ctl_warn( ' ', ctmp1, ' ', '    ---   YOU ARE WASTING CPU...   ---', ' ' ) 
     222         ELSE IF ( iimax*ijmax == jpimax*jpjmax .AND. (inbi*inbj-icnt2) <  mppsize) THEN 
     223            llbest = .FALSE. 
     224            WRITE(ctmp1,*) '   ==> You could therefore have the same mpi subdomains size with less mpi processes' 
     225            CALL ctl_warn( ' ', ctmp1, ' ', '    ---   YOU ARE WASTING CPU...   ---', ' ' ) 
    202226         ELSE 
    203227            llbest = .TRUE. 
     
    210234      inijmin = COUNT( llisoce )   ! number of oce subdomains 
    211235 
    212       IF( mppsize < inijmin ) THEN 
     236      IF( mppsize < inijmin ) THEN   ! too many oce subdomains: can happen only if jpni and jpnj are prescribed... 
    213237         WRITE(ctmp1,9001) '   With this specified domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj 
    214238         WRITE(ctmp2,9002) '   we can eliminate only ', jpni*jpnj - inijmin, ' land mpi subdomains therefore ' 
    215239         WRITE(ctmp3,9001) '   the number of ocean mpi subdomains (', inijmin,') exceed the number of MPI processes:', mppsize 
    216240         WRITE(ctmp4,*) '   ==>>> There is the list of best domain decompositions you should use: ' 
    217          CALL ctl_stop( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4 ) 
     241         CALL ctl_stop( ctmp1, ctmp2, ctmp3, ' ', ctmp4, ' ' ) 
    218242         CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core 
    219243         CALL ctl_stop( 'STOP' ) 
    220244      ENDIF 
    221245 
    222       IF( mppsize > jpni*jpnj ) THEN 
    223          WRITE(ctmp1,9003) '   The number of mpi processes: ', mppsize 
    224          WRITE(ctmp2,9003) '   exceeds the maximum number of subdomains (ocean+land) = ', jpni*jpnj 
    225          WRITE(ctmp3,9001) '   defined by the following domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj 
    226          WRITE(ctmp4,*) '   ==>>> There is the list of best domain decompositions you should use: ' 
    227          CALL ctl_stop( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4 ) 
     246      IF( mppsize > jpni*jpnj ) THEN   ! not enough mpi subdomains for the total number of mpi processes 
     247         IF(lwp) THEN 
     248            WRITE(numout,9003) '   The number of mpi processes: ', mppsize 
     249            WRITE(numout,9003) '   exceeds the maximum number of subdomains (ocean+land) = ', jpni*jpnj 
     250            WRITE(numout,9001) '   defined by the following domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj 
     251            WRITE(numout,   *) '   You should: ' 
     252           IF( llauto ) THEN 
     253               WRITE(numout,*) '     - either prescribe your domain decomposition with the namelist variables' 
     254               WRITE(numout,*) '       jpni and jpnj to match the number of mpi process you want to use, ' 
     255               WRITE(numout,*) '       even IF it not the best choice...' 
     256               WRITE(numout,*) '     - or keep the automatic and optimal domain decomposition by picking up one' 
     257               WRITE(numout,*) '       of the number of mpi process proposed in the list bellow' 
     258            ELSE 
     259               WRITE(numout,*) '     - either properly prescribe your domain decomposition with jpni and jpnj' 
     260               WRITE(numout,*) '       in order to be consistent with the number of mpi process you want to use' 
     261               WRITE(numout,*) '       even IF it not the best choice...' 
     262               WRITE(numout,*) '     - or use the automatic and optimal domain decomposition and pick up one of' 
     263               WRITE(numout,*) '       the domain decomposition proposed in the list bellow' 
     264            ENDIF 
     265            WRITE(numout,*) 
     266         ENDIF 
    228267         CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. )   ! must be done by all core 
    229268         CALL ctl_stop( 'STOP' ) 
     
    236275         WRITE(ctmp3,9002) '   we suppressed ', jpni*jpnj - mppsize, ' land subdomains ' 
    237276         WRITE(ctmp4,9002) '   BUT we had to keep ', mppsize - inijmin, ' land subdomains that are useless...' 
    238          CALL ctl_warn( 'mpp_init:', '~~~~~~~~ ', ctmp1, ctmp2, ctmp3, ctmp4, ' ', '    --- YOU ARE WASTING CPU... ---', ' ' ) 
     277         CALL ctl_warn( ctmp1, ctmp2, ctmp3, ctmp4, ' ', '    --- YOU ARE WASTING CPU... ---', ' ' ) 
    239278      ELSE   ! mppsize = inijmin 
    240279         IF(lwp) THEN 
    241             IF(llbest) WRITE(numout,*) 'mpp_init: You use an optimal domain decomposition' 
    242             WRITE(numout,*) '~~~~~~~~ ' 
     280            IF(llbest) WRITE(numout,*) '   ==> you use the best mpi decomposition' 
     281            WRITE(numout,*) 
    243282            WRITE(numout,9003) '   Number of mpi processes: ', mppsize 
    244283            WRITE(numout,9003) '   Number of ocean subdomains = ', inijmin 
Note: See TracChangeset for help on using the changeset viewer.