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 11940 for NEMO/branches/2019 – NEMO

Changeset 11940 for NEMO/branches/2019


Ignore:
Timestamp:
2019-11-20T22:48:28+01:00 (4 years ago)
Author:
mocavero
Message:

Add MPI3 neighbourhood collectives halo exchange in LBC and call it in tracer advection FCT scheme #2011

Location:
NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/OCE
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/OCE/LBC/lbclnk.F90

    r11799 r11940  
    1313   !!             -   ! 2017-04  (G. Madec) remove duplicated routines (lbc_lnk_2d_9, lbc_lnk_2d_multiple, lbc_lnk_3d_gather) 
    1414   !!             -   ! 2017-05  (G. Madec) create generic.h90 files to generate all lbc and north fold routines 
     15   !!             -   !  2019  (S. Mocavero, I. Epicoco - CMCC) create generic.h90 files to introduce MPI3 neighbourhood collectives 
     16 
    1517   !!---------------------------------------------------------------------- 
    1618   !!           define the generic interfaces of lib_mpp routines 
     
    3638      MODULE PROCEDURE   lbc_lnk_2d_multi, lbc_lnk_3d_multi, lbc_lnk_4d_multi 
    3739   END INTERFACE 
     40   INTERFACE lbc_lnk_nc_multi 
     41      MODULE PROCEDURE   lbc_lnk_nc_2d, lbc_lnk_nc_3d, lbc_lnk_nc_4d 
     42   END INTERFACE 
     43   INTERFACE lbc_lnk_nc 
     44      MODULE PROCEDURE   mpp_lnk_nc_2d, mpp_lnk_nc_3d, mpp_lnk_nc_4d 
     45   END INTERFACE 
    3846   ! 
    3947   INTERFACE lbc_lnk_icb 
     
    4654   END INTERFACE 
    4755 
    48    PUBLIC   lbc_lnk       ! ocean/ice lateral boundary conditions 
    49    PUBLIC   lbc_lnk_multi ! modified ocean/ice lateral boundary conditions 
    50    PUBLIC   lbc_lnk_icb   ! iceberg lateral boundary conditions 
     56   PUBLIC   lbc_lnk            ! ocean/ice lateral boundary conditions 
     57   PUBLIC   lbc_lnk_multi      ! modified ocean/ice lateral boundary conditions 
     58   PUBLIC   lbc_lnk_icb        ! iceberg lateral boundary conditions 
     59   PUBLIC   lbc_lnk_nc_multi   ! modified ocean/ice lateral boundary conditions 
    5160 
    5261#if   defined key_mpp_mpi 
     
    163172#     undef ROUTINE_LNK 
    164173#     undef MULTI 
     174#  undef DIM_4d 
     175 
     176   !!---------------------------------------------------------------------- 
     177   !!                   ***  routine lbc_lnk_nc_(2,3,4)d  *** 
     178   !! 
     179   !!   * Argument : dummy argument use in lbc_lnk_nc_... routines 
     180   !!                ptab   :   array or pointer of arrays on which the boundary 
     181   !condition is applied 
     182   !!                cd_nat :   nature of array grid-points 
     183   !!                psgn   :   sign used across the north fold boundary 
     184   !!                kfld   :   optional, number of pt3d arrays 
     185   !!                cd_mpp :   optional, fill the overlap area only 
     186   !!                pval   :   optional, background value (used at closed 
     187   !boundaries) 
     188   !!---------------------------------------------------------------------- 
     189   ! 
     190   !                       !==  2D array and array of 2D pointer  ==! 
     191   ! 
     192#  define DIM_2d 
     193#     define ROUTINE_NC_LOAD            load_ptr_nc_2d 
     194#     define ROUTINE_MULTI_NC           lbc_lnk_nc_2d 
     195#     include "lbc_lnk_nc_generic.h90" 
     196#     undef ROUTINE_MULTI_NC 
     197#     undef ROUTINE_NC_LOAD 
     198#  undef DIM_2d 
     199   ! 
     200   !                       !==  3D array and array of 3D pointer  ==! 
     201   ! 
     202#  define DIM_3d 
     203#     define ROUTINE_NC_LOAD            load_ptr_nc_3d 
     204#     define ROUTINE_MULTI_NC           lbc_lnk_nc_3d 
     205#     include "lbc_lnk_nc_generic.h90" 
     206#     undef ROUTINE_MULTI_NC 
     207#     undef ROUTINE_NC_LOAD 
     208#  undef DIM_3d 
     209   ! 
     210   !                       !==  4D array and array of 4D pointer  ==! 
     211   ! 
     212#  define DIM_4d 
     213#     define ROUTINE_NC_LOAD            load_ptr_nc_4d 
     214#     define ROUTINE_MULTI_NC           lbc_lnk_nc_4d 
     215#     include "lbc_lnk_nc_generic.h90" 
     216#     undef ROUTINE_LOAD 
     217#     undef ROUTINE_NC_LOAD 
     218#  undef DIM_4d 
     219 
     220   !!---------------------------------------------------------------------- 
     221   !!                   ***  routine mpp_nc_(2,3,4)d  *** 
     222   !! 
     223   !!   * Argument : dummy argument use in mpp_nc_... routines 
     224   !!                ptab   :   array or pointer of arrays on which the boundary condition is applied 
     225   !!                cd_nat :   nature of array grid-points 
     226   !!                psgn   :   sign used across the north fold boundary 
     227   !!                kfld   :   optional, number of pt3d arrays 
     228   !!                cd_mpp :   optional, fill the overlap area only 
     229   !!                pval   :   optional, background value (used at closed boundaries) 
     230   !!---------------------------------------------------------------------- 
     231   ! 
     232   !                       !==  2D array and array of 2D pointer  ==! 
     233   ! 
     234#  define DIM_2d 
     235#     define ROUTINE_NC           mpp_lnk_nc_2d 
     236#     include "mpp_nc_generic.h90" 
     237#     undef ROUTINE_NC 
     238#  undef DIM_2d 
     239   ! 
     240   !                       !==  3D array and array of 3D pointer  ==! 
     241   ! 
     242#  define DIM_3d 
     243#     define ROUTINE_NC           mpp_lnk_nc_3d 
     244#     include "mpp_nc_generic.h90" 
     245#     undef ROUTINE_NC 
     246#  undef DIM_3d 
     247   ! 
     248   !                       !==  4D array and array of 4D pointer  ==! 
     249   ! 
     250#  define DIM_4d 
     251#     define ROUTINE_NC           mpp_lnk_nc_4d 
     252#     include "mpp_nc_generic.h90" 
     253#     undef ROUTINE_NC 
    165254#  undef DIM_4d 
    166255 
  • NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/OCE/LBC/lib_mpp.F90

    r11799 r11940  
    2525   !!            4.0  !  2017  (G. Madec) automatique allocation of array argument (use any 3rd dimension) 
    2626   !!             -   !  2017  (G. Madec) create generic.h90 files to generate all lbc and north fold routines 
     27   !!             -   !  2019  (S. Mocavero, I. Epicoco - CMCC) add MPI3 neighbourhood collectives 
    2728   !!---------------------------------------------------------------------- 
    2829 
     
    5051   !!   mpp_ini_north : initialisation of north fold 
    5152   !!   mpp_lbc_north_icb : alternative to mpp_nfd for extra outer halo with icebergs 
     53   !!   mpp_ini_nc    : initialisation of MPI3 neighbourhood collectives communicator 
    5254   !!---------------------------------------------------------------------- 
    5355   USE dom_oce        ! ocean space and time domain 
     
    6466   PUBLIC   mppscatter, mppgather 
    6567   PUBLIC   mpp_ini_znl 
     68   PUBLIC   mpp_ini_nc 
    6669   PUBLIC   mppsend, mpprecv                          ! needed by TAM and ICB routines 
    6770   PUBLIC   mpp_report 
     
    132135   INTEGER, PUBLIC ::   north_root        !: number (in the comm_opa) of proc 0 in the northern comm 
    133136   INTEGER, PUBLIC, DIMENSION(:), ALLOCATABLE, SAVE ::   nrank_north   !: dimension ndim_rank_north 
     137 
     138   ! variables used for MPI3 neighbourhood collectives 
     139   INTEGER, PUBLIC :: mpi_nc_com                   ! MPI3 neighbourhood collectives communicator 
     140   INTEGER, PUBLIC, DIMENSION(:), ALLOCATABLE :: nranks 
    134141 
    135142   ! Communications summary report 
     
    800807 
    801808   END SUBROUTINE mpp_ini_znl 
     809 
     810   SUBROUTINE mpp_ini_nc 
     811      !!---------------------------------------------------------------------- 
     812      !!               ***  routine mpp_ini_nc  *** 
     813      !! 
     814      !! ** Purpose :   Initialize special communicator for MPI3 neighbourhood 
     815      !!                collectives 
     816      !! 
     817      !! ** Method  : - Create a cartesian communicator starting from the 
     818      !processes    
     819      !!                distribution along i and j directions 
     820      ! 
     821      !! ** output 
     822      !!         mpi_nc_com = MPI3 neighbourhood collectives communicator 
     823      !! 
     824      !!---------------------------------------------------------------------- 
     825      INTEGER, DIMENSION(2) :: ipdims 
     826      LOGICAL, PARAMETER :: ireord = .FALSE. 
     827      LOGICAL :: nperiod_nc ( 2 ) = .FALSE. 
     828      INTEGER :: mpi_nc_com_re, igroup, iprc, ingroup, iii, jjj 
     829      INTEGER :: ierr 
     830 
     831#if defined key_mpp_mpi 
     832      ipdims(1) = jpni 
     833      ipdims(2) = jpnj 
     834      nperiod_nc(1) = .TRUE. 
     835 
     836      iprc = jpni*jpnj 
     837 
     838      ! Create a group from mpi_comm_oce 
     839      CALL MPI_Comm_group(mpi_comm_oce, igroup, ierr) 
     840 
     841      ! Create a group to reorder MPI rank 
     842      CALL MPI_Group_incl(igroup, iprc, nranks, ingroup, ierr) 
     843 
     844      ! Create reordered communicator 
     845      CALL MPI_Comm_create(mpi_comm_oce, ingroup, mpi_nc_com_re, ierr) 
     846 
     847      ! Create the cartesian communicator 
     848      CALL MPI_Cart_create(mpi_nc_com_re, 2, ipdims, nperiod_nc, ireord, mpi_nc_com, ierr) 
     849      DEALLOCATE (nranks) 
     850#endif 
     851   END SUBROUTINE mpp_ini_nc 
    802852 
    803853 
  • NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/OCE/LBC/mppini.F90

    r11799 r11940  
    3838   INTEGER :: numbot = -1  ! 'bottom_level' local logical unit 
    3939   INTEGER :: numbdy = -1  ! 'bdy_msk'      local logical unit 
    40     
     40 
    4141   !!---------------------------------------------------------------------- 
    4242   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    464464      END DO 
    465465      nfipproc(:,:) = ipproc(:,:) 
     466 
     467      ! compute rank for MPI3 neighbourhood colectives 
     468      ALLOCATE(nranks(jpni*jpnj)) 
     469      icont = 1 
     470      DO ji = 1, jpni 
     471         DO jj = 1, jpnj 
     472            nranks(icont) = ipproc(ji,jj) 
     473            icont = icont + 1 
     474         END DO 
     475      END DO 
    466476 
    467477      ! neighbour treatment: change ibondi, ibondj if next to a land zone 
     
    694704         ENDIF 
    695705      ENDIF 
     706 
     707      CALL mpp_ini_nc 
    696708      ! 
    697709      CALL mpp_init_ioipsl       ! Prepare NetCDF output file (if necessary) 
  • NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/OCE/TRA/traadv_fct.F90

    r11411 r11940  
    8989      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   zwinf, zwdia, zwsup 
    9090      LOGICAL  ::   ll_zAimp                                 ! flag to apply adaptive implicit vertical advection 
     91 
    9192      !!---------------------------------------------------------------------- 
    9293      ! 
     
    254255               END DO 
    255256            END DO 
    256             CALL lbc_lnk_multi( 'traadv_fct', zltu, 'T', 1. , zltv, 'T', 1. )   ! Lateral boundary cond. (unchanged sgn) 
     257 
     258            IF(jpnij .eq. jpni*jpnj) THEN 
     259               CALL lbc_lnk_nc_multi( 'traadv_fct', zltu, 'T', 1. , zltv, 'T', 1. )   ! Lateral boundary cond. (unchanged sgn) 
     260            ELSE 
     261               CALL lbc_lnk_multi( 'traadv_fct', zltu, 'T', 1. , zltv, 'T', 1. )   ! Lateral boundary cond. (unchanged sgn) 
     262            END IF 
    257263            ! 
    258264            DO jk = 1, jpkm1                 ! Horizontal advective fluxes 
     
    279285               END DO 
    280286            END DO 
    281             CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1. , ztv, 'V', -1. )   ! Lateral boundary cond. (unchanged sgn) 
     287 
     288            IF(jpnij .eq. jpni*jpnj) THEN 
     289               CALL lbc_lnk_nc_multi( 'traadv_fct', ztu, 'U', -1. , ztv, 'V', -1. )   ! Lateral boundary cond. (unchanged sgn) 
     290            ELSE 
     291               CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1. , ztv, 'V', -1. )   ! Lateral boundary cond. (unchanged sgn) 
     292            END IF 
    282293            ! 
    283294            DO jk = 1, jpkm1                 ! Horizontal advective fluxes 
     
    351362         END IF 
    352363         ! 
    353          CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1., zwx, 'U', -1. , zwy, 'V', -1.,  zwz, 'W',  1. ) 
     364         IF(jpnij .eq. jpni*jpnj) THEN 
     365            CALL lbc_lnk_nc_multi( 'traadv_fct', zwi, 'T', 1., zwx, 'U', -1. , zwy, 'V', -1.,  zwz, 'W',  1. ) 
     366         ELSE 
     367            CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1., zwx, 'U', -1. , zwy, 'V', -1.,  zwz, 'W',  1. ) 
     368         END IF 
    354369         ! 
    355370         !        !==  monotonicity algorithm  ==! 
     
    413428         ENDIF 
    414429         ! 
     430 
    415431      END DO                     ! end of tracer loop 
    416432      ! 
     
    426442      ! 
    427443   END SUBROUTINE tra_adv_fct 
    428  
    429444 
    430445   SUBROUTINE nonosc( pbef, paa, pbb, pcc, paft, p2dt ) 
     
    498513         END DO 
    499514      END DO 
    500       CALL lbc_lnk_multi( 'traadv_fct', zbetup, 'T', 1. , zbetdo, 'T', 1. )   ! lateral boundary cond. (unchanged sign) 
    501  
     515      IF(jpnij .eq. jpni*jpnj) THEN 
     516         CALL lbc_lnk_nc_multi( 'traadv_fct', zbetup, 'T', 1. , zbetdo, 'T', 1. )   ! lateral boundary cond. (unchanged sign) 
     517      ELSE 
     518         CALL lbc_lnk_multi( 'traadv_fct', zbetup, 'T', 1. , zbetdo, 'T', 1. )   ! lateral boundary cond. (unchanged sign) 
     519      END IF 
    502520      ! 3. monotonic flux in the i & j direction (paa & pbb) 
    503521      ! ---------------------------------------- 
     
    524542         END DO 
    525543      END DO 
    526       CALL lbc_lnk_multi( 'traadv_fct', paa, 'U', -1. , pbb, 'V', -1. )   ! lateral boundary condition (changed sign) 
     544      IF(jpnij .eq. jpni*jpnj) THEN 
     545         CALL lbc_lnk_nc_multi( 'traadv_fct', paa, 'U', -1. , pbb, 'V', -1. )   ! lateral boundary condition (changed sign) 
     546      ELSE 
     547         CALL lbc_lnk_multi( 'traadv_fct', paa, 'U', -1. , pbb, 'V', -1. )   ! lateral boundary condition (changed sign) 
     548      END IF 
    527549      ! 
    528550   END SUBROUTINE nonosc 
Note: See TracChangeset for help on using the changeset viewer.