1 | ! |
---|
2 | ! $Id: mod_const_para.F90 1279 2009-12-10 09:02:56Z fairhead $ |
---|
3 | ! |
---|
4 | MODULE mod_const_mpi |
---|
5 | IMPLICIT NONE |
---|
6 | INTEGER,SAVE :: COMM_LMDZ |
---|
7 | INTEGER,SAVE :: MPI_REAL_LMDZ |
---|
8 | |
---|
9 | |
---|
10 | CONTAINS |
---|
11 | |
---|
12 | SUBROUTINE Init_const_mpi |
---|
13 | USE lmdz_mpi |
---|
14 | |
---|
15 | USE IOIPSL, ONLY: getin |
---|
16 | |
---|
17 | ! Use of Oasis-MCT coupler |
---|
18 | #ifdef CPP_OMCT |
---|
19 | USE mod_prism |
---|
20 | #endif |
---|
21 | use wxios_mod, only: wxios_init, using_xios |
---|
22 | IMPLICIT NONE |
---|
23 | |
---|
24 | INTEGER :: ierr |
---|
25 | INTEGER :: comp_id |
---|
26 | INTEGER :: thread_required |
---|
27 | INTEGER :: thread_provided |
---|
28 | CHARACTER(len = 6) :: type_ocean |
---|
29 | |
---|
30 | !$OMP MASTER |
---|
31 | type_ocean = 'force ' |
---|
32 | CALL getin('type_ocean', type_ocean) |
---|
33 | !$OMP END MASTER |
---|
34 | !$OMP BARRIER |
---|
35 | |
---|
36 | IF (using_mpi) THEN |
---|
37 | IF (type_ocean=='couple') THEN |
---|
38 | #ifdef CPP_COUPLE |
---|
39 | !$OMP MASTER |
---|
40 | IF (using_xios) THEN |
---|
41 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
42 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
43 | CALL wxios_init("LMDZ", locom=COMM_LMDZ, outcom=COMM_LMDZ, type_ocean=type_ocean) |
---|
44 | ELSE |
---|
45 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
46 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
47 | ENDIF |
---|
48 | !$OMP END MASTER |
---|
49 | #endif |
---|
50 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
51 | ELSE |
---|
52 | CALL init_mpi |
---|
53 | ENDIF |
---|
54 | ENDIF |
---|
55 | END SUBROUTINE Init_const_mpi |
---|
56 | |
---|
57 | SUBROUTINE Init_mpi |
---|
58 | USE lmdz_mpi |
---|
59 | use wxios_mod, only: wxios_init, using_xios |
---|
60 | |
---|
61 | IMPLICIT NONE |
---|
62 | INTEGER :: ierr |
---|
63 | INTEGER :: thread_required |
---|
64 | INTEGER :: thread_provided |
---|
65 | |
---|
66 | !$OMP MASTER |
---|
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 |
---|
76 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
77 | ! Initialisation de XIOS |
---|
78 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
79 | IF (using_xios) THEN |
---|
80 | WRITE(*,*)'IN Init_mpi call wxios_init' |
---|
81 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
82 | ENDIF |
---|
83 | !$OMP END MASTER |
---|
84 | |
---|
85 | END SUBROUTINE Init_mpi |
---|
86 | |
---|
87 | END MODULE mod_const_mpi |
---|