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

Changeset 13303


Ignore:
Timestamp:
2020-07-14T13:38:28+02:00 (4 years ago)
Author:
mocavero
Message:

Add neighborhood collectives lbc routines - ticket #2496

Location:
NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/lbclnk.F90

    r13226 r13303  
    3939      MODULE PROCEDURE   lbc_lnk_2d_multi_dp , lbc_lnk_3d_multi_dp, lbc_lnk_4d_multi_dp 
    4040   END INTERFACE 
     41   INTERFACE lbc_lnk_nc_multi 
     42      MODULE PROCEDURE   lbc_lnk_nc_2d_sp, lbc_lnk_nc_3d_sp, lbc_lnk_nc_4d_sp 
     43      MODULE PROCEDURE   lbc_lnk_nc_2d_dp, lbc_lnk_nc_3d_dp, lbc_lnk_nc_4d_dp 
     44   END INTERFACE 
     45   INTERFACE lbc_lnk_nc 
     46      MODULE PROCEDURE   mpp_lnk_nc_2d_sp, mpp_lnk_nc_3d_sp, mpp_lnk_nc_4d_sp 
     47      MODULE PROCEDURE   mpp_lnk_nc_2d_dp, mpp_lnk_nc_3d_dp, mpp_lnk_nc_4d_dp 
     48   END INTERFACE 
    4149   ! 
    4250   INTERFACE lbc_lnk_icb 
     
    5260   END INTERFACE 
    5361 
    54    PUBLIC   lbc_lnk       ! ocean/ice lateral boundary conditions 
    55    PUBLIC   lbc_lnk_multi ! modified ocean/ice lateral boundary conditions 
    56    PUBLIC   lbc_lnk_icb   ! iceberg lateral boundary conditions 
     62   PUBLIC   lbc_lnk            ! ocean/ice lateral boundary conditions 
     63   PUBLIC   lbc_lnk_multi      ! modified ocean/ice lateral boundary conditions 
     64   PUBLIC   lbc_lnk_icb        ! iceberg lateral boundary conditions 
     65   PUBLIC   lbc_lnk_nc         ! ocean/ice lateral boundary conditions (MPI3 version) 
     66   PUBLIC   lbc_lnk_nc_multi   ! modified ocean/ice lateral boundary conditions (MPI3 version) 
    5767 
    5868#if   defined key_mpp_mpi 
     
    250260#  undef DIM_4d 
    251261 
     262   !!---------------------------------------------------------------------- 
     263   !!                   ***   load_ptr_(2,3,4)d   *** 
     264   !! 
     265   !!   * Dummy Argument : 
     266   !!       in    ==>   ptab       ! array to be loaded (2D, 3D or 4D) 
     267   !!                   cd_nat     ! nature of pt2d array grid-points 
     268   !!                   psgn       ! sign used across the north fold boundary 
     269   !!       inout <=>   ptab_ptr   ! array of 2D, 3D or 4D pointers 
     270   !!                   cdna_ptr   ! nature of ptab array grid-points 
     271   !!                   psgn_ptr   ! sign used across the north fold boundary 
     272   !!                   kfld       ! number of elements that has been attributed 
     273   !!---------------------------------------------------------------------- 
     274 
     275   !!---------------------------------------------------------------------- 
     276   !!                  ***   lbc_lnk_nc(2,3,4)d_multi   *** 
     277   !!                     ***   load_ptr_(2,3,4)d   *** 
     278   !! 
     279   !!   * Argument : dummy argument use in lbc_lnk_nc_multi_... routines 
     280   !! 
     281   !!---------------------------------------------------------------------- 
     282 
     283   !! 
     284   !!   ----   SINGLE PRECISION VERSIONS 
     285   !! 
     286#  define SINGLE_PRECISION 
     287#  define DIM_2d 
     288#     define ROUTINE_NC_LOAD           load_ptr_nc_2d_sp 
     289#     define ROUTINE_MULTI_NC          lbc_lnk_nc_2d_sp 
     290#     include "lbc_lnk_nc_generic.h90" 
     291#     undef ROUTINE_MULTI_NC 
     292#     undef ROUTINE_NC_LOAD 
     293#  undef DIM_2d 
     294 
     295#  define DIM_3d 
     296#     define ROUTINE_NC_LOAD           load_ptr_nc_3d_sp 
     297#     define ROUTINE_MULTI_NC          lbc_lnk_nc_3d_sp 
     298#     include "lbc_lnk_nc_generic.h90" 
     299#     undef ROUTINE_MULTI_NC 
     300#     undef ROUTINE_NC_LOAD 
     301#  undef DIM_3d 
     302 
     303#  define DIM_4d 
     304#     define ROUTINE_NC_LOAD           load_ptr_nc_4d_sp 
     305#     define ROUTINE_MULTI_NC          lbc_lnk_nc_4d_sp 
     306#     include "lbc_lnk_nc_generic.h90" 
     307#     undef ROUTINE_MULTI_NC 
     308#     undef ROUTINE_NC_LOAD 
     309#  undef DIM_4d 
     310#  undef SINGLE_PRECISION 
     311   !! 
     312   !!   ----   DOUBLE PRECISION VERSIONS 
     313   !! 
     314 
     315#  define DIM_2d 
     316#     define ROUTINE_NC_LOAD           load_ptr_nc_2d_dp 
     317#     define ROUTINE_MULTI_NC          lbc_lnk_nc_2d_dp 
     318#     include "lbc_lnk_nc_generic.h90" 
     319#     undef ROUTINE_MULTI_NC 
     320#     undef ROUTINE_NC_LOAD 
     321#  undef DIM_2d 
     322 
     323#  define DIM_3d 
     324#     define ROUTINE_NC_LOAD           load_ptr_nc_3d_dp 
     325#     define ROUTINE_MULTI_NC          lbc_lnk_nc_3d_dp 
     326#     include "lbc_lnk_nc_generic.h90" 
     327#     undef ROUTINE_MULTI_NC 
     328#     undef ROUTINE_NC_LOAD 
     329#  undef DIM_3d 
     330 
     331#  define DIM_4d 
     332#     define ROUTINE_NC_LOAD           load_ptr_nc_4d_dp 
     333#     define ROUTINE_MULTI_NC          lbc_lnk_nc_4d_dp 
     334#     include "lbc_lnk_nc_generic.h90" 
     335#     undef ROUTINE_MULTI_NC 
     336#     undef ROUTINE_NC_LOAD 
     337#  undef DIM_4d 
     338 
     339   !!---------------------------------------------------------------------- 
     340   !!                   ***  routine mpp_lnk_nc_(2,3,4)d  *** 
     341   !! 
     342   !!   * Argument : dummy argument use in mpp_lnk_... routines 
     343   !!                ptab      :   array or pointer of arrays on which the boundary condition is applied 
     344   !!                cd_nat    :   nature of array grid-points 
     345   !!                psgn      :   sign used across the north fold boundary 
     346   !!                kfld      :   optional, number of pt3d arrays 
     347   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables) 
     348   !!                pfillval  :   optional, background value (used with jpfillcopy) 
     349   !!---------------------------------------------------------------------- 
     350   ! 
     351   !                       !==  2D array and array of 2D pointer  ==! 
     352   ! 
     353   !! 
     354   !!   ----   SINGLE PRECISION VERSIONS 
     355   !! 
     356# define SINGLE_PRECISION 
     357#  define DIM_2d 
     358#     define ROUTINE_NC           mpp_lnk_nc_2d_sp 
     359#     include "mpp_nc_generic.h90" 
     360#     undef ROUTINE_NC 
     361#  undef DIM_2d 
     362   ! 
     363   !                       !==  3D array and array of 3D pointer  ==! 
     364   ! 
     365#  define DIM_3d 
     366#     define ROUTINE_NC           mpp_lnk_nc_3d_sp 
     367#     include "mpp_nc_generic.h90" 
     368#     undef ROUTINE_NC 
     369#  undef DIM_3d 
     370   ! 
     371   !                       !==  4D array and array of 4D pointer  ==! 
     372   ! 
     373#  define DIM_4d 
     374#     define ROUTINE_NC           mpp_lnk_nc_4d_sp 
     375#     include "mpp_nc_generic.h90" 
     376#     undef ROUTINE_NC 
     377#  undef DIM_4d 
     378# undef SINGLE_PRECISION 
     379 
     380   !! 
     381   !!   ----   DOUBLE PRECISION VERSIONS 
     382   !! 
     383#  define DIM_2d 
     384#     define ROUTINE_NC           mpp_lnk_nc_2d_dp 
     385#     include "mpp_nc_generic.h90" 
     386#     undef ROUTINE_NC 
     387#  undef DIM_2d 
     388   ! 
     389   !                       !==  3D array and array of 3D pointer  ==! 
     390   ! 
     391#  define DIM_3d 
     392#     define ROUTINE_NC           mpp_lnk_nc_3d_dp 
     393#     include "mpp_nc_generic.h90" 
     394#     undef ROUTINE_NC 
     395#  undef DIM_3d 
     396   ! 
     397   !                       !==  4D array and array of 4D pointer  ==! 
     398   ! 
     399#  define DIM_4d 
     400#     define ROUTINE_NC           mpp_lnk_nc_4d_dp 
     401#     include "mpp_nc_generic.h90" 
     402#     undef ROUTINE_NC 
     403#  undef DIM_4d 
    252404 
    253405   !!---------------------------------------------------------------------- 
  • NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/lib_mpp.F90

    r13286 r13303  
    6666   PUBLIC   mppscatter, mppgather 
    6767   PUBLIC   mpp_ini_znl 
     68   PUBLIC   mpp_ini_nc 
    6869   PUBLIC   mppsend, mpprecv                          ! needed by TAM and ICB routines 
    6970   PUBLIC   mppsend_sp, mpprecv_sp                          ! needed by TAM and ICB routines 
     
    135136   INTEGER         ::   ndim_rank_znl   !  number of processors on the same zonal average 
    136137   INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::   nrank_znl  ! dimension ndim_rank_znl, number of the procs into the same znl domain 
     138 
     139   ! variables used for MPI3 neighbourhood collectives 
     140   INTEGER, PUBLIC :: mpi_nc_com                   ! MPI3 neighbourhood collectives communicator 
     141   INTEGER, PUBLIC, DIMENSION(:), ALLOCATABLE :: nranks 
    137142 
    138143   ! North fold condition in mpp_mpi with jpni > 1 (PUBLIC for TAM) 
     
    10641069 
    10651070   END SUBROUTINE mpp_ini_znl 
     1071 
     1072   SUBROUTINE mpp_ini_nc 
     1073      !!---------------------------------------------------------------------- 
     1074      !!               ***  routine mpp_ini_nc  *** 
     1075      !! 
     1076      !! ** Purpose :   Initialize special communicator for MPI3 neighbourhood 
     1077      !!                collectives 
     1078      !! 
     1079      !! ** Method  : - Create a graph communicator starting from the processes    
     1080      !!                distribution along i and j directions 
     1081      ! 
     1082      !! ** output 
     1083      !!         mpi_nc_com = MPI3 neighbourhood collectives communicator 
     1084      !! 
     1085      !!---------------------------------------------------------------------- 
     1086      INTEGER, DIMENSION(:), ALLOCATABLE :: ineigh 
     1087      INTEGER :: ideg, icont 
     1088      INTEGER :: iinfo, ierr 
     1089      LOGICAL, PARAMETER :: ireord = .FALSE. 
     1090 
     1091#if defined key_mpp_mpi 
     1092      ideg = 0 
     1093      icont = 0 
     1094 
     1095      IF (nbondi .eq. 1) THEN 
     1096         ideg = ideg + 1 
     1097      ELSEIF (nbondi .eq. -1) THEN 
     1098         ideg = ideg + 1 
     1099      ELSEIF (nbondi .eq. 0) THEN 
     1100         ideg = ideg + 2 
     1101      ENDIF 
     1102 
     1103      IF (nbondj .eq. 1) THEN 
     1104         ideg = ideg + 1 
     1105      ELSEIF (nbondj .eq. -1) THEN 
     1106         ideg = ideg + 1 
     1107      ELSEIF (nbondj .eq. 0) THEN 
     1108         ideg = ideg + 2 
     1109      ENDIF 
     1110 
     1111      ALLOCATE(ineigh(ideg)) 
     1112 
     1113      IF (nbondi .eq. 1) THEN 
     1114         icont = icont + 1 
     1115         ineigh(icont) = nowe 
     1116      ELSEIF (nbondi .eq. -1) THEN 
     1117         icont = icont + 1 
     1118         ineigh(icont) = noea 
     1119      ELSEIF (nbondi .eq. 0) THEN 
     1120         icont = icont + 1 
     1121         ineigh(icont) = nowe 
     1122         icont = icont + 1 
     1123         ineigh(icont) = noea 
     1124      ENDIF 
     1125 
     1126      IF (nbondj .eq. 1) THEN 
     1127         icont = icont + 1 
     1128         ineigh(icont) = noso 
     1129      ELSEIF (nbondj .eq. -1) THEN 
     1130         icont = icont + 1 
     1131         ineigh(icont) = nono 
     1132      ELSEIF (nbondj .eq. 0) THEN 
     1133         icont = icont + 1 
     1134         ineigh(icont) = noso 
     1135         icont = icont + 1 
     1136         ineigh(icont) = nono 
     1137      ENDIF 
     1138 
     1139      CALL MPI_Dist_graph_create_adjacent(mpi_comm_oce, ideg, ineigh, MPI_UNWEIGHTED, ideg, ineigh, MPI_UNWEIGHTED, MPI_INFO_NULL, ireord, mpi_nc_com, ierr) 
     1140      DEALLOCATE (ineigh) 
     1141#endif 
     1142   END SUBROUTINE mpp_ini_nc 
     1143 
    10661144 
    10671145 
  • NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/mppini.F90

    r13291 r13303  
    653653         ENDIF 
    654654      ENDIF 
     655 
     656      ! 
     657      CALL mpp_ini_nc        ! Initialize communicator for neighbourhood collective communications 
    655658      ! 
    656659      CALL init_ioipsl       ! Prepare NetCDF output file (if necessary) 
  • NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/TRA/traadv_fct.F90

    r13295 r13303  
    236236               END_2D 
    237237            END DO 
    238             CALL lbc_lnk_multi( 'traadv_fct', zltu, 'T', 1.0_wp , zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn) 
     238            CALL lbc_lnk_nc_multi( 'traadv_fct', zltu, 'T', 1.0_wp , zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn) 
    239239            ! 
    240240            DO_3D( 1, 0, 1, 0, 1, jpkm1 ) 
     
    253253               ztv(ji,jj,jk) = ( pt(ji  ,jj+1,jk,jn,Kmm) - pt(ji,jj,jk,jn,Kmm) ) * vmask(ji,jj,jk) 
    254254            END_3D 
    255             CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn) 
     255            CALL lbc_lnk_nc_multi( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn) 
    256256            ! 
    257257            DO_3D( 0, 0, 0, 0, 1, jpkm1 ) 
     
    305305         END IF 
    306306         ! 
    307          CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp,  zwz, 'W',  1.0_wp ) 
     307         CALL lbc_lnk_nc_multi( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp,  zwz, 'W',  1.0_wp ) 
    308308         ! 
    309309         !        !==  monotonicity algorithm  ==! 
     
    439439         END_2D 
    440440      END DO 
    441       CALL lbc_lnk_multi( 'traadv_fct', zbetup, 'T', 1.0_wp , zbetdo, 'T', 1.0_wp )   ! lateral boundary cond. (unchanged sign) 
     441      CALL lbc_lnk_nc_multi( 'traadv_fct', zbetup, 'T', 1.0_wp , zbetdo, 'T', 1.0_wp)   ! lateral boundary cond. (unchanged sign) 
    442442 
    443443      ! 3. monotonic flux in the i & j direction (paa & pbb) 
     
    461461         pcc(ji,jj,jk+1) = pcc(ji,jj,jk+1) * ( zc * za + ( 1._wp - zc) * zb ) 
    462462      END_3D 
    463       CALL lbc_lnk_multi( 'traadv_fct', paa, 'U', -1.0_wp , pbb, 'V', -1.0_wp )  ! lateral boundary condition (changed sign) 
     463      CALL lbc_lnk_nc_multi( 'traadv_fct', paa, 'U', -1.0_wp , pbb, 'V', -1.0_wp) ! lateral boundary condition (changed sign) 
    464464      ! 
    465465   END SUBROUTINE nonosc 
Note: See TracChangeset for help on using the changeset viewer.