[1279] | 1 | ! |
---|
| 2 | ! $Id: mod_const_mpi.F90 1965 2014-02-11 10:42:52Z fhourdin $ |
---|
| 3 | ! |
---|
[774] | 4 | MODULE mod_const_mpi |
---|
[1897] | 5 | IMPLICIT NONE |
---|
[985] | 6 | INTEGER,SAVE :: COMM_LMDZ |
---|
| 7 | INTEGER,SAVE :: MPI_REAL_LMDZ |
---|
[774] | 8 | |
---|
| 9 | |
---|
| 10 | CONTAINS |
---|
| 11 | |
---|
| 12 | SUBROUTINE Init_const_mpi |
---|
[1279] | 13 | #ifdef CPP_IOIPSL |
---|
[1897] | 14 | USE IOIPSL, ONLY: getin |
---|
[1279] | 15 | #else |
---|
| 16 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
[1897] | 17 | USE ioipsl_getincom, only: getin |
---|
[1279] | 18 | #endif |
---|
[1965] | 19 | ! Use of Oasis-MCT coupler |
---|
| 20 | #ifdef CPP_OMCT |
---|
| 21 | USE mod_prism |
---|
| 22 | #endif |
---|
[884] | 23 | IMPLICIT NONE |
---|
[1000] | 24 | #ifdef CPP_MPI |
---|
[774] | 25 | INCLUDE 'mpif.h' |
---|
[1000] | 26 | #endif |
---|
[1897] | 27 | |
---|
[884] | 28 | INTEGER :: ierr |
---|
| 29 | INTEGER :: comp_id |
---|
[985] | 30 | INTEGER :: thread_required |
---|
| 31 | INTEGER :: thread_provided |
---|
[1008] | 32 | CHARACTER(len = 6) :: type_ocean |
---|
[884] | 33 | |
---|
| 34 | !$OMP MASTER |
---|
[1008] | 35 | type_ocean = 'force ' |
---|
| 36 | CALL getin('type_ocean', type_ocean) |
---|
[985] | 37 | !$OMP END MASTER |
---|
| 38 | !$OMP BARRIER |
---|
[884] | 39 | |
---|
[1008] | 40 | IF (type_ocean=='couple') THEN |
---|
[806] | 41 | #ifdef CPP_COUPLE |
---|
[985] | 42 | !$OMP MASTER |
---|
[884] | 43 | CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr) |
---|
| 44 | CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) |
---|
[985] | 45 | !$OMP END MASTER |
---|
[1014] | 46 | #endif |
---|
[1000] | 47 | #ifdef CPP_MPI |
---|
| 48 | MPI_REAL_LMDZ=MPI_REAL8 |
---|
[806] | 49 | #endif |
---|
[884] | 50 | ELSE |
---|
[1000] | 51 | CALL init_mpi |
---|
| 52 | ENDIF |
---|
| 53 | |
---|
| 54 | END SUBROUTINE Init_const_mpi |
---|
| 55 | |
---|
| 56 | SUBROUTINE Init_mpi |
---|
[1852] | 57 | #ifdef CPP_XIOS |
---|
[1897] | 58 | USE wxios, only: wxios_init |
---|
[1852] | 59 | #endif |
---|
[1000] | 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 |
---|
[985] | 69 | !$OMP MASTER |
---|
[1000] | 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 |
---|
[1897] | 79 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 80 | ! Initialisation de XIOS |
---|
| 81 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1852] | 82 | #ifdef CPP_XIOS |
---|
| 83 | CALL wxios_init("LMDZ", outcom=COMM_LMDZ) |
---|
| 84 | #endif |
---|
[985] | 85 | !$OMP END MASTER |
---|
[1852] | 86 | #else |
---|
| 87 | #ifdef CPP_XIOS |
---|
[1856] | 88 | !$OMP MASTER |
---|
[1852] | 89 | CALL wxios_init("LMDZ") |
---|
[1856] | 90 | !$OMP END MASTER |
---|
[1000] | 91 | #endif |
---|
[1852] | 92 | #endif |
---|
[1897] | 93 | |
---|
[1000] | 94 | END SUBROUTINE Init_mpi |
---|
| 95 | |
---|
[774] | 96 | END MODULE mod_const_mpi |
---|