source: LMDZ4/trunk/libf/dyn3dpar/mod_const_para.F90 @ 1032

Last change on this file since 1032 was 1014, checked in by lsce, 16 years ago

Bug fix, en cas de couple.

JG

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1MODULE mod_const_mpi
2
3  INTEGER,SAVE :: COMM_LMDZ
4  INTEGER,SAVE :: MPI_REAL_LMDZ
5 
6
7CONTAINS
8
9  SUBROUTINE Init_const_mpi
10    USE IOIPSL
11
12    IMPLICIT NONE
13#ifdef CPP_MPI
14    INCLUDE 'mpif.h'
15#endif
16    INTEGER             :: ierr
17    INTEGER             :: comp_id
18    INTEGER             :: thread_required
19    INTEGER             :: thread_provided
20    CHARACTER(len = 6)  :: type_ocean
21
22!$OMP MASTER
23    type_ocean = 'force '
24    CALL getin('type_ocean', type_ocean)
25!$OMP END MASTER
26!$OMP BARRIER
27
28    IF (type_ocean=='couple') THEN
29#ifdef CPP_COUPLE
30!$OMP MASTER
31       CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr)
32       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
33!$OMP END MASTER
34#endif
35#ifdef CPP_MPI
36      MPI_REAL_LMDZ=MPI_REAL8
37#endif
38    ELSE
39      CALL init_mpi
40    ENDIF
41
42  END SUBROUTINE Init_const_mpi
43 
44  SUBROUTINE Init_mpi
45  IMPLICIT NONE
46#ifdef CPP_MPI
47     INCLUDE 'mpif.h'
48#endif
49    INTEGER             :: ierr
50    INTEGER             :: thread_required
51    INTEGER             :: thread_provided
52
53#ifdef CPP_MPI
54!$OMP MASTER
55      thread_required=MPI_THREAD_SERIALIZED
56
57      CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr)
58      IF (thread_provided < thread_required) THEN
59        PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level',  &
60                ' in mod_const_mpi::Init_const_mpi'
61      ENDIF
62      COMM_LMDZ=MPI_COMM_WORLD
63      MPI_REAL_LMDZ=MPI_REAL8
64!$OMP END MASTER
65#endif
66
67   END SUBROUTINE Init_mpi
68   
69END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.