Changeset 2351 for LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_data.F90
- Timestamp:
- Aug 25, 2015, 5:14:59 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_data.F90
r2326 r2351 3 3 ! 4 4 MODULE mod_phys_lmdz_mpi_data 5 USE mod_const_mpi5 ! USE mod_const_mpi 6 6 7 7 INTEGER,SAVE :: ii_begin … … 35 35 INTEGER,SAVE :: mpi_rank 36 36 INTEGER,SAVE :: mpi_size 37 INTEGER,SAVE :: mpi_root 37 INTEGER,SAVE :: mpi_master 38 ! INTEGER,SAVE :: mpi_root 38 39 LOGICAL,SAVE :: is_mpi_root 39 40 LOGICAL,SAVE :: is_using_mpi … … 43 44 LOGICAL,SAVE :: is_south_pole 44 45 INTEGER,SAVE :: COMM_LMDZ_PHY 46 INTEGER,SAVE :: MPI_REAL_LMDZ ! MPI_REAL8 45 47 46 48 CONTAINS 47 49 48 SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib) 49 USE mod_const_mpi, ONLY : COMM_LMDZ 50 ! SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib) 51 SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator) 52 ! USE mod_const_mpi, ONLY : COMM_LMDZ 50 53 IMPLICIT NONE 51 INTEGER,INTENT(in) :: iim 52 INTEGER,INTENT(in) :: jjp1 53 INTEGER,INTENT(in) :: nb_proc 54 INTEGER,INTENT(in) :: distrib(0:nb_proc-1) 55 54 #ifdef CPP_MPI 55 INCLUDE 'mpif.h' 56 #endif 57 INTEGER,INTENT(in) :: nbp 58 INTEGER,INTENT(in) :: nbp_lon 59 INTEGER,INTENT(in) :: nbp_lat 60 INTEGER,INTENT(in) :: communicator 61 62 INTEGER,ALLOCATABLE :: distrib(:) 56 63 INTEGER :: ierr 57 64 INTEGER :: klon_glo … … 64 71 #endif 65 72 66 if ( iim.eq.1) then73 if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model 67 74 klon_glo=1 68 75 else 69 klon_glo=iim*(jjp1-2)+2 76 ! The usual global physics grid: 1 point for each pole and nbp_lon points 77 ! for all other latitudes 78 klon_glo=nbp_lon*(nbp_lat-2)+2 70 79 endif 71 80 72 COMM_LMDZ_PHY= COMM_LMDZ81 COMM_LMDZ_PHY=communicator 73 82 74 83 IF (is_using_mpi) THEN 75 84 #ifdef CPP_MPI 85 MPI_REAL_LMDZ=MPI_REAL8 76 86 CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr) 77 87 CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr) … … 82 92 ENDIF 83 93 94 ALLOCATE(distrib(0:mpi_size-1)) 95 96 IF (is_using_mpi) THEN 97 #ifdef CPP_MPI 98 CALL MPI_ALLGATHER(nbp,1,MPI_INTEGER,distrib,1,MPI_INTEGER,COMM_LMDZ_PHY,ierr) 99 #endif 100 ELSE 101 distrib(:)=nbp 102 ENDIF 103 104 84 105 IF (mpi_rank == 0) THEN 85 mpi_ root= 0106 mpi_master = 0 86 107 is_mpi_root = .true. 87 108 ENDIF … … 115 136 116 137 117 klon_mpi_para_nb(0:mpi_size-1)=distrib(0: nb_proc-1)138 klon_mpi_para_nb(0:mpi_size-1)=distrib(0:mpi_size-1) 118 139 119 140 DO i=0,mpi_size-1 … … 132 153 ij_para_begin(i) = 1 133 154 ELSE 134 ij_para_begin(i) = klon_mpi_para_begin(i)+ iim-1155 ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1 135 156 ENDIF 136 157 137 jj_para_begin(i) = (ij_para_begin(i)-1)/ iim+ 1138 ii_para_begin(i) = MOD(ij_para_begin(i)-1, iim) + 1158 jj_para_begin(i) = (ij_para_begin(i)-1)/nbp_lon + 1 159 ii_para_begin(i) = MOD(ij_para_begin(i)-1,nbp_lon) + 1 139 160 140 161 141 ij_para_end(i) = klon_mpi_para_end(i)+ iim-1142 jj_para_end(i) = (ij_para_end(i)-1)/ iim+ 1143 ii_para_end(i) = MOD(ij_para_end(i)-1, iim) + 1162 ij_para_end(i) = klon_mpi_para_end(i)+nbp_lon-1 163 jj_para_end(i) = (ij_para_end(i)-1)/nbp_lon + 1 164 ii_para_end(i) = MOD(ij_para_end(i)-1,nbp_lon) + 1 144 165 145 166 … … 166 187 167 188 SUBROUTINE print_module_data 189 USE print_control_mod, ONLY: lunout 168 190 IMPLICIT NONE 169 INCLUDE "iniprint.h"191 ! INCLUDE "iniprint.h" 170 192 171 193 WRITE(lunout,*) 'ii_begin =', ii_begin … … 193 215 WRITE(lunout,*) 'mpi_rank =', mpi_rank 194 216 WRITE(lunout,*) 'mpi_size =', mpi_size 195 WRITE(lunout,*) 'mpi_ root =', mpi_root217 WRITE(lunout,*) 'mpi_master =', mpi_master 196 218 WRITE(lunout,*) 'is_mpi_root =', is_mpi_root 197 219 WRITE(lunout,*) 'is_north_pole =', is_north_pole
Note: See TracChangeset
for help on using the changeset viewer.