Ignore:
Timestamp:
Jun 30, 2023, 8:18:43 PM (18 months ago)
Author:
yann meurdesoif
Message:

Suppress CPP_MPI key usage in source code. MPI wrappers is used to supress missing symbol if the mpi library is not linked

YM

Location:
LMDZ6/trunk/libf/dyn3dmem
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/dyn3dmem/abort_gcm.F

    r4593 r4600  
    4747      else
    4848        write(lunout,*) 'Houston, we have a problem, ierr = ', ierr
    49 #ifdef CPP_MPI
     49
     50        if (using_mpi) THEN
    5051C$OMP CRITICAL (MPI_ABORT_GCM)
    51         call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi)
     52          call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi)
    5253C$OMP END CRITICAL (MPI_ABORT_GCM)
    53 #else
    54         stop 1
    55 #endif         
     54        else
     55         stop 1
     56        endif         
     57     
    5658      endif
    5759      END
  • LMDZ6/trunk/libf/dyn3dmem/mod_const_mpi.F90

    r4146 r4600  
    1111
    1212  SUBROUTINE Init_const_mpi
     13    USE lmdz_mpi
     14
    1315#ifdef CPP_IOIPSL
    1416    USE IOIPSL, ONLY: getin
     
    2527#endif
    2628    IMPLICIT NONE
    27 #ifdef CPP_MPI
    28     INCLUDE 'mpif.h'
    29 #endif
    3029
    3130    INTEGER             :: ierr
     
    5251!$OMP END MASTER
    5352#endif
    54 #ifdef CPP_MPI
    5553      MPI_REAL_LMDZ=MPI_REAL8
    56 #endif
    5754    ELSE
    5855      CALL init_mpi
     
    6259 
    6360  SUBROUTINE Init_mpi
     61    USE lmdz_mpi
     62
    6463#ifdef CPP_XIOS
    6564    USE wxios, only: wxios_init
    6665#endif
    6766  IMPLICIT NONE
    68 #ifdef CPP_MPI
    69      INCLUDE 'mpif.h'
    70 #endif
    7167    INTEGER             :: ierr
    7268    INTEGER             :: thread_required
    7369    INTEGER             :: thread_provided
    7470
    75 #ifdef CPP_MPI
    7671!$OMP MASTER
    7772      thread_required=MPI_THREAD_SERIALIZED
     
    9287#endif
    9388!$OMP END MASTER
    94 #else
    95 #ifdef CPP_XIOS
    96 !$OMP MASTER
    97       CALL wxios_init("LMDZ")
    98 !$OMP END MASTER
    99 #endif
    100 #endif
    10189
    102    END SUBROUTINE Init_mpi
     90END SUBROUTINE Init_mpi
    10391   
    10492END MODULE mod_const_mpi
  • LMDZ6/trunk/libf/dyn3dmem/mod_hallo.F90

    r4469 r4600  
    106106 
    107107  SUBROUTINE create_global_mpi_buffer
     108  USE lmdz_mpi
    108109  IMPLICIT NONE
    109 #ifdef CPP_MPI
    110   INCLUDE 'mpif.h'
    111 #endif 
    112110    POINTER (Pbuffer,MPI_Buffer(MaxBufferSize))
    113111    REAL :: MPI_Buffer
    114 #ifdef CPP_MPI
    115112    INTEGER(KIND=MPI_ADDRESS_KIND) :: BS
    116 #else
    117     INTEGER(KIND=8) :: BS
    118 #endif
    119113    INTEGER :: i,ierr
    120114
     
    122116      Bs=8*MaxBufferSize
    123117!$OMP CRITICAL (MPI)
    124 #ifdef CPP_MPI
    125118      CALL MPI_ALLOC_MEM(BS,MPI_INFO_NULL,Pbuffer,ierr)
    126 #endif
    127119!$OMP END CRITICAL (MPI)
    128120      DO i=1,MaxBufferSize
     
    11571149  subroutine Register_Hallo(Field,ij,ll,RUp,Rdown,SUp,SDown,a_request)
    11581150  USE dimensions_mod
     1151  USE lmdz_mpi
    11591152      implicit none
    11601153
    1161 #ifdef CPP_MPI
    1162     include 'mpif.h'
    1163 #endif   
    11641154      INTEGER :: ij,ll
    11651155      REAL, dimension(ij,ll) :: Field
     
    12241214  subroutine Register_Hallo_u(Field,ll,RUp,Rdown,SUp,SDown,a_request)
    12251215  USE dimensions_mod
     1216  USE lmdz_mpi
    12261217      implicit none
    1227 #ifdef CPP_MPI
    1228     include 'mpif.h'
    1229 #endif   
    12301218      INTEGER :: ll
    12311219      REAL, dimension(ijb_u:ije_u,ll) :: Field
     
    12891277  subroutine Register_Hallo_v(Field,ll,RUp,Rdown,SUp,SDown,a_request)
    12901278  USE dimensions_mod
     1279  USE lmdz_mpi
    12911280      implicit none
    1292 #ifdef CPP_MPI
    1293     include 'mpif.h'
    1294 #endif   
    12951281      INTEGER :: ll
    12961282      REAL, dimension(ijb_v:ije_v,ll) :: Field
     
    13541340    subroutine SendRequest(a_Request)
    13551341    USE dimensions_mod
     1342    USE lmdz_mpi
    13561343      implicit none
    1357 
    1358 #ifdef CPP_MPI
    1359       include 'mpif.h'
    1360 #endif
    13611344
    13621345      type(request),target :: a_request
     
    14101393!$OMP CRITICAL (MPI)
    14111394         
    1412 #ifdef CPP_MPI
    14131395         call MPI_ISEND(Buffer(req%Pos),SizeBuffer,MPI_REAL_LMDZ,rank,a_request%tag+1000*omp_rank,     &
    14141396                         COMM_LMDZ,Req%MSG_Request,ierr)
    1415 #endif
    14161397         IF (.NOT.using_mpi) THEN
    14171398           PRINT *,'Erreur, echange MPI en mode sequentiel !!!'
     
    14531434!$OMP CRITICAL (MPI)
    14541435
    1455 #ifdef CPP_MPI
    14561436             call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL_LMDZ,rank,a_request%tag+1000*omp_rank,     &
    14571437                           COMM_LMDZ,Req%MSG_Request,ierr)
    1458 #endif             
     1438
    14591439             IF (.NOT.using_mpi) THEN
    14601440               PRINT *,'Erreur, echange MPI en mode sequentiel !!!'
     
    14781458   subroutine WaitRequest(a_Request)
    14791459   USE dimensions_mod
     1460   USE lmdz_mpi
    14801461   implicit none
    1481    
    1482 #ifdef CPP_MPI
    1483       include 'mpif.h'   
    1484 #endif
    14851462     
    14861463      type(request),target :: a_request
     
    14881465      type(Hallo),pointer :: PtrHallo
    14891466      integer, dimension(2*mpi_size) :: TabRequest
    1490 #ifdef CPP_MPI
    14911467      integer, dimension(MPI_STATUS_SIZE,2*mpi_size) :: TabStatus
    1492 #else
    1493       integer, dimension(1,2*mpi_size) :: TabStatus
    1494 #endif
    14951468      integer :: NbRequest
    14961469      integer :: i,rank,pos,ij,l,ierr
     
    15211494!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente"
    15221495!        PRINT *,"No des requetes :",TabRequest(1:NbRequest)
    1523 #ifdef CPP_MPI
    15241496        call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr)
    1525 #endif
    15261497!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete"
    15271498!        PRINT *,"-------------------------------------------------------------------"
     
    15711542     
    15721543   subroutine WaitSendRequest(a_Request)
     1544   USE lmdz_mpi
    15731545   USE dimensions_mod
    15741546   implicit none
    15751547   
    1576 #ifdef CPP_MPI
    1577       include 'mpif.h'   
    1578 #endif     
    15791548      type(request),target :: a_request
    15801549      type(request_SR),pointer :: Req
    15811550      type(Hallo),pointer :: PtrHallo
    15821551      integer, dimension(mpi_size) :: TabRequest
    1583 #ifdef CPP_MPI
    15841552      integer, dimension(MPI_STATUS_SIZE,mpi_size) :: TabStatus
    1585 #else
    1586       integer, dimension(1,mpi_size) :: TabStatus
    1587 #endif
    15881553      integer :: NbRequest
    15891554      integer :: i,rank,pos,ij,l,ierr
     
    16061571!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente"
    16071572!        PRINT *,"No des requetes :",TabRequest(1:NbRequest)
    1608 #ifdef CPP_MPI
    1609         call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr)
    1610 #endif
     1573         call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr)
    16111574!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete"
    16121575!        PRINT *,"-------------------------------------------------------------------"
     
    16281591   subroutine WaitRecvRequest(a_Request)
    16291592   USE dimensions_mod
     1593   USE lmdz_mpi
    16301594   implicit none
    1631    
    1632 #ifdef CPP_MPI
    1633       include 'mpif.h'   
    1634 #endif
    1635      
    16361595      type(request),target :: a_request
    16371596      type(request_SR),pointer :: Req
    16381597      type(Hallo),pointer :: PtrHallo
    16391598      integer, dimension(mpi_size) :: TabRequest
    1640 #ifdef CPP_MPI
    16411599      integer, dimension(MPI_STATUS_SIZE,mpi_size) :: TabStatus
    1642 #else
    1643       integer, dimension(1,mpi_size) :: TabStatus
    1644 #endif
    16451600      integer :: NbRequest
    16461601      integer :: i,rank,pos,ij,l,ierr
     
    16641619!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente"
    16651620!        PRINT *,"No des requetes :",TabRequest(1:NbRequest)
    1666 #ifdef CPP_MPI
    1667         call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr)
    1668 #endif
     1621         call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr)
    16691622!        PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete"
    16701623!        PRINT *,"-------------------------------------------------------------------"
  • LMDZ6/trunk/libf/dyn3dmem/parallel_lmdz.F90

    r4593 r4600  
    44  MODULE parallel_lmdz
    55  USE mod_const_mpi
     6  USE lmdz_mpi, ONLY : using_mpi
    67#ifdef CPP_IOIPSL
    78      use IOIPSL
     
    1213    INTEGER,PARAMETER :: halo_max=3
    1314   
    14     LOGICAL,SAVE :: using_mpi ! .true. if using MPI
    1515    LOGICAL,SAVE :: using_omp ! .true. if using OpenMP
    1616    LOGICAL,SAVE :: is_master ! .true. if the core is both MPI & OpenMP master
     
    8888    subroutine init_parallel
    8989    USE vampir
     90    USE lmdz_mpi
    9091    implicit none
    91 #ifdef CPP_MPI
    92       include 'mpif.h'
    93 #endif
    9492      INCLUDE "dimensions.h"
    9593      INCLUDE "paramet.h"
     
    111109#endif 
    112110
    113 #ifdef CPP_MPI
    114        using_mpi=.TRUE.
    115 #else
    116        using_mpi=.FALSE.
    117 #endif
    118      
    119 
    120111#ifdef CPP_OMP
    121112       using_OMP=.TRUE.
     
    127118     
    128119      IF (using_mpi) THEN
    129 #ifdef CPP_MPI
    130120        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
    131121        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
    132 #endif
    133122      ELSE
    134123        mpi_size=1
     
    161150         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
    162151         
    163 #ifdef CPP_MPI
    164152          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
    165 #endif         
     153
    166154        endif
    167155       
     
    395383   
    396384    subroutine Finalize_parallel
     385    USE lmdz_mpi
    397386#ifdef CPP_XIOS
    398387    ! ug Pour les sorties XIOS
     
    418407      include "dimensions.h"
    419408      include "paramet.h"
    420 #ifdef CPP_MPI
    421       include 'mpif.h'
    422 #endif     
    423409
    424410      integer :: ierr
     
    446432      CALL wxios_close()
    447433#endif
    448 #ifdef CPP_MPI
    449          IF (using_mpi) call MPI_FINALIZE(ierr)
    450 #endif
     434      IF (using_mpi) call MPI_FINALIZE(ierr)
    451435      end if
    452436     
     
    502486   
    503487    SUBROUTINE barrier
     488    USE lmdz_mpi
    504489    IMPLICIT NONE
    505 #ifdef CPP_MPI
    506     INCLUDE 'mpif.h'
    507 #endif
    508490    INTEGER :: ierr
    509491   
    510492!$OMP CRITICAL (MPI)     
    511 #ifdef CPP_MPI
    512493      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
    513 #endif
    514494!$OMP END CRITICAL (MPI)
    515495   
     
    518498     
    519499    subroutine exchange_hallo(Field,ij,ll,up,down)
     500    USE lmdz_mpi
    520501    USE Vampir
    521502    implicit none
    522503      INCLUDE "dimensions.h"
    523504      INCLUDE "paramet.h"   
    524 #ifdef CPP_MPI
    525     include 'mpif.h'
    526 #endif   
    527505      INTEGER :: ij,ll
    528506      REAL, dimension(ij,ll) :: Field
     
    533511      LOGICAL :: RecvUp,RecvDown
    534512      INTEGER, DIMENSION(4) :: Request
    535 #ifdef CPP_MPI
    536513      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
    537 #else
    538       INTEGER, DIMENSION(1,4) :: Status
    539 #endif
     514
    540515      INTEGER :: NbRequest
    541516      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
     
    582557          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
    583558!$OMP CRITICAL (MPI)
    584 #ifdef CPP_MPI
    585559          call MPI_ISEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
    586560                          COMM_LMDZ,Request(NbRequest),ierr)
    587 #endif
    588561!$OMP END CRITICAL (MPI)
    589562        ENDIF
     
    597570       
    598571!$OMP CRITICAL (MPI)
    599 #ifdef CPP_MPI
    600572          call MPI_ISEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
    601573                          COMM_LMDZ,Request(NbRequest),ierr)
    602 #endif
    603574!$OMP END CRITICAL (MPI)
    604575        ENDIF
     
    611582             
    612583!$OMP CRITICAL (MPI)
    613 #ifdef CPP_MPI
    614584          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
    615585                          COMM_LMDZ,Request(NbRequest),ierr)
    616 #endif
    617586!$OMP END CRITICAL (MPI)
    618587     
     
    626595       
    627596!$OMP CRITICAL (MPI)
    628 #ifdef CPP_MPI
    629597          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
    630598                          COMM_LMDZ,Request(NbRequest),ierr)
    631 #endif
    632599!$OMP END CRITICAL (MPI)
    633600       
    634601        ENDIF
    635602 
    636 #ifdef CPP_MPI
    637603        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
    638 #endif
    639604        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
    640605        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down) 
     
    651616
    652617    subroutine Gather_Field(Field,ij,ll,rank)
     618    USE lmdz_mpi
    653619    implicit none
    654620    INCLUDE "dimensions.h"
    655621    INCLUDE "paramet.h"
    656622    INCLUDE "iniprint.h"
    657 #ifdef CPP_MPI
    658     include 'mpif.h'
    659 #endif   
    660623      INTEGER :: ij,ll,rank
    661624      REAL, dimension(ij,ll) :: Field
     
    709672 
    710673!$OMP CRITICAL (MPI)
    711 #ifdef CPP_MPI
    712674        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
    713675                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
    714 #endif
    715676!$OMP END CRITICAL (MPI)
    716677     
     
    735696
    736697    subroutine AllGather_Field(Field,ij,ll)
     698    USE lmdz_mpi
    737699    implicit none
    738700    INCLUDE "dimensions.h"
    739701    INCLUDE "paramet.h"   
    740 #ifdef CPP_MPI
    741     include 'mpif.h'
    742 #endif   
    743702      INTEGER :: ij,ll
    744703      REAL, dimension(ij,ll) :: Field
     
    748707        call Gather_Field(Field,ij,ll,0)
    749708!$OMP CRITICAL (MPI)
    750 #ifdef CPP_MPI
    751709      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
    752 #endif
    753710!$OMP END CRITICAL (MPI)
    754711      ENDIF
     
    757714   
    758715   subroutine Broadcast_Field(Field,ij,ll,rank)
     716    USE lmdz_mpi
    759717    implicit none
    760718    INCLUDE "dimensions.h"
    761719    INCLUDE "paramet.h"   
    762 #ifdef CPP_MPI
    763     include 'mpif.h'
    764 #endif   
    765720      INTEGER :: ij,ll
    766721      REAL, dimension(ij,ll) :: Field
     
    771726     
    772727!$OMP CRITICAL (MPI)
    773 #ifdef CPP_MPI
    774728      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
    775 #endif
    776729!$OMP END CRITICAL (MPI)
    777730     
     
    781734   
    782735!  Subroutine verif_hallo(Field,ij,ll,up,down)
     736!    USE lmdz_mpi
    783737!    implicit none
    784738!      INCLUDE "dimensions.h"
    785739!      INCLUDE "paramet.h"   
    786 !    include 'mpif.h'
    787740!   
    788741!      INTEGER :: ij,ll
  • LMDZ6/trunk/libf/dyn3dmem/times.F90

    r4593 r4600  
    137137  subroutine allgather_timer
    138138    USE parallel_lmdz
    139     implicit none
    140 #ifdef CPP_MPI   
    141     include 'mpif.h'
    142 #endif
     139    USE lmdz_mpi
     140    implicit none
     141
    143142    integer :: ierr
    144143    integer :: data_size
     
    155154   
    156155      tmp_table(:,:)=timer_table(:,:,mpi_rank)
    157 #ifdef CPP_MPI
    158156      call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_table(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr)
    159 #endif
    160157      tmp_table(:,:)=timer_table_sqr(:,:,mpi_rank)
    161 #ifdef CPP_MPI
    162158      call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_table_sqr(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr)
    163 #endif   
    164159      deallocate(tmp_table)
    165160   
     
    172167  subroutine allgather_timer_average
    173168    USE parallel_lmdz
    174     implicit none
    175 #ifdef CPP_MPI
    176     include 'mpif.h'
    177 #endif
     169    USE lmdz_mpi
     170    implicit none
    178171    integer :: ierr
    179172    integer :: data_size
     
    192185
    193186      tmp_table(:,:)=timer_average(:,:,mpi_rank)
    194 #ifdef CPP_MPI
    195187      call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_average(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr)
    196 #endif
    197188      tmp_table(:,:)=timer_delta(:,:,mpi_rank)
    198 #ifdef CPP_MPI
    199189      call mpi_allgather(tmp_table(1,1),data_size,MPI_REAL_LMDZ,timer_delta(1,1,0),data_size,MPI_REAL_LMDZ,COMM_LMDZ,ierr)
    200 #endif
    201190      tmp_iter(:,:)=timer_iteration(:,:,mpi_rank)
    202 #ifdef CPP_MPI
    203191      call mpi_allgather(tmp_iter(1,1),data_size,MPI_INTEGER,timer_iteration(1,1,0),data_size,MPI_INTEGER,COMM_LMDZ,ierr)
    204 #endif   
    205192      deallocate(tmp_table)
    206193   
Note: See TracChangeset for help on using the changeset viewer.