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

Ignore:
Timestamp:
2005-09-22T13:07:01+02:00 (19 years ago)
Author:
opalod
Message:

nemo_v1_update_013 : CT : replace cpp keys key_mpi_isend, key_mpi_bsend by a character parameter in the ocean namelist

File:
1 edited

Legend:

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

    r247 r300  
    8181   !! * Share module variables 
    8282   LOGICAL, PUBLIC, PARAMETER ::   lk_mpp = .TRUE.       !: mpp flag 
    83    LOGICAL, PUBLIC ::   lk_bsend = .FALSE.       !: mpp_bsend flag 
    84    LOGICAL, PUBLIC ::   lk_isend = .FALSE.       !: mpp_isend flag 
    8583 
    8684 
     
    112110   INTEGER, DIMENSION(:), ALLOCATABLE ::   & 
    113111      nrank_north          ! dimension ndim_rank_north, number of the procs belonging to ncomm_north 
     112   CHARACTER (len=1) ::  & 
     113      c_mpi_send = 'S'     ! type od mpi send/recieve (S=standard, B=bsend, I=isend) 
     114   LOGICAL  ::           & 
     115      l_isend = .FALSE.    ! isend use indicator (T if c_mpi_send='I') 
    114116 
    115117 
     
    260262      !! * Local variables   (MPI version) 
    261263      INTEGER ::   mynode, ierr 
    262       !!---------------------------------------------------------------------- 
    263       ! Enroll in MPI 
    264       ! ------------- 
    265 #  if defined key_mpi_bsend 
    266       lk_bsend = .TRUE.       !: mpp_bsend flag 
    267 #  endif 
    268 #  if defined key_mpi_isend 
    269       lk_isend = .TRUE.       !: mpp_isend flag 
    270 #  endif 
    271  
    272       IF(lk_bsend) THEN 
     264      NAMELIST/nam_mpp/ c_mpi_send 
     265      !!---------------------------------------------------------------------- 
     266 
     267      WRITE(numout,*) 
     268      WRITE(numout,*) 'mynode : mpi initialisation' 
     269      WRITE(numout,*) '~~~~~~ ' 
     270      WRITE(numout,*) 
     271 
     272      ! Namelist namrun : parameters of the run 
     273      REWIND( numnam ) 
     274      READ  ( numnam, nam_mpp ) 
     275 
     276      WRITE(numout,*) '        Namelist nam_mpp' 
     277      WRITE(numout,*) '           mpi send type            c_mpi_send = ', c_mpi_send 
     278 
     279      SELECT CASE ( c_mpi_send ) 
     280      CASE ( 'S' )                ! Standard mpi send (blocking) 
     281         WRITE(numout,*) '           Standard blocking mpi send (send)' 
     282         CALL mpi_init( ierr ) 
     283      CASE ( 'B' )                ! Buffer mpi send (blocking) 
     284         WRITE(numout,*) '           Buffer blocking mpi send (bsend)' 
    273285         CALL mpi_init_opa( ierr ) 
    274       ELSE 
     286      CASE ( 'I' )                ! Immediate mpi send (non-blocking send) 
     287         WRITE(numout,*) '           Immediate non-blocking send (isend)' 
     288         l_isend = .TRUE. 
    275289         CALL mpi_init( ierr ) 
    276       ENDIF 
     290      CASE DEFAULT 
     291         WRITE(numout,cform_err) 
     292         WRITE(numout,*) '           bad value for c_mpi_send = ', c_mpi_send 
     293         nstop = nstop + 1 
     294      END SELECT 
     295 
    277296      CALL mpi_comm_rank( mpi_comm_world, rank, ierr ) 
    278297      CALL mpi_comm_size( mpi_comm_world, size, ierr ) 
     
    606625         CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 ) 
    607626         CALL mpprecv( 1, t3ew(1,1,1,2), imigr ) 
    608          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     627         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    609628      CASE ( 0 ) 
    610629         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 ) 
     
    612631         CALL mpprecv( 1, t3ew(1,1,1,2), imigr ) 
    613632         CALL mpprecv( 2, t3we(1,1,1,2), imigr ) 
    614          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    615          IF(lk_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err) 
     633         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     634         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err) 
    616635      CASE ( 1 ) 
    617636         CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 ) 
    618637         CALL mpprecv( 2, t3we(1,1,1,2), imigr ) 
    619          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     638         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    620639      END SELECT 
    621640#endif 
     
    684703         CALL mppsend( 4, t3sn(1,1,1,1), imigr, nono, ml_req1 ) 
    685704         CALL mpprecv( 3, t3ns(1,1,1,2), imigr ) 
    686          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     705         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    687706      CASE ( 0 ) 
    688707         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 ) 
     
    690709         CALL mpprecv( 3, t3ns(1,1,1,2), imigr ) 
    691710         CALL mpprecv( 4, t3sn(1,1,1,2), imigr ) 
    692          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    693          IF(lk_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err) 
     711         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     712         IF(l_isend) CALL mpi_wait(ml_req2, ml_stat, ml_err) 
    694713      CASE ( 1 )  
    695714         CALL mppsend( 3, t3ns(1,1,1,1), imigr, noso, ml_req1 ) 
    696715         CALL mpprecv( 4, t3sn(1,1,1,2), imigr ) 
    697          IF(lk_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
     716         IF(l_isend) CALL mpi_wait(ml_req1, ml_stat, ml_err) 
    698717      END SELECT 
    699718 
     
    885904            CALL mppsend( 2, t3we(1,1,1,1), imigr, noea, ml_req1 ) 
    886905            CALL mpprecv( 1, t3ew(1,1,1,2), imigr ) 
    887             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     906            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    888907         CASE ( 0 ) 
    889908            CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 ) 
     
    891910            CALL mpprecv( 1, t3ew(1,1,1,2), imigr ) 
    892911            CALL mpprecv( 2, t3we(1,1,1,2), imigr ) 
    893             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    894             IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     912            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     913            IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    895914         CASE ( 1 ) 
    896915            CALL mppsend( 1, t3ew(1,1,1,1), imigr, nowe, ml_req1 ) 
    897916            CALL mpprecv( 2, t3we(1,1,1,2), imigr ) 
    898             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     917            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    899918         END SELECT 
    900919#endif 
     
    10411060         CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 ) 
    10421061         CALL mpprecv( 1, t2ew(1,1,2), imigr ) 
    1043          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1062         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    10441063      CASE ( 0 ) 
    10451064         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 ) 
     
    10471066         CALL mpprecv( 1, t2ew(1,1,2), imigr ) 
    10481067         CALL mpprecv( 2, t2we(1,1,2), imigr ) 
    1049          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    1050          IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     1068         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1069         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    10511070      CASE ( 1 ) 
    10521071         CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 ) 
    10531072         CALL mpprecv( 2, t2we(1,1,2), imigr ) 
    1054          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1073         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    10551074      END SELECT 
    10561075 
     
    11181137         CALL mppsend( 4, t2sn(1,1,1), imigr, nono, ml_req1 ) 
    11191138         CALL mpprecv( 3, t2ns(1,1,2), imigr ) 
    1120          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1139         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    11211140      CASE ( 0 ) 
    11221141         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 ) 
     
    11241143         CALL mpprecv( 3, t2ns(1,1,2), imigr ) 
    11251144         CALL mpprecv( 4, t2sn(1,1,2), imigr ) 
    1126          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    1127          IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     1145         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1146         IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    11281147      CASE ( 1 ) 
    11291148         CALL mppsend( 3, t2ns(1,1,1), imigr, noso, ml_req1 ) 
    11301149         CALL mpprecv( 4, t2sn(1,1,2), imigr ) 
    1131          IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1150         IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    11321151      END SELECT 
    11331152   
     
    13171336            CALL mppsend( 2, t2we(1,1,1), imigr, noea, ml_req1 ) 
    13181337            CALL mpprecv( 1, t2ew(1,1,2), imigr ) 
    1319             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1338            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    13201339         CASE ( 0 ) 
    13211340            CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 ) 
     
    13231342            CALL mpprecv( 1, t2ew(1,1,2), imigr ) 
    13241343            CALL mpprecv( 2, t2we(1,1,2), imigr ) 
    1325             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    1326             IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     1344            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1345            IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    13271346         CASE ( 1 ) 
    13281347            CALL mppsend( 1, t2ew(1,1,1), imigr, nowe, ml_req1 ) 
    13291348            CALL mpprecv( 2, t2we(1,1,2), imigr ) 
    1330             IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1349            IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    13311350         END SELECT  
    13321351#endif 
     
    14241443       CALL mppsend(3,t2p1(1,1,1),imigr,nono, ml_req1) 
    14251444       CALL mpprecv(3,t2p1(1,1,2),imigr) 
    1426        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1445       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    14271446 
    14281447#endif       
     
    14531472       CALL mppsend(3,t2p1(1,1,1),imigr,nono, ml_req1) 
    14541473       CALL mpprecv(3,t2p1(1,1,2),imigr) 
    1455        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1474       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    14561475 
    14571476#endif       
     
    15161535       CALL mppsend(2,t2we(1,1,1),imigr,noea, ml_req1) 
    15171536       CALL mpprecv(1,t2ew(1,1,2),imigr) 
    1518        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1537       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    15191538    CASE ( 0 ) 
    15201539       CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1) 
     
    15221541       CALL mpprecv(1,t2ew(1,1,2),imigr) 
    15231542       CALL mpprecv(2,t2we(1,1,2),imigr) 
    1524        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    1525        IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     1543       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1544       IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    15261545 
    15271546    CASE ( 1 ) 
    15281547       CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1) 
    15291548       CALL mpprecv(2,t2we(1,1,2),imigr) 
    1530        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1549       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    15311550 
    15321551    END SELECT 
     
    16091628       CALL mppsend(4,t2sn(1,1,1),imigr,nono, ml_req1) 
    16101629       CALL mpprecv(3,t2ns(1,1,2),imigr) 
    1611        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1630       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    16121631 
    16131632    CASE ( 0 ) 
     
    16161635       CALL mpprecv(3,t2ns(1,1,2),imigr) 
    16171636       CALL mpprecv(4,t2sn(1,1,2),imigr) 
    1618        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    1619        IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     1637       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1638       IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    16201639 
    16211640    CASE ( 1 ) 
    16221641       CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1) 
    16231642       CALL mpprecv(4,t2sn(1,1,2),imigr) 
    1624        IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     1643       IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    16251644    END SELECT 
    16261645 
     
    16751694      INTEGER ::   iflag 
    16761695 
    1677      IF(lk_bsend) THEN 
    1678        CALL mpi_bsend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
    1679          &                          mpi_comm_world, iflag ) 
    1680      ELSEIF (lk_isend) THEN 
    1681 ! Carefull here : one more argument for mpi_isend : the mpi request identifier.. 
    1682        CALL mpi_isend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
    1683          &                          mpi_comm_world, md_req, iflag ) 
    1684      ELSE 
    1685        CALL mpi_send( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
    1686          &                          mpi_comm_world, iflag ) 
    1687      ENDIF 
     1696      SELECT CASE ( c_mpi_send ) 
     1697      CASE ( 'S' )                ! Standard mpi send (blocking) 
     1698         CALL mpi_send ( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
     1699            &                          mpi_comm_world, iflag ) 
     1700      CASE ( 'B' )                ! Buffer mpi send (blocking) 
     1701         CALL mpi_bsend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
     1702            &                          mpi_comm_world, iflag ) 
     1703      CASE ( 'I' )                ! Immediate mpi send (non-blocking send) 
     1704         ! Be carefull, one more argument here : the mpi request identifier.. 
     1705         CALL mpi_isend( pmess, kbytes, mpi_double_precision, kdest, ktyp,   & 
     1706            &                          mpi_comm_world, md_req, iflag ) 
     1707      END SELECT 
    16881708#endif 
    16891709 
     
    29342954          CALL mppsend(2,t2we(1,1,1),imigr,noea, ml_req1) 
    29352955          CALL mpprecv(1,t2ew(1,1,2),imigr) 
    2936           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     2956          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    29372957       ELSEIF( nbondi == 0 ) THEN 
    29382958          CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1) 
     
    29402960          CALL mpprecv(1,t2ew(1,1,2),imigr) 
    29412961          CALL mpprecv(2,t2we(1,1,2),imigr) 
    2942           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    2943           IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     2962          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     2963          IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    29442964       ELSEIF( nbondi == 1 ) THEN 
    29452965          CALL mppsend(1,t2ew(1,1,1),imigr,nowe, ml_req1) 
    29462966          CALL mpprecv(2,t2we(1,1,2),imigr) 
    2947           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     2967          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    29482968       ENDIF 
    29492969#endif 
     
    30053025          CALL mppsend(4,t2sn(1,1,1),imigr,nono, ml_req1) 
    30063026          CALL mpprecv(3,t2ns(1,1,2),imigr) 
    3007           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     3027          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    30083028       ELSEIF( nbondj == 0 ) THEN 
    30093029          CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1) 
     
    30113031          CALL mpprecv(3,t2ns(1,1,2),imigr) 
    30123032          CALL mpprecv(4,t2sn(1,1,2),imigr) 
    3013           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    3014           IF(lk_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
     3033          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     3034          IF(l_isend) CALL mpi_wait(ml_req2,ml_stat,ml_err) 
    30153035       ELSEIF( nbondj == 1 ) THEN 
    30163036          CALL mppsend(3,t2ns(1,1,1),imigr,noso, ml_req1) 
    30173037          CALL mpprecv(4,t2sn(1,1,2),imigr) 
    3018           IF(lk_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
     3038          IF(l_isend) CALL mpi_wait(ml_req1,ml_stat,ml_err) 
    30193039       ENDIF 
    30203040 
Note: See TracChangeset for help on using the changeset viewer.