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 14366 – NEMO

Changeset 14366


Ignore:
Timestamp:
2021-02-01T18:06:01+01:00 (3 years ago)
Author:
smasson
Message:

dev_r14312_MPI_Interface: prperly define corner in point-2-point communication when needed, #2598

Location:
NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_lnk_call_generic.h90

    r14363 r14366  
    2424      &                   , pt9 , cdna9 , psgn9 , pt10, cdna10, psgn10, pt11, cdna11, psgn11, pt12, cdna12, psgn12  & 
    2525      &                   , pt13, cdna13, psgn13, pt14, cdna14, psgn14, pt15, cdna15, psgn15, pt16, cdna16, psgn16  & 
    26       &                   , kfillmode, pfillval, khls, lsend, lrecv, ncsten ) 
     26      &                   , kfillmode, pfillval, khls, lsend, lrecv, ld4only ) 
    2727      !!--------------------------------------------------------------------- 
    2828      CHARACTER(len=*)     ,                   INTENT(in   ) ::   cdname  ! name of the calling subroutine 
     
    4040      INTEGER              , OPTIONAL        , INTENT(in   ) ::   khls        ! halo size, default = nn_hls 
    4141      LOGICAL, DIMENSION(4), OPTIONAL        , INTENT(in   ) ::   lsend, lrecv   ! indicate how communications are to be carried out 
    42       LOGICAL              , OPTIONAL        , INTENT(in   ) ::   ncsten 
     42      LOGICAL              , OPTIONAL        , INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners) 
    4343      !! 
    4444      INTEGER                          ::   kfld        ! number of elements that will be attributed 
     
    7171      !      
    7272      IF( nn_comm == 1 ) THEN  
    73          CALL lbc_lnk_pt2pt(   cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv ) 
     73         CALL lbc_lnk_pt2pt(   cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only ) 
    7474      ELSE 
    75          CALL lbc_lnk_neicoll( cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv, ncsten ) 
     75         CALL lbc_lnk_neicoll( cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only ) 
    7676      ENDIF 
    7777      ! 
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_lnk_neicoll_generic.h90

    r14363 r14366  
    11 
    2    SUBROUTINE lbc_lnk_neicoll_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv, ncsten ) 
     2   SUBROUTINE lbc_lnk_neicoll_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only ) 
    33      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
    44      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c. 
     
    1010      INTEGER ,             OPTIONAL, INTENT(in   ) ::   khls        ! halo size, default = nn_hls 
    1111      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc 
    12       LOGICAL,              OPTIONAL, INTENT(in   ) ::   ncsten      ! 5-point or 9-point stencil 
     12      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners) 
    1313      ! 
    1414      INTEGER  ::    ji,  jj,  jk , jl,  jf, jn      ! dummy loop indices 
     
    3131      REAL(PRECISION) ::   zland 
    3232      REAL(PRECISION), DIMENSION(:), ALLOCATABLE  ::   zsnd, zrcv          ! halos arrays 
    33       LOGICAL  ::   llncall                                          ! default: 9-point stencil 
     33      LOGICAL  ::   ll4only                                        ! default: 8 neighbourgs 
    3434      LOGICAL  ::   ll_IdoNFold 
    3535      !!---------------------------------------------------------------------- 
     
    6464      ENDIF 
    6565      ! 
    66       llncall = .TRUE.    ! default definition 
    67       IF( PRESENT(ncsten) ) llncall = ncsten 
    68       ! 
    69       impi_nc = mpi_nc_com4(ihls) 
    70       IF(llncall)   impi_nc = mpi_nc_com8(ihls) 
     66      ll4only = .FALSE.    ! default definition 
     67      IF( PRESENT(ld4only) )   ll4only = ld4only 
     68      ! 
     69      impi_nc = mpi_nc_com8(ihls)   ! default 
     70      IF( ll4only )   impi_nc = mpi_nc_com4(ihls) 
    7171      ! 
    7272      zland = 0._wp                                     ! land filling value: zero by default 
     
    8080         WRITE(ctmp1,*) TRIM(cdname), '  is calling lbc_lnk with only one of the two arguments lsend or lrecv' 
    8181         CALL ctl_stop( 'STOP', ctmp1 ) 
    82       ELSE                                                  ! default neighbours 
     82      ELSE                                              ! default neighbours 
    8383         llsend(:) = mpiSnei(ihls,:) >= 0 
    84          IF( .NOT. llncall )   llsend(5:8) = .FALSE.        ! exclude corners 
     84         IF( ll4only )   llsend(5:8) = .FALSE.          ! exclude corners 
    8585         llrecv(:) = mpiRnei(ihls,:) >= 0 
    86          IF( .NOT. llncall )   llrecv(5:8) = .FALSE.        ! exclude corners 
    87       END IF 
     86         IF( ll4only )   llrecv(5:8) = .FALSE.          ! exclude corners 
     87      ENDIF 
    8888      ! 
    8989      ! define ifill: which method should be used to fill each parts (sides+corners) of the halos 
     
    9494         ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill(jn) = kfillmode    ! localy defined 
    9595         ELSE                                ;   ifill(jn) = jpfillcst    ! constant value (zland) 
    96          END IF 
     96         ENDIF 
    9797      END DO 
    9898      ! take care of "indirect self-periodicity" for the corners 
     
    167167               idx = idx + 1 
    168168            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO 
    169          END IF 
     169         ENDIF 
    170170      END DO 
    171171      ! 
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_lnk_pt2pt_generic.h90

    r14363 r14366  
    11 
    2    SUBROUTINE lbc_lnk_pt2pt_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv ) 
     2   SUBROUTINE lbc_lnk_pt2pt_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only ) 
    33      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine 
    44      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c. 
     
    1010      INTEGER ,             OPTIONAL, INTENT(in   ) ::   khls        ! halo size, default = nn_hls 
    1111      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc 
     12      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners) 
    1213      ! 
    1314      INTEGER  ::     ji,   jj,  jk,  jl,  jf, jn     ! dummy loop indices 
     
    1819      INTEGER  ::   ifill_nfd, icomm, ierr 
    1920      INTEGER  ::   ihls, idxs, idxr 
    20       INTEGER, DIMENSION(4)  ::   isizei, ishtSi, ishtRi, ishtPi 
    21       INTEGER, DIMENSION(4)  ::   isizej, ishtSj, ishtRj, ishtPj 
    22       INTEGER, DIMENSION(4)  ::   ifill, iszall, ishtS, ishtR 
    23       INTEGER, DIMENSION(4)  ::   ireq  ! mpi_request id 
     21      INTEGER, DIMENSION(4)  ::   iwewe, issnn 
     22      INTEGER, DIMENSION(8)  ::   isizei, ishtSi, ishtRi, ishtPi 
     23      INTEGER, DIMENSION(8)  ::   isizej, ishtSj, ishtRj, ishtPj 
     24      INTEGER, DIMENSION(8)  ::   ifill, iszall, ishtS, ishtR 
     25      INTEGER, DIMENSION(8)  ::   ireq             ! mpi_request id 
     26      INTEGER, DIMENSION(8)  ::   iStag, iRtag     ! Send and Recv mpi_tag id 
    2427      REAL(PRECISION) ::   zland 
    2528      REAL(PRECISION), DIMENSION(:), ALLOCATABLE  ::   zsnd, zrcv          ! halos arrays 
    26       LOGICAL, DIMENSION(4)  ::   llsend, llrecv 
     29      LOGICAL, DIMENSION(8)  ::   llsend, llrecv 
     30      LOGICAL  ::   ll4only                                        ! default: 8 neighbourgs 
    2731      LOGICAL  ::   ll_IdoNFold 
    2832      !!---------------------------------------------------------------------- 
     
    4044      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. ) 
    4145      ! 
     46      idxs = 1   ! initalize index for send buffer 
     47      idxr = 1   ! initalize index for recv buffer 
     48      icomm = mpi_comm_oce        ! shorter name 
     49      ! 
    4250      ! take care of optional parameters 
    4351      ! 
     
    5664         CALL ctl_stop( 'STOP', ctmp1 ) 
    5765      ENDIF 
     66      ! 
     67      ll4only = .FALSE.    ! default definition 
     68      IF( PRESENT(ld4only) )   ll4only = ld4only 
    5869      ! 
    5970      zland = 0._wp                                     ! land filling value: zero by default 
     
    6677         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with only one of the two arguments lsend or lrecv' 
    6778         CALL ctl_stop( 'STOP', ctmp1 ) 
    68       ELSE                                                  ! default neighbours 
    69          llsend(:) = mpiSnei(ihls,1:4) >= 0 
    70          llrecv(:) = mpiRnei(ihls,1:4) >= 0 
    71       END IF 
     79      ELSE                                              ! default neighbours 
     80         llsend(:) = mpiSnei(ihls,:) >= 0 
     81         IF( ll4only )   llsend(5:8) = .FALSE.          ! exclude corners 
     82         llrecv(:) = mpiRnei(ihls,:) >= 0 
     83         IF( ll4only )   llrecv(5:8) = .FALSE.          ! exclude corners 
     84      ENDIF 
    7285      ! 
    7386      ! define ifill: which method should be used to fill each parts (sides+corners) of the halos 
     
    7891         ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill(jn) = kfillmode    ! localy defined 
    7992         ELSE                                ;   ifill(jn) = jpfillcst    ! constant value (zland) 
    80          END IF 
    81       END DO 
     93         ENDIF 
     94      END DO 
     95      DO jn = 5, 8 
     96         IF(             llrecv(jn) ) THEN   ;   ifill(jn) = jpfillmpi    ! with an mpi communication 
     97         ELSE                                ;   ifill(jn) = jpfillnothing! do nothing 
     98         ENDIF 
     99      END DO 
     100         ! 
    82101      ! north fold treatment 
    83102      ll_IdoNFold = l_IdoNFold .AND. ifill(jpno) /= jpfillnothing 
     
    103122      !                   !                    ip0i ip1i        im1i im0i 
    104123      ! 
    105       !     sides:     west  east south north 
    106       isizei(1:4) = (/ ihls, ihls,  ipi,  ipi /)   ! i- count 
    107       isizej(1:4) = (/  ipj,  ipj, ihls, ihls /)   ! j- count 
    108       ishtSi(1:4) = (/ ip1i, im1i, ip0i, ip0i /)   ! i- shift send data 
    109       ishtSj(1:4) = (/ ip0j, ip0j, ip1j, im1j /)   ! j- shift send data 
    110       ishtRi(1:4) = (/ ip0i, im0i, ip0i, ip0i /)   ! i- shift received data location 
    111       ishtRj(1:4) = (/ ip0j, ip0j, ip0j, im0j /)   ! j- shift received data location 
    112       ishtPi(1:4) = (/ im1i, ip1i, ip0i, ip0i /)   ! i- shift data used for periodicity 
    113       ishtPj(1:4) = (/ ip0j, ip0j, im1j, ip1j /)   ! j- shift data used for periodicity 
     124      iwewe(:) = (/ jpwe,jpea,jpwe,jpea /)   ;   issnn(:) = (/ jpso,jpso,jpno,jpno /) 
     125      !cd     sides:     west  east south north      ;   corners: so-we, so-ea, no-we, no-ea 
     126      isizei(1:4) = (/ ihls, ihls,  ipi,  ipi /)   ;   isizei(5:8) = ihls              ! i- count 
     127      isizej(1:4) = (/  ipj,  ipj, ihls, ihls /)   ;   isizej(5:8) = ihls              ! j- count 
     128      ishtSi(1:4) = (/ ip1i, im1i, ip0i, ip0i /)   ;   ishtSi(5:8) = ishtSi( iwewe )   ! i- shift send data 
     129      ishtSj(1:4) = (/ ip0j, ip0j, ip1j, im1j /)   ;   ishtSj(5:8) = ishtSj( issnn )   ! j- shift send data 
     130      ishtRi(1:4) = (/ ip0i, im0i, ip0i, ip0i /)   ;   ishtRi(5:8) = ishtRi( iwewe )   ! i- shift received data location 
     131      ishtRj(1:4) = (/ ip0j, ip0j, ip0j, im0j /)   ;   ishtRj(5:8) = ishtRj( issnn )   ! j- shift received data location 
     132      ishtPi(1:4) = (/ im1i, ip1i, ip0i, ip0i /)   ;   ishtPi(5:8) = ishtPi( iwewe )   ! i- shift data used for periodicity 
     133      ishtPj(1:4) = (/ ip0j, ip0j, im1j, ip1j /)   ;   ishtPj(5:8) = ishtPj( issnn )   ! j- shift data used for periodicity 
    114134      ! 
    115135      ! -------------------------------- ! 
     
    117137      ! -------------------------------- ! 
    118138      ! 
    119       ireq(:) = MPI_REQUEST_NULL 
     139      ireq(:) = MPI_REQUEST_NULL             ! default definition when no communication is done. understood by mpi_waitall 
     140      iStag = (/ 1, 2, 3, 4, 5, 6, 7, 8 /)   ! any value but each one must be different 
     141      ! define iRtag with the corresponding iStag, e.g. data received at west where sent at east. 
     142      iRtag(jpwe) = iStag(jpea)   ;   iRtag(jpea) = iStag(jpwe)   ;   iRtag(jpso) = iStag(jpno)   ;   iRtag(jpno) = iStag(jpso) 
     143      iRtag(jpsw) = iStag(jpne)   ;   iRtag(jpse) = iStag(jpnw)   ;   iRtag(jpnw) = iStag(jpse)   ;   iRtag(jpne) = iStag(jpsw) 
     144      ! 
    120145      iszall(:) = isizei(:) * isizej(:) * ipk * ipl * ipf 
    121146      ishtS(1) = 0 
    122       DO jn = 2,4 
    123          ishtS(jn) = ishtS(jn-1) + iszall(jn-1) * COUNT( (/llsend(jn-1)/) )   ! with _alltoallv: in units of sendtype 
     147      DO jn = 2, 8 
     148         ishtS(jn) = ishtS(jn-1) + iszall(jn-1) * COUNT( (/llsend(jn-1)/) ) 
    124149      END DO 
    125150      ishtR(1) = 0 
    126       DO jn = 2,4 
    127          ishtR(jn) = ishtR(jn-1) + iszall(jn-1) * COUNT( (/llrecv(jn-1)/) )   ! with _alltoallv: in units of sendtype 
     151      DO jn = 2, 8 
     152         ishtR(jn) = ishtR(jn-1) + iszall(jn-1) * COUNT( (/llrecv(jn-1)/) ) 
    128153      END DO 
    129154 
     
    131156      ALLOCATE( zsnd( SUM(iszall, mask = llsend) ), zrcv( SUM(iszall, mask = llrecv) ) ) 
    132157      ! 
    133       ! -------------------------------------------------- ! 
    134       !     3. Do east and west MPI exchange if needed     ! 
    135       ! -------------------------------------------------- ! 
    136       ! 
    137       ! fill sending buffer with ARRAY_IN 
    138       idxs = 1 
     158      ! ----------------------------------------------- ! 
     159      !     3. Do east and west MPI_Isend if needed     ! 
     160      ! ----------------------------------------------- ! 
     161      ! 
    139162      DO jn = 1, 2 
    140163         IF( llsend(jn) ) THEN 
     
    145168               idxs = idxs + 1 
    146169            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO 
    147          END IF 
    148       END DO 
    149       ! 
    150 #if ! defined key_mpi_off 
    151       IF( ln_timing ) CALL tic_tac(.TRUE.) 
    152       ! 
    153       icomm = mpi_comm_oce        ! shorter name 
    154       ! non-blocking send of the western/eastern side using local temporary arrays 
    155       jn = jpwe 
    156       IF( llsend(jn) )   CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), 1, icomm, ireq(jn), ierr ) 
    157       jn = jpea 
    158       IF( llsend(jn) )   CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), 2, icomm, ireq(jn), ierr ) 
    159       ! blocking receive of the western/eastern halo in local temporary arrays 
    160       jn = jpwe 
    161       IF( llrecv(jn) )   CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), 2, icomm, MPI_STATUS_IGNORE, ierr ) 
    162       jn = jpea 
    163       IF( llrecv(jn) )   CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), 1, icomm, MPI_STATUS_IGNORE, ierr ) 
    164       ! 
    165       IF( ln_timing ) CALL tic_tac(.FALSE.) 
    166 #endif 
     170#if ! defined key_mpi_off 
     171            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     172            ! non-blocking send of the west/east side using local buffer 
     173            CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), iStag(jn), icomm, ireq(jn), ierr ) 
     174            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     175#endif 
     176         ENDIF 
     177      END DO 
    167178      ! 
    168179      ! ----------------------------------- ! 
     
    170181      ! ----------------------------------- ! 
    171182      ! 
    172       idxr = 1 
    173183      DO jn = 1, 2 
    174184         ishti = ishtRi(jn) 
     
    177187         CASE ( jpfillnothing )               ! no filling  
    178188         CASE ( jpfillmpi   )                 ! fill with data received by MPI 
     189#if ! defined key_mpi_off 
     190            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     191            !                                 ! blocking receive of the west/east halo in local temporary arrays 
     192            CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), iRtag(jn), icomm, MPI_STATUS_IGNORE, ierr ) 
     193            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     194#endif 
    179195            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn) 
    180196               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = zrcv(idxr) 
     
    212228      ENDIF 
    213229      ! 
    214       ! ---------------------------------------------------- ! 
    215       !     6. Do north and south MPI exchange if needed     ! 
    216       ! ---------------------------------------------------- ! 
     230      ! ------------------------------------------------- ! 
     231      !     6. Do north and south MPI_Isend if needed     ! 
     232      ! ------------------------------------------------- ! 
    217233      ! 
    218234      DO jn = 3, 4 
     
    224240               idxs = idxs + 1 
    225241            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO 
    226          END IF 
    227       END DO 
    228       ! 
    229 #if ! defined key_mpi_off 
    230       IF( ln_timing ) CALL tic_tac(.TRUE.) 
    231       ! 
    232       ! non-blocking send of the western/eastern side using local temporary arrays 
    233       jn = jpso 
    234       IF( llsend(jn) )   CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), 3, icomm, ireq(jn), ierr ) 
    235       jn = jpno 
    236       IF( llsend(jn) )   CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), 4, icomm, ireq(jn), ierr ) 
    237       ! blocking receive of the western/eastern halo in local temporary arrays 
    238       jn = jpso 
    239       IF( llrecv(jn) )   CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), 4, icomm, MPI_STATUS_IGNORE, ierr ) 
    240       jn = jpno 
    241       IF( llrecv(jn) )   CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), 3, icomm, MPI_STATUS_IGNORE, ierr ) 
    242       ! 
    243       IF( ln_timing ) CALL tic_tac(.FALSE.) 
    244 #endif 
     242#if ! defined key_mpi_off 
     243            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     244            ! non-blocking send of the south/north side using local buffer 
     245            CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), iStag(jn), icomm, ireq(jn), ierr ) 
     246            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     247#endif 
     248         ENDIF 
     249      END DO 
    245250      ! 
    246251      ! ------------------------------------- ! 
     
    254259         CASE ( jpfillnothing )               ! no filling  
    255260         CASE ( jpfillmpi   )                 ! fill with data received by MPI 
     261#if ! defined key_mpi_off 
     262            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     263            !                                 ! blocking receive of the south/north halo in local temporary arrays 
     264            CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), iRtag(jn), icomm, MPI_STATUS_IGNORE, ierr ) 
     265            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     266#endif 
    256267            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn) 
    257268               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = zrcv(idxr) 
     
    277288      END DO 
    278289      ! 
     290      ! ----------------------------------------------- ! 
     291      !     8. Specific problem in corner treatment     ! 
     292      !              ( very rate case... )              ! 
     293      ! ----------------------------------------------- ! 
     294      ! 
     295      DO jn = 5, 8 
     296         IF( llsend(jn) ) THEN 
     297            ishti = ishtSi(jn) 
     298            ishtj = ishtSj(jn) 
     299            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn) 
     300               zsnd(idxs) = ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) 
     301               idxs = idxs + 1 
     302            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO 
     303#if ! defined key_mpi_off 
     304            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     305            ! non-blocking send of the corners using local buffer 
     306            CALL MPI_ISEND( zsnd(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), iStag(jn), icomm, ireq(jn), ierr ) 
     307            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     308#endif 
     309         ENDIF 
     310      END DO 
     311      DO jn = 5, 8 
     312         IF( llrecv(jn) ) THEN 
     313#if ! defined key_mpi_off 
     314            IF( ln_timing ) CALL tic_tac(.TRUE.) 
     315            ! blocking receive of the corner halo in local temporary arrays 
     316            CALL MPI_RECV(  zrcv(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), iRtag(jn), icomm, MPI_STATUS_IGNORE, ierr ) 
     317            IF( ln_timing ) CALL tic_tac(.FALSE.) 
     318#endif 
     319            ishti = ishtRi(jn) 
     320            ishtj = ishtRj(jn) 
     321            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn) 
     322               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = zrcv(idxr) 
     323               idxr = idxr + 1 
     324            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO 
     325         ENDIF 
     326      END DO 
     327      ! 
    279328      ! -------------------------------------------- ! 
    280       !     8. deallocate local temporary arrays     ! 
     329      !     9. deallocate local temporary arrays     ! 
    281330      ! -------------------------------------------- ! 
    282331      ! 
    283       CALL mpi_waitall(4, ireq, MPI_STATUSES_IGNORE, ierr) 
     332      CALL mpi_waitall(8, ireq, MPI_STATUSES_IGNORE, ierr) 
    284333      DEALLOCATE( zsnd, zrcv ) 
    285334      ! 
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbclnk.F90

    r14349 r14366  
    5151 
    5252   !! * Substitutions 
    53 #  include "do_loop_substitute.h90" 
     53   !!#  include "do_loop_substitute.h90" 
    5454   !!---------------------------------------------------------------------- 
    5555   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/mppini.F90

    r14363 r14366  
    453453            WRITE(inum,'(15i6)')  jp-1, ii, ij, ijpi(ii,ij), ijpj(ii,ij), iimppt(ii,ij), ijmppt(ii,ij), inei(:,ii,ij) 
    454454         END DO 
    455       END IF 
     455      ENDIF 
    456456 
    457457      ! 
     
    564564            WRITE(inum,'(a,8i6)') ' Recv: ', ichanged(jh*16 -7:jh*16  ) 
    565565         END DO 
    566       END IF 
     566      ENDIF 
    567567      ! 
    568568      CALL init_ioipsl           ! Prepare NetCDF output file (if necessary) 
     
    781781               iszi1(ii) = iszi0(ji) 
    782782               iszj1(ii) = iszj0(jj) 
    783             END IF 
     783            ENDIF 
    784784         END DO 
    785785      END DO 
     
    837837            WRITE(numout,*) '  -----------------------------------------------------' 
    838838            WRITE(numout,*) 
    839          END IF 
     839         ENDIF 
    840840         ji = isz0   ! initialization with the largest value 
    841841         ALLOCATE( llisOce(inbi0(ji), inbj0(ji)) ) 
     
    854854                  &   '%), largest oce domain: ', iszi0(ji)*iszj0(ji), ' ( ', iszi0(ji),' x ', iszj0(ji), ' )' 
    855855               inbijold = inbij 
    856             END IF 
     856            ENDIF 
    857857         END DO 
    858858         DEALLOCATE( inbi0, inbj0, iszi0, iszj0 ) 
     
    12081208ENDIF 
    12091209         ! 
     1210         ! Specific (and rare) problem in corner treatment because we do 1st West-East comm, next South-North comm 
     1211         IF( nn_comm == 1 ) THEN 
     1212            IF( mpiSnei(jh,jpwe) > -1 )   mpiSnei(jh, (/jpsw,jpnw/) ) = -1   ! SW and NW corners already sent through West nei 
     1213            IF( mpiSnei(jh,jpea) > -1 )   mpiSnei(jh, (/jpse,jpne/) ) = -1   ! SE and NE corners already sent through East nei 
     1214            IF( mpiRnei(jh,jpso) > -1 )   mpiRnei(jh, (/jpsw,jpse/) ) = -1   ! SW and SE corners will be received through South nei 
     1215            IF( mpiRnei(jh,jpno) > -1 )   mpiRnei(jh, (/jpnw,jpne/) ) = -1   ! NW and NE corners will be received through North nei 
     1216        ENDIF 
     1217         ! 
    12101218         DEALLOCATE( zmsk ) 
    12111219         ! 
  • NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/module_example.F90

    r14041 r14366  
    127127      ! WARNING! the lbc_lnk call could not be compatible with the tiling approach 
    128128      ! please refer to the manual for how to adapt your code 
    129       CALL lbc_lnk( 'module_example', avm, 'T', 1., ncsten=true )     ! Lateral boundary conditions (unchanged sign) 
    130       !                                                                ! ncsten=false for 5-points stencil communication 
    131       !                                                                ! ncsten=true (default)  for 9-points stencil communication 
     129      CALL lbc_lnk( 'module_example', avm, 'T', 1. )     ! Lateral boundary conditions (unchanged sign) 
    132130      ! 
    133131   END SUBROUTINE exa_mpl 
Note: See TracChangeset for help on using the changeset viewer.