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 1345 for trunk/NEMO/OPA_SRC/lib_mpp.F90 – NEMO

Ignore:
Timestamp:
2009-03-27T15:49:55+01:00 (15 years ago)
Author:
rblod
Message:

Update diaptr for mpp case, see ticket #361

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/lib_mpp.F90

    r1344 r1345  
    1717   !!             -   !  2008  (R. Benshila) add mpp_ini_ice 
    1818   !!            3.2  !  2009  (R. Benshila) SHMEM suppression, north fold in lbc_nfd 
     19   !!            3.2  !  2009  (O. Marti)    add mpp_ini_znl  
    1920   !!---------------------------------------------------------------------- 
    2021#if   defined key_mpp_mpi   
     
    2728   !!   mpp_lnk_e   : interface (defined in lbclnk) for message passing of 2d array with extra halo (mpp_lnk_2d_e) 
    2829   !!   mpprecv     : 
    29    !!   mppsend     : 
     30   !!   mppsend     :   SUBROUTINE mpp_ini_znl 
    3031   !!   mppscatter  : 
    3132   !!   mppgather   : 
     
    7071   PUBLIC   mpp_lnk_3d, mpp_lnk_3d_gather, mpp_lnk_2d, mpp_lnk_2d_e 
    7172   PUBLIC   mpprecv, mppsend, mppscatter, mppgather 
    72    PUBLIC   mppobc, mpp_ini_ice, mpp_isl 
     73   PUBLIC   mppobc, mpp_ini_ice, mpp_isl, mpp_ini_znl 
    7374#if defined key_oasis3 || defined key_oasis4 
    7475   PUBLIC   mppsize, mpprank 
     
    119120!!gm question : Pourquoi toutes les variables ice sont public??? 
    120121   ! variables used in case of sea-ice 
    121    INTEGER, PUBLIC ::   ngrp_ice        !: group ID for the ice processors (for rheology) 
    122122   INTEGER, PUBLIC ::   ncomm_ice       !: communicator made by the processors with sea-ice 
    123    INTEGER, PUBLIC ::   ndim_rank_ice   !: number of 'ice' processors 
    124    INTEGER, PUBLIC ::   n_ice_root      !: number (in the comm_ice) of proc 0 in the ice comm 
     123   INTEGER ::   ngrp_ice        !  group ID for the ice processors (for rheology) 
     124   INTEGER ::   ndim_rank_ice   !  number of 'ice' processors 
     125   INTEGER ::   n_ice_root      !  number (in the comm_ice) of proc 0 in the ice comm 
    125126   INTEGER, DIMENSION(:), ALLOCATABLE ::   nrank_ice     ! dimension ndim_rank_ice 
     127 
     128   ! variables used for zonal integration 
     129   INTEGER, PUBLIC ::   ncomm_znl       !: communicator made by the processors on the same zonal average 
     130   LOGICAL, PUBLIC ::   l_znl_root      ! True on the 'left'most processor on the same row 
     131   INTEGER ::   ngrp_znl        ! group ID for the znl processors 
     132   INTEGER ::   ndim_rank_znl   ! number of processors on the same zonal average 
     133   INTEGER, DIMENSION(:), ALLOCATABLE ::   nrank_znl  ! dimension ndim_rank_znl, number of the procs into the same znl domain 
    126134    
    127135   ! North fold condition in mpp_mpi with jpni > 1 
    128136   INTEGER ::   ngrp_world        ! group ID for the world processors 
     137   INTEGER ::   ngrp_opa          ! group ID for the opa processors 
    129138   INTEGER ::   ngrp_north        ! group ID for the northern processors (to be fold) 
    130139   INTEGER ::   ncomm_north       ! communicator made by the processors belonging to ngrp_north 
     
    355364            t3we(:,jl,:,1) = ptab(iihom +jl,:,:) 
    356365         END DO 
    357       END SELECT 
     366      END SELECT   
    358367      ! 
    359368      !                           ! Migrations 
     
    12441253 
    12451254 
    1246    SUBROUTINE mppmin_int( ktab ) 
     1255   SUBROUTINE mppmin_int( ktab, kcom ) 
    12471256      !!---------------------------------------------------------------------- 
    12481257      !!                  ***  routine mppmin_int  *** 
     
    12521261      !!---------------------------------------------------------------------- 
    12531262      INTEGER, INTENT(inout) ::   ktab      ! ??? 
    1254       !! 
    1255       INTEGER ::  ierror, iwork 
    1256       !!---------------------------------------------------------------------- 
    1257       ! 
    1258       CALL mpi_allreduce( ktab, iwork, 1, mpi_integer, mpi_min, mpi_comm_opa, ierror ) 
     1263      INTEGER , INTENT( in  ), OPTIONAL        ::   kcom        ! input array 
     1264      !! 
     1265      INTEGER ::  ierror, iwork, localcomm 
     1266      !!---------------------------------------------------------------------- 
     1267      ! 
     1268      localcomm = mpi_comm_opa 
     1269      IF( PRESENT(kcom) )   localcomm = kcom 
     1270      ! 
     1271     CALL mpi_allreduce( ktab, iwork, 1, mpi_integer, mpi_min, localcomm, ierror ) 
    12591272      ! 
    12601273      ktab = iwork 
     
    19831996 
    19841997 
     1998   SUBROUTINE mpp_ini_znl 
     1999      !!---------------------------------------------------------------------- 
     2000      !!               ***  routine mpp_ini_znl  *** 
     2001      !! 
     2002      !! ** Purpose :   Initialize special communicator for computing zonal sum 
     2003      !! 
     2004      !! ** Method  : - Look for processors in the same row 
     2005      !!              - Put their number in nrank_znl 
     2006      !!              - Create group for the znl processors 
     2007      !!              - Create a communicator for znl processors 
     2008      !!              - Determine if processor should write znl files 
     2009      !! 
     2010      !! ** output 
     2011      !!      ndim_rank_znl = number of processors on the same row 
     2012      !!      ngrp_znl = group ID for the znl processors 
     2013      !!      ncomm_znl = communicator for the ice procs. 
     2014      !!      n_znl_root = number (in the world) of proc 0 in the ice comm. 
     2015      !! 
     2016      !!---------------------------------------------------------------------- 
     2017      INTEGER :: ierr 
     2018      INTEGER :: jproc 
     2019      INTEGER :: ii 
     2020      INTEGER, DIMENSION(jpnij) :: kwork 
     2021      ! 
     2022      !-$$     WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - ngrp_world     : ', ngrp_world 
     2023      !-$$     WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - mpi_comm_world : ', mpi_comm_world 
     2024      !-$$     WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - mpi_comm_opa   : ', mpi_comm_opa 
     2025      ! 
     2026      IF ( jpnj == 1 ) THEN 
     2027         ngrp_znl  = ngrp_world 
     2028         ncomm_znl = mpi_comm_opa 
     2029      ELSE 
     2030         ! 
     2031         CALL MPI_ALLGATHER ( njmpp, 1, mpi_integer, kwork, 1, mpi_integer, mpi_comm_opa, ierr ) 
     2032         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - kwork pour njmpp : ', kwork 
     2033         !-$$        CALL flush(numout) 
     2034         ! 
     2035         ! Count number of processors on the same row 
     2036         ndim_rank_znl = 0 
     2037         DO jproc=1,jpnij 
     2038            IF ( kwork(jproc) == njmpp ) THEN 
     2039               ndim_rank_znl = ndim_rank_znl + 1 
     2040            ENDIF 
     2041         END DO 
     2042         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - ndim_rank_znl : ', ndim_rank_znl 
     2043         !-$$        CALL flush(numout) 
     2044         ! Allocate the right size to nrank_znl 
     2045#if ! defined key_agrif 
     2046         IF (ALLOCATED(nrank_znl)) DEALLOCATE(nrank_znl) 
     2047#else 
     2048         DEALLOCATE(nrank_znl) 
     2049#endif 
     2050         ALLOCATE(nrank_znl(ndim_rank_znl)) 
     2051         ii = 0      
     2052         nrank_znl (:) = 0 
     2053         DO jproc=1,jpnij 
     2054            IF ( kwork(jproc) == njmpp) THEN 
     2055               ii = ii + 1 
     2056               nrank_znl(ii) = jproc -1  
     2057            ENDIF 
     2058         END DO 
     2059         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - nrank_znl : ', nrank_znl 
     2060         !-$$        CALL flush(numout) 
     2061 
     2062         ! Create the opa group 
     2063         CALL MPI_COMM_GROUP(mpi_comm_opa,ngrp_opa,ierr) 
     2064         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - ngrp_opa : ', ngrp_opa 
     2065         !-$$        CALL flush(numout) 
     2066 
     2067         ! Create the znl group from the opa group 
     2068         CALL MPI_GROUP_INCL  ( ngrp_opa, ndim_rank_znl, nrank_znl, ngrp_znl, ierr ) 
     2069         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - ngrp_znl ', ngrp_znl 
     2070         !-$$        CALL flush(numout) 
     2071 
     2072         ! Create the znl communicator from the opa communicator, ie the pool of procs in the same row 
     2073         CALL MPI_COMM_CREATE ( mpi_comm_opa, ngrp_znl, ncomm_znl, ierr ) 
     2074         !-$$        WRITE (numout,*) 'mpp_ini_znl ', nproc, ' - ncomm_znl ', ncomm_znl 
     2075         !-$$        CALL flush(numout) 
     2076         ! 
     2077      END IF 
     2078 
     2079      ! Determines if processor if the first (starting from i=1) on the row 
     2080      IF ( jpni == 1 ) THEN  
     2081         l_znl_root = .TRUE. 
     2082      ELSE 
     2083         l_znl_root = .FALSE. 
     2084         kwork (1) = nimpp 
     2085         CALL mpp_min ( kwork(1), kcom = ncomm_znl) 
     2086         IF ( nimpp == kwork(1)) l_znl_root = .TRUE. 
     2087      END IF 
     2088 
     2089   END SUBROUTINE mpp_ini_znl 
     2090 
     2091 
    19852092   SUBROUTINE mpp_ini_north 
    19862093      !!---------------------------------------------------------------------- 
     
    24932600   END SUBROUTINE mpp_ini_ice 
    24942601 
     2602   SUBROUTINE mpp_ini_znl 
     2603      INTEGER :: kcom 
     2604      WRITE(*,*) 'mpp_ini_znl: You should not have seen this print! error?' 
     2605   END SUBROUTINE mpp_ini_znl 
     2606 
    24952607   SUBROUTINE mpp_comm_free( kcom ) 
    24962608      INTEGER :: kcom 
Note: See TracChangeset for help on using the changeset viewer.