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

Last change on this file since 1930 was 1907, checked in by lguez, 11 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
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

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • 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.1 KB
Line 
1!
2! $Id: mod_const_mpi.F90 1907 2013-11-26 13:10:46Z lguez $
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
20    IMPLICIT NONE
21#ifdef CPP_MPI
22    INCLUDE 'mpif.h'
23#endif
24
25    INTEGER             :: ierr
26    INTEGER             :: comp_id
27    INTEGER             :: thread_required
28    INTEGER             :: thread_provided
29    CHARACTER(len = 6)  :: type_ocean
30
31!$OMP MASTER
32    type_ocean = 'force '
33    CALL getin('type_ocean', type_ocean)
34!$OMP END MASTER
35!$OMP BARRIER
36
37    IF (type_ocean=='couple') THEN
38#ifdef CPP_COUPLE
39!$OMP MASTER
40       CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr)
41       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
42!$OMP END MASTER
43#endif
44#ifdef CPP_MPI
45      MPI_REAL_LMDZ=MPI_REAL8
46#endif
47    ELSE
48      CALL init_mpi
49    ENDIF
50
51  END SUBROUTINE Init_const_mpi
52 
53  SUBROUTINE Init_mpi
54#ifdef CPP_XIOS
55    USE wxios, only: wxios_init
56#endif
57  IMPLICIT NONE
58#ifdef CPP_MPI
59     INCLUDE 'mpif.h'
60#endif
61    INTEGER             :: ierr
62    INTEGER             :: thread_required
63    INTEGER             :: thread_provided
64
65#ifdef CPP_MPI
66!$OMP MASTER
67      thread_required=MPI_THREAD_SERIALIZED
68
69      CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr)
70      IF (thread_provided < thread_required) THEN
71        PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level',  &
72                ' in mod_const_mpi::Init_const_mpi'
73      ENDIF
74      COMM_LMDZ=MPI_COMM_WORLD
75      MPI_REAL_LMDZ=MPI_REAL8
76!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77! Initialisation de XIOS
78!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
79#ifdef CPP_XIOS
80      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
81#endif
82!$OMP END MASTER
83#else
84#ifdef CPP_XIOS
85!$OMP MASTER
86      CALL wxios_init("LMDZ")
87!$OMP END MASTER
88#endif
89#endif
90
91   END SUBROUTINE Init_mpi
92   
93END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.