[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 |
---|
| 13 | #ifdef CPP_IOIPSL |
---|
[1897] | 14 | USE IOIPSL, ONLY: getin |
---|
[1632] | 15 | #else |
---|
| 16 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
[1897] | 17 | USE ioipsl_getincom, only: getin |
---|
[1632] | 18 | #endif |
---|
[1965] | 19 | ! Use of Oasis-MCT coupler |
---|
| 20 | #ifdef CPP_OMCT |
---|
| 21 | USE mod_prism |
---|
| 22 | #endif |
---|
[1632] | 23 | IMPLICIT NONE |
---|
| 24 | #ifdef CPP_MPI |
---|
| 25 | INCLUDE 'mpif.h' |
---|
| 26 | #endif |
---|
[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 | |
---|
| 40 | IF (type_ocean=='couple') THEN |
---|
| 41 | #ifdef CPP_COUPLE |
---|
| 42 | !$OMP MASTER |
---|
| 43 | CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr) |
---|
| 44 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
| 45 | !$OMP END MASTER |
---|
| 46 | #endif |
---|
| 47 | #ifdef CPP_MPI |
---|
| 48 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
| 49 | #endif |
---|
| 50 | ELSE |
---|
| 51 | CALL init_mpi |
---|
| 52 | ENDIF |
---|
| 53 | |
---|
| 54 | END SUBROUTINE Init_const_mpi |
---|
| 55 | |
---|
| 56 | SUBROUTINE Init_mpi |
---|
[1856] | 57 | #ifdef CPP_XIOS |
---|
[1897] | 58 | USE wxios, only: wxios_init |
---|
[1856] | 59 | #endif |
---|
[1632] | 60 | IMPLICIT NONE |
---|
| 61 | #ifdef CPP_MPI |
---|
| 62 | INCLUDE 'mpif.h' |
---|
| 63 | #endif |
---|
| 64 | INTEGER :: ierr |
---|
| 65 | INTEGER :: thread_required |
---|
| 66 | INTEGER :: thread_provided |
---|
| 67 | |
---|
| 68 | #ifdef CPP_MPI |
---|
| 69 | !$OMP MASTER |
---|
| 70 | thread_required=MPI_THREAD_SERIALIZED |
---|
| 71 | |
---|
| 72 | CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr) |
---|
| 73 | IF (thread_provided < thread_required) THEN |
---|
| 74 | PRINT *,'Warning : The multithreaded level of MPI librairy do not provide the requiered level', & |
---|
| 75 | ' in mod_const_mpi::Init_const_mpi' |
---|
| 76 | ENDIF |
---|
| 77 | COMM_LMDZ=MPI_COMM_WORLD |
---|
| 78 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
[1856] | 79 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 80 | ! Initialisation de XIOS |
---|
| 81 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 82 | #ifdef CPP_XIOS |
---|
| 83 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
| 84 | #endif |
---|
[1632] | 85 | !$OMP END MASTER |
---|
[1856] | 86 | #else |
---|
| 87 | #ifdef CPP_XIOS |
---|
| 88 | !$OMP MASTER |
---|
| 89 | CALL wxios_init("LMDZ") |
---|
| 90 | !$OMP END MASTER |
---|
[1632] | 91 | #endif |
---|
[1856] | 92 | #endif |
---|
[1632] | 93 | |
---|
| 94 | END SUBROUTINE Init_mpi |
---|
| 95 | |
---|
| 96 | END MODULE mod_const_mpi |
---|