source: LMDZ5/branches/LMDZ6_rc0/libf/dyn3dpar/mod_const_mpi.F90 @ 5394

Last change on this file since 5394 was 2056, checked in by Laurent Fairhead, 11 years ago

Merged trunk changes r1997:2055 into testing branch

  • 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
Line 
1!
2! $Id: mod_const_mpi.F90 2056 2014-06-11 13:46:46Z evignon $
3!
4MODULE mod_const_mpi
5  IMPLICIT NONE
6  INTEGER,SAVE :: COMM_LMDZ
7  INTEGER,SAVE :: MPI_REAL_LMDZ
8 
9
10CONTAINS
11
12  SUBROUTINE Init_const_mpi
13#ifdef CPP_IOIPSL
14    USE IOIPSL, ONLY: getin
15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
17    USE ioipsl_getincom, only: getin
18#endif
19! Use of Oasis-MCT coupler
20#ifdef CPP_OMCT
21    USE mod_prism
22#endif
23#ifdef CPP_XIOS
24    USE wxios, only: wxios_init
25#endif
26    IMPLICIT NONE
27#ifdef CPP_MPI
28    INCLUDE 'mpif.h'
29#endif
30
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
46#ifdef CPP_XIOS
47      CALL wxios_init("LMDZ", outcom=COMM_LMDZ, type_ocean=type_ocean)
48#else
49       CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr)
50       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
51#endif
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
64#ifdef CPP_XIOS
65    USE wxios, only: wxios_init
66#endif
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
86!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87! Initialisation de XIOS
88!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89#ifdef CPP_XIOS
90      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
91#endif
92!$OMP END MASTER
93#else
94#ifdef CPP_XIOS
95!$OMP MASTER
96      CALL wxios_init("LMDZ")
97!$OMP END MASTER
98#endif
99#endif
100
101   END SUBROUTINE Init_mpi
102   
103END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.