source: LMDZ5/trunk/libf/dyn3dpar/mod_const_mpi.F90 @ 5456

Last change on this file since 5456 was 2055, checked in by acaubel, 11 years ago

Modifications in order to run forced configuration with coupled executable
i.e replaced the use of cpp key CPP_PARA by the use of type_ocean flag.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
RevLine 
[1279]1!
2! $Id: mod_const_mpi.F90 2055 2014-06-04 12:33:27Z aborella $
3!
[774]4MODULE mod_const_mpi
[1897]5  IMPLICIT NONE
[985]6  INTEGER,SAVE :: COMM_LMDZ
7  INTEGER,SAVE :: MPI_REAL_LMDZ
[774]8 
9
10CONTAINS
11
12  SUBROUTINE Init_const_mpi
[1279]13#ifdef CPP_IOIPSL
[1897]14    USE IOIPSL, ONLY: getin
[1279]15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
[1897]17    USE ioipsl_getincom, only: getin
[1279]18#endif
[1965]19! Use of Oasis-MCT coupler
20#ifdef CPP_OMCT
21    USE mod_prism
22#endif
[2054]23#ifdef CPP_XIOS
24    USE wxios, only: wxios_init
25#endif
[884]26    IMPLICIT NONE
[1000]27#ifdef CPP_MPI
[774]28    INCLUDE 'mpif.h'
[1000]29#endif
[1897]30
[884]31    INTEGER             :: ierr
32    INTEGER             :: comp_id
[985]33    INTEGER             :: thread_required
34    INTEGER             :: thread_provided
[1008]35    CHARACTER(len = 6)  :: type_ocean
[884]36
37!$OMP MASTER
[1008]38    type_ocean = 'force '
39    CALL getin('type_ocean', type_ocean)
[985]40!$OMP END MASTER
41!$OMP BARRIER
[884]42
[1008]43    IF (type_ocean=='couple') THEN
[806]44#ifdef CPP_COUPLE
[985]45!$OMP MASTER
[2054]46#ifdef CPP_XIOS
[2055]47      CALL wxios_init("LMDZ", outcom=COMM_LMDZ, type_ocean=type_ocean)
[2054]48#else
49       CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr)
[884]50       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
[2054]51#endif
[985]52!$OMP END MASTER
[1014]53#endif
[1000]54#ifdef CPP_MPI
55      MPI_REAL_LMDZ=MPI_REAL8
[806]56#endif
[884]57    ELSE
[1000]58      CALL init_mpi
59    ENDIF
60
61  END SUBROUTINE Init_const_mpi
62 
63  SUBROUTINE Init_mpi
[1852]64#ifdef CPP_XIOS
[1897]65    USE wxios, only: wxios_init
[1852]66#endif
[1000]67  IMPLICIT NONE
68#ifdef CPP_MPI
69     INCLUDE 'mpif.h'
70#endif
71    INTEGER             :: ierr
72    INTEGER             :: thread_required
73    INTEGER             :: thread_provided
74
75#ifdef CPP_MPI
[985]76!$OMP MASTER
[1000]77      thread_required=MPI_THREAD_SERIALIZED
78
79      CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr)
80      IF (thread_provided < thread_required) THEN
81        PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level',  &
82                ' in mod_const_mpi::Init_const_mpi'
83      ENDIF
84      COMM_LMDZ=MPI_COMM_WORLD
85      MPI_REAL_LMDZ=MPI_REAL8
[1897]86!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87! Initialisation de XIOS
88!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[1852]89#ifdef CPP_XIOS
90      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
91#endif
[985]92!$OMP END MASTER
[1852]93#else
94#ifdef CPP_XIOS
[1856]95!$OMP MASTER
[1852]96      CALL wxios_init("LMDZ")
[1856]97!$OMP END MASTER
[1000]98#endif
[1852]99#endif
[1897]100
[1000]101   END SUBROUTINE Init_mpi
102   
[774]103END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.