[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 |
---|
| 45 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ, type_ocean=type_ocean) |
---|
| 46 | ELSE |
---|
| 47 | CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr) |
---|
| 48 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
| 49 | ENDIF |
---|
[1632] | 50 | !$OMP END MASTER |
---|
| 51 | #endif |
---|
[4604] | 52 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
| 53 | ELSE |
---|
| 54 | CALL init_mpi |
---|
| 55 | ENDIF |
---|
[1632] | 56 | ENDIF |
---|
| 57 | END SUBROUTINE Init_const_mpi |
---|
| 58 | |
---|
| 59 | SUBROUTINE Init_mpi |
---|
[4600] | 60 | USE lmdz_mpi |
---|
[4619] | 61 | USE wxios, only: wxios_init, using_xios |
---|
[4600] | 62 | |
---|
[1632] | 63 | IMPLICIT NONE |
---|
| 64 | INTEGER :: ierr |
---|
| 65 | INTEGER :: thread_required |
---|
| 66 | INTEGER :: thread_provided |
---|
| 67 | |
---|
| 68 | !$OMP MASTER |
---|
| 69 | thread_required=MPI_THREAD_SERIALIZED |
---|
| 70 | |
---|
| 71 | CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr) |
---|
| 72 | IF (thread_provided < thread_required) THEN |
---|
| 73 | PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level', & |
---|
| 74 | ' in mod_const_mpi::Init_const_mpi' |
---|
| 75 | ENDIF |
---|
| 76 | COMM_LMDZ=MPI_COMM_WORLD |
---|
| 77 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
[1856] | 78 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 79 | ! Initialisation de XIOS |
---|
| 80 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[4619] | 81 | IF (using_xios) THEN |
---|
| 82 | WRITE(*,*)'IN Init_mpi call wxios_init' |
---|
| 83 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
| 84 | ENDIF |
---|
[1632] | 85 | !$OMP END MASTER |
---|
| 86 | |
---|
[4600] | 87 | END SUBROUTINE Init_mpi |
---|
[1632] | 88 | |
---|
| 89 | END MODULE mod_const_mpi |
---|