[1632] | 1 | ! |
---|
| 2 | ! $Id: mod_const_para.F90 1279 2009-12-10 09:02:56Z fairhead $ |
---|
| 3 | ! |
---|
| 4 | MODULE mod_const_mpi |
---|
[1897] | 5 | IMPLICIT NONE |
---|
[1632] | 6 | INTEGER,SAVE :: COMM_LMDZ |
---|
| 7 | INTEGER,SAVE :: MPI_REAL_LMDZ |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | CONTAINS |
---|
| 11 | |
---|
| 12 | SUBROUTINE Init_const_mpi |
---|
[4600] | 13 | USE lmdz_mpi |
---|
| 14 | |
---|
[1897] | 15 | USE IOIPSL, ONLY: getin |
---|
[5267] | 16 | |
---|
[1965] | 17 | ! Use of Oasis-MCT coupler |
---|
| 18 | #ifdef CPP_OMCT |
---|
| 19 | USE mod_prism |
---|
| 20 | #endif |
---|
[5310] | 21 | use wxios_mod, only: wxios_init, using_xios |
---|
[1632] | 22 | IMPLICIT NONE |
---|
[1856] | 23 | |
---|
[1632] | 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 | |
---|
[4604] | 36 | IF (using_mpi) THEN |
---|
| 37 | IF (type_ocean=='couple') THEN |
---|
[1632] | 38 | #ifdef CPP_COUPLE |
---|
| 39 | !$OMP MASTER |
---|
[4619] | 40 | IF (using_xios) THEN |
---|
[4848] | 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) |
---|
[4619] | 44 | ELSE |
---|
| 45 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
| 46 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
| 47 | ENDIF |
---|
[1632] | 48 | !$OMP END MASTER |
---|
| 49 | #endif |
---|
[4604] | 50 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
| 51 | ELSE |
---|
| 52 | CALL init_mpi |
---|
| 53 | ENDIF |
---|
[1632] | 54 | ENDIF |
---|
| 55 | END SUBROUTINE Init_const_mpi |
---|
| 56 | |
---|
| 57 | SUBROUTINE Init_mpi |
---|
[4600] | 58 | USE lmdz_mpi |
---|
[5310] | 59 | use wxios_mod, only: wxios_init, using_xios |
---|
[4600] | 60 | |
---|
[1632] | 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 |
---|
[1856] | 76 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 77 | ! Initialisation de XIOS |
---|
| 78 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[4619] | 79 | IF (using_xios) THEN |
---|
| 80 | WRITE(*,*)'IN Init_mpi call wxios_init' |
---|
| 81 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
| 82 | ENDIF |
---|
[1632] | 83 | !$OMP END MASTER |
---|
| 84 | |
---|
[4600] | 85 | END SUBROUTINE Init_mpi |
---|
[1632] | 86 | |
---|
| 87 | END MODULE mod_const_mpi |
---|