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

Last change on this file since 1175 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
RevLine 
[774]1MODULE mod_const_mpi
2
[985]3  INTEGER,SAVE :: COMM_LMDZ
4  INTEGER,SAVE :: MPI_REAL_LMDZ
[774]5 
6
7CONTAINS
8
9  SUBROUTINE Init_const_mpi
[884]10    USE IOIPSL
11
12    IMPLICIT NONE
[1000]13#ifdef CPP_MPI
[774]14    INCLUDE 'mpif.h'
[1000]15#endif
[884]16    INTEGER             :: ierr
17    INTEGER             :: comp_id
[985]18    INTEGER             :: thread_required
19    INTEGER             :: thread_provided
[1008]20    CHARACTER(len = 6)  :: type_ocean
[884]21
22!$OMP MASTER
[1008]23    type_ocean = 'force '
24    CALL getin('type_ocean', type_ocean)
[985]25!$OMP END MASTER
26!$OMP BARRIER
[884]27
[1008]28    IF (type_ocean=='couple') THEN
[806]29#ifdef CPP_COUPLE
[985]30!$OMP MASTER
[884]31       CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr)
32       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
[985]33!$OMP END MASTER
[1014]34#endif
[1000]35#ifdef CPP_MPI
36      MPI_REAL_LMDZ=MPI_REAL8
[806]37#endif
[884]38    ELSE
[1000]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
[985]54!$OMP MASTER
[1000]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
[985]64!$OMP END MASTER
[1000]65#endif
[806]66
[1000]67   END SUBROUTINE Init_mpi
68   
[774]69END MODULE mod_const_mpi
Note: See TracBrowser for help on using the repository browser.