source: LMDZ5/branches/LF-private/libf/dyn3dmem/mod_const_mpi.F90 @ 5440

Last change on this file since 5440 was 1856, checked in by Ehouarn Millour, 11 years ago

Implémentation de XIOS dans dyn3dmem.
UG
................................
XIOS implementation in dyn3dmem.
UG

File size: 2.1 KB
Line 
1!
2! $Id: mod_const_para.F90 1279 2009-12-10 09:02:56Z fairhead $
3!
4MODULE mod_const_mpi
5
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
15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
17    USE ioipsl_getincom
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
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.