source: LMDZ5/trunk/libf/dyn3dmem/mod_const_mpi.F90 @ 3836

Last change on this file since 3836 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
File size: 2.3 KB
RevLine 
[1632]1!
2! $Id: mod_const_para.F90 1279 2009-12-10 09:02:56Z fairhead $
3!
4MODULE mod_const_mpi
[1897]5  IMPLICIT NONE
[1632]6  INTEGER,SAVE :: COMM_LMDZ
7  INTEGER,SAVE :: MPI_REAL_LMDZ
8 
9
10CONTAINS
11
12  SUBROUTINE Init_const_mpi
13#ifdef CPP_IOIPSL
[1897]14    USE IOIPSL, ONLY: getin
[1632]15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
[1897]17    USE ioipsl_getincom, only: getin
[1632]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
[1632]26    IMPLICIT NONE
27#ifdef CPP_MPI
28    INCLUDE 'mpif.h'
29#endif
[1856]30
[1632]31    INTEGER             :: ierr
32    INTEGER             :: comp_id
33    INTEGER             :: thread_required
34    INTEGER             :: thread_provided
35    CHARACTER(len = 6)  :: type_ocean
36
37!$OMP MASTER
38    type_ocean = 'force '
39    CALL getin('type_ocean', type_ocean)
40!$OMP END MASTER
41!$OMP BARRIER
42
43    IF (type_ocean=='couple') THEN
44#ifdef CPP_COUPLE
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)
[1632]50       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
[2054]51#endif
[1632]52!$OMP END MASTER
53#endif
54#ifdef CPP_MPI
55      MPI_REAL_LMDZ=MPI_REAL8
56#endif
57    ELSE
58      CALL init_mpi
59    ENDIF
60
61  END SUBROUTINE Init_const_mpi
62 
63  SUBROUTINE Init_mpi
[1856]64#ifdef CPP_XIOS
[1897]65    USE wxios, only: wxios_init
[1856]66#endif
[1632]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
76!$OMP MASTER
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
[1856]86!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87! Initialisation de XIOS
88!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89#ifdef CPP_XIOS
90      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
91#endif
[1632]92!$OMP END MASTER
[1856]93#else
94#ifdef CPP_XIOS
95!$OMP MASTER
96      CALL wxios_init("LMDZ")
97!$OMP END MASTER
[1632]98#endif
[1856]99#endif
[1632]100
101   END SUBROUTINE Init_mpi
102   
103END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.