Changeset 10615
- Timestamp:
- 2019-01-31T18:15:42+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/OCE/LBC/mppini.F90
r10570 r10615 150 150 INTEGER :: ierr, ios ! 151 151 INTEGER :: inbi, inbj, iimax, ijmax, icnt1, icnt2 152 LOGICAL :: llbest 152 LOGICAL :: llbest, llauto 153 153 LOGICAL :: llwrtlay 154 154 INTEGER, ALLOCATABLE, DIMENSION(:) :: iin, ii_nono, ii_noea ! 1D workspace … … 185 185 ! If dimensions of processor grid weren't specified in the namelist file 186 186 ! 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 187 192 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. 189 195 llbest = .TRUE. 190 196 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 192 200 CALL mpp_basic_decomposition( jpni, jpnj, jpimax, jpjmax ) 201 ! largest subdomain size for mpi decoposition inbi*inbj given by mpp_init_bestpartition 193 202 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 195 215 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... ---', ' ' ) 202 226 ELSE 203 227 llbest = .TRUE. … … 210 234 inijmin = COUNT( llisoce ) ! number of oce subdomains 211 235 212 IF( mppsize < inijmin ) THEN 236 IF( mppsize < inijmin ) THEN ! too many oce subdomains: can happen only if jpni and jpnj are prescribed... 213 237 WRITE(ctmp1,9001) ' With this specified domain decomposition: jpni = ', jpni, ' jpnj = ', jpnj 214 238 WRITE(ctmp2,9002) ' we can eliminate only ', jpni*jpnj - inijmin, ' land mpi subdomains therefore ' 215 239 WRITE(ctmp3,9001) ' the number of ocean mpi subdomains (', inijmin,') exceed the number of MPI processes:', mppsize 216 240 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, ' ' ) 218 242 CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. ) ! must be done by all core 219 243 CALL ctl_stop( 'STOP' ) 220 244 ENDIF 221 245 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 228 267 CALL mpp_init_bestpartition( mppsize, ldlist = .TRUE. ) ! must be done by all core 229 268 CALL ctl_stop( 'STOP' ) … … 236 275 WRITE(ctmp3,9002) ' we suppressed ', jpni*jpnj - mppsize, ' land subdomains ' 237 276 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... ---', ' ' ) 239 278 ELSE ! mppsize = inijmin 240 279 IF(lwp) THEN 241 IF(llbest) WRITE(numout,*) ' mpp_init: You use an optimal domaindecomposition'242 WRITE(numout,*) '~~~~~~~~ '280 IF(llbest) WRITE(numout,*) ' ==> you use the best mpi decomposition' 281 WRITE(numout,*) 243 282 WRITE(numout,9003) ' Number of mpi processes: ', mppsize 244 283 WRITE(numout,9003) ' Number of ocean subdomains = ', inijmin
Note: See TracChangeset
for help on using the changeset viewer.