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 for NEMO/branches/2020/dev_r13296_HPC-07_mocavero_mpi3/src/OCE/LBC/lib_mpp.F90 – NEMO

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

Add neighborhood collectives lbc routines - ticket #2496

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.