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 | ! Use of Oasis-MCT coupler |
---|
17 | #ifdef CPP_OMCT |
---|
18 | USE mod_prism |
---|
19 | #endif |
---|
20 | USE wxios, only: wxios_init, using_xios |
---|
21 | IMPLICIT NONE |
---|
22 | |
---|
23 | INTEGER :: ierr |
---|
24 | INTEGER :: comp_id |
---|
25 | INTEGER :: thread_required |
---|
26 | INTEGER :: thread_provided |
---|
27 | CHARACTER(len = 6) :: type_ocean |
---|
28 | |
---|
29 | !$OMP MASTER |
---|
30 | type_ocean = 'force ' |
---|
31 | CALL getin('type_ocean', type_ocean) |
---|
32 | !$OMP END MASTER |
---|
33 | !$OMP BARRIER |
---|
34 | |
---|
35 | IF (using_mpi) THEN |
---|
36 | IF (type_ocean=='couple') THEN |
---|
37 | #ifdef CPP_COUPLE |
---|
38 | !$OMP MASTER |
---|
39 | IF (using_xios) THEN |
---|
40 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
41 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
42 | CALL wxios_init("LMDZ", locom=COMM_LMDZ, outcom=COMM_LMDZ, type_ocean=type_ocean) |
---|
43 | ELSE |
---|
44 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
45 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
46 | ENDIF |
---|
47 | !$OMP END MASTER |
---|
48 | #endif |
---|
49 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
50 | ELSE |
---|
51 | CALL init_mpi |
---|
52 | ENDIF |
---|
53 | ENDIF |
---|
54 | END SUBROUTINE Init_const_mpi |
---|
55 | |
---|
56 | SUBROUTINE Init_mpi |
---|
57 | USE lmdz_mpi |
---|
58 | USE wxios, only: wxios_init, using_xios |
---|
59 | |
---|
60 | IMPLICIT NONE |
---|
61 | INTEGER :: ierr |
---|
62 | INTEGER :: thread_required |
---|
63 | INTEGER :: thread_provided |
---|
64 | |
---|
65 | !$OMP MASTER |
---|
66 | thread_required=MPI_THREAD_SERIALIZED |
---|
67 | |
---|
68 | CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr) |
---|
69 | IF (thread_provided < thread_required) THEN |
---|
70 | PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level', & |
---|
71 | ' in mod_const_mpi::Init_const_mpi' |
---|
72 | ENDIF |
---|
73 | COMM_LMDZ=MPI_COMM_WORLD |
---|
74 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
75 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
76 | ! Initialisation de XIOS |
---|
77 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
78 | IF (using_xios) THEN |
---|
79 | WRITE(*,*)'IN Init_mpi CALL wxios_init' |
---|
80 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
81 | ENDIF |
---|
82 | !$OMP END MASTER |
---|
83 | |
---|
84 | END SUBROUTINE Init_mpi |
---|
85 | |
---|
86 | END MODULE mod_const_mpi |
---|