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