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

Last change on this file since 1972 was 1965, checked in by acaubel, 11 years ago

AC : Modified to run with Oasis-MCT as coupler in IPSLCM6 coupled configuration

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