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

Last change on this file since 1939 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
RevLine 
[1279]1!
2! $Id: mod_const_mpi.F90 1907 2013-11-26 13:10:46Z lguez $
3!
[774]4MODULE mod_const_mpi
[1897]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
[1897]14    USE IOIPSL, ONLY: getin
[1279]15#else
16! if not using IOIPSL, we still need to use (a local version of) getin
[1897]17    USE ioipsl_getincom, only: getin
[1279]18#endif
[884]19
20    IMPLICIT NONE
[1000]21#ifdef CPP_MPI
[774]22    INCLUDE 'mpif.h'
[1000]23#endif
[1897]24
[884]25    INTEGER             :: ierr
26    INTEGER             :: comp_id
[985]27    INTEGER             :: thread_required
28    INTEGER             :: thread_provided
[1008]29    CHARACTER(len = 6)  :: type_ocean
[884]30
31!$OMP MASTER
[1008]32    type_ocean = 'force '
33    CALL getin('type_ocean', type_ocean)
[985]34!$OMP END MASTER
35!$OMP BARRIER
[884]36
[1008]37    IF (type_ocean=='couple') THEN
[806]38#ifdef CPP_COUPLE
[985]39!$OMP MASTER
[884]40       CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr)
41       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
[985]42!$OMP END MASTER
[1014]43#endif
[1000]44#ifdef CPP_MPI
45      MPI_REAL_LMDZ=MPI_REAL8
[806]46#endif
[884]47    ELSE
[1000]48      CALL init_mpi
49    ENDIF
50
51  END SUBROUTINE Init_const_mpi
52 
53  SUBROUTINE Init_mpi
[1852]54#ifdef CPP_XIOS
[1897]55    USE wxios, only: wxios_init
[1852]56#endif
[1000]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
[985]66!$OMP MASTER
[1000]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
[1897]76!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77! Initialisation de XIOS
78!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[1852]79#ifdef CPP_XIOS
80      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
81#endif
[985]82!$OMP END MASTER
[1852]83#else
84#ifdef CPP_XIOS
[1856]85!$OMP MASTER
[1852]86      CALL wxios_init("LMDZ")
[1856]87!$OMP END MASTER
[1000]88#endif
[1852]89#endif
[1897]90
[1000]91   END SUBROUTINE Init_mpi
92   
[774]93END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.