source: LMDZ6/trunk/libf/dyn3dmem/mod_const_mpi.F90 @ 5217

Last change on this file since 5217 was 4848, checked in by Laurent Fairhead, 8 months ago

Modifications needed for XIOS3

  • 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.4 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    USE lmdz_mpi
14
15#ifdef CPP_IOIPSL
16    USE IOIPSL, ONLY: getin
17#else
18! if not using IOIPSL, we still need to use (a local version of) getin
19    USE ioipsl_getincom, only: getin
20#endif
21! Use of Oasis-MCT coupler
22#ifdef CPP_OMCT
23    USE mod_prism
24#endif
25    USE wxios, only: wxios_init, using_xios
26    IMPLICIT NONE
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 (using_mpi) THEN
41      IF (type_ocean=='couple') THEN
42#ifdef CPP_COUPLE
43!$OMP MASTER
44        IF (using_xios) THEN
45          CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr)
46          CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
47          CALL wxios_init("LMDZ", locom=COMM_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        MPI_REAL_LMDZ=MPI_REAL8
55      ELSE
56        CALL init_mpi
57      ENDIF
58    ENDIF
59  END SUBROUTINE Init_const_mpi
60 
61  SUBROUTINE Init_mpi
62    USE lmdz_mpi
63    USE wxios, only: wxios_init, using_xios
64
65  IMPLICIT NONE
66    INTEGER             :: ierr
67    INTEGER             :: thread_required
68    INTEGER             :: thread_provided
69
70!$OMP MASTER
71      thread_required=MPI_THREAD_SERIALIZED
72
73      CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr)
74      IF (thread_provided < thread_required) THEN
75        PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level',  &
76                ' in mod_const_mpi::Init_const_mpi'
77      ENDIF
78      COMM_LMDZ=MPI_COMM_WORLD
79      MPI_REAL_LMDZ=MPI_REAL8
80!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
81! Initialisation de XIOS
82!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
83      IF (using_xios) THEN
84        WRITE(*,*)'IN Init_mpi call wxios_init'
85        CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
86      ENDIF
87!$OMP END MASTER
88
89END SUBROUTINE Init_mpi
90   
91END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.