source: LMDZ5/branches/testing/libf/dyn3dpar/mod_const_mpi.F90 @ 5047

Last change on this file since 5047 was 2056, checked in by Laurent Fairhead, 10 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
RevLine 
[1279]1!
2! $Id: mod_const_mpi.F90 2056 2014-06-11 13:46:46Z evignon $
3!
[774]4MODULE mod_const_mpi
[1910]5  IMPLICIT NONE
[985]6  INTEGER,SAVE :: COMM_LMDZ
7  INTEGER,SAVE :: MPI_REAL_LMDZ
[774]8 
9
10CONTAINS
11
12  SUBROUTINE Init_const_mpi
[1279]13#ifdef CPP_IOIPSL
[1910]14    USE IOIPSL, ONLY: getin
[1279]15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
[1910]17    USE ioipsl_getincom, only: getin
[1279]18#endif
[1999]19! Use of Oasis-MCT coupler
20#ifdef CPP_OMCT
21    USE mod_prism
22#endif
[2056]23#ifdef CPP_XIOS
24    USE wxios, only: wxios_init
25#endif
[884]26    IMPLICIT NONE
[1000]27#ifdef CPP_MPI
[774]28    INCLUDE 'mpif.h'
[1000]29#endif
[1910]30
[884]31    INTEGER             :: ierr
32    INTEGER             :: comp_id
[985]33    INTEGER             :: thread_required
34    INTEGER             :: thread_provided
[1008]35    CHARACTER(len = 6)  :: type_ocean
[884]36
37!$OMP MASTER
[1008]38    type_ocean = 'force '
39    CALL getin('type_ocean', type_ocean)
[985]40!$OMP END MASTER
41!$OMP BARRIER
[884]42
[1008]43    IF (type_ocean=='couple') THEN
[806]44#ifdef CPP_COUPLE
[985]45!$OMP MASTER
[2056]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)
[884]50       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
[2056]51#endif
[985]52!$OMP END MASTER
[1014]53#endif
[1000]54#ifdef CPP_MPI
55      MPI_REAL_LMDZ=MPI_REAL8
[806]56#endif
[884]57    ELSE
[1000]58      CALL init_mpi
59    ENDIF
60
61  END SUBROUTINE Init_const_mpi
62 
63  SUBROUTINE Init_mpi
[1864]64#ifdef CPP_XIOS
[1910]65    USE wxios, only: wxios_init
[1864]66#endif
[1000]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
[985]76!$OMP MASTER
[1000]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
[1910]86!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87! Initialisation de XIOS
88!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[1864]89#ifdef CPP_XIOS
90      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
91#endif
[985]92!$OMP END MASTER
[1864]93#else
94#ifdef CPP_XIOS
95!$OMP MASTER
96      CALL wxios_init("LMDZ")
97!$OMP END MASTER
[1000]98#endif
[1864]99#endif
[1910]100
[1000]101   END SUBROUTINE Init_mpi
102   
[774]103END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.