source: branches/publications/ORCHIDEE-LEAK-r5919/src_parallel/mod_orchidee_para_var.F90 @ 5925

Last change on this file since 5925 was 1925, checked in by josefine.ghattas, 10 years ago
  • xios : adapted for use with OpenMP (only master thread do call to xios), added coherence check between cpp key XIOS and run time flag
  • mod_orchidee_para : moved declaration part into mod_orchidee_para_var
  • simplifications in the use of modules in src_parallel : only use mod_orchidee_para_var if this is sufficient
  • small corrections for OpenMP
File size: 9.2 KB
Line 
1! ================================================================================================================================
2!  MODULE       : mod_orchidee_para_var
3!
4!  CONTACT      : orchidee-help _at_ ipsl.jussieu.fr
5!
6!  LICENCE      : IPSL (2006)
7!  This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8!
9!>\BRIEF   This module contains public variables for parallelization and domain decomposition
10!!
11!!\n DESCRIPTION: \n
12!!
13!! REFERENCE(S) : None
14!!
15!! SVN          :
16!! $HeadURL: $
17!! $Date: $
18!! $Revision: $
19!! \n
20!_ ================================================================================================================================
21
22MODULE mod_orchidee_para_var
23
24  USE defprec
25
26  !
27  ! 1. Variables related to the MPI parallelization and the MPI horizontal domain decompostion.
28  !    These variables were previously declared in mod_orchidee_mpi_data
29  !
30
31  ! Unit for output messages
32  INTEGER(i_std), SAVE :: numout = 6
33  !$OMP THREADPRIVATE(numout)
34
35  INTEGER,SAVE :: mpi_size                                            !! Number of parallel processes
36  INTEGER,SAVE :: mpi_rank                                            !! my rank num
37  INTEGER,SAVE :: mpi_rank_root                                       !! rank of MPI root
38  LOGICAL,SAVE :: is_mpi_root                                         !! Only MPI root proc is true
39  LOGICAL,SAVE :: is_ok_mpi                                           
40
41  INTEGER(i_std),SAVE              :: nbp_mpi                         !! number of local continental points in each mpi group
42  INTEGER(i_std),SAVE              :: nbp_glo                         !! number of global continental points
43  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para
44  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para_begin
45  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: nbp_mpi_para_end 
46
47  INTEGER,SAVE :: nbp_mpi_begin
48  INTEGER,SAVE :: nbp_mpi_end
49
50
51  INTEGER(i_std),SAVE              :: iim_g                           !! Dimension of global fields for longitude
52  INTEGER(i_std),SAVE              :: jjm_g                           !! Dimension of global fields for latitude
53  ! i x j 2D points (not land points) index
54  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_nb           ! Number of 2D points for each mpi_rank block
55  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_begin        ! First 2D point for each mpi_rank block
56  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_end          ! Last 2D point for each mpi_rank block
57  ! i 2D index
58  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_begin        ! First i index of 2D point for each mpi_rank block
59  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_end          ! Last i index of 2D point for each mpi_rank block
60  ! j 2D index
61  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb           ! Number of complete j lines for each mpi_rank block
62  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_begin        ! First j index of 2D point for each mpi_rank block
63  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_end          ! Last j index of 2D point for each mpi_rank block
64
65  INTEGER,SAVE :: ii_begin
66  INTEGER,SAVE :: ii_end
67  INTEGER,SAVE :: jj_begin
68  INTEGER,SAVE :: jj_end
69  INTEGER,SAVE :: jj_nb
70  INTEGER,SAVE :: ij_begin
71  INTEGER,SAVE :: ij_end
72  INTEGER,SAVE :: ij_nb
73
74  INTEGER,SAVE :: MPI_COMM_ORCH
75  INTEGER,SAVE :: MPI_REAL_ORCH
76  INTEGER,SAVE :: MPI_INT_ORCH
77  LOGICAL, SAVE :: cpl_lmdz
78
79  INTEGER,SAVE,ALLOCATABLE :: kindex_mpi (:)
80  INTEGER,SAVE             :: offset_mpi
81
82
83  !
84  ! 2. Variables related to the OpenMP paralelization and OpenMP horizontal domain decomposition
85  !    These variables were previously declared in mod_orchidee_omp_data
86  !
87
88  ! Check all OpenMP transferts in ORCHIDEE : use this flag to debug synchronism with OpenMP
89  LOGICAL, PARAMETER :: check_all_transfert=.FALSE.
90
91
92  INTEGER(i_std),SAVE :: omp_size
93  INTEGER(i_std),SAVE :: omp_rank
94  LOGICAL,SAVE :: is_omp_root
95  LOGICAL,SAVE :: is_ok_omp
96  !$OMP  THREADPRIVATE(omp_rank,is_omp_root)
97
98  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_nb
99  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_begin
100  INTEGER(i_std),SAVE,DIMENSION(:),ALLOCATABLE :: nbp_omp_para_end   
101
102  INTEGER(i_std),SAVE :: nbp_omp
103  INTEGER(i_std),SAVE :: nbp_omp_begin
104  INTEGER(i_std),SAVE :: nbp_omp_end
105  INTEGER(i_std),SAVE :: offset_omp
106  !$OMP  THREADPRIVATE(nbp_omp,nbp_omp_begin,nbp_omp_end,offset_omp)
107
108  ! Flag for each OMP process for ORCHIDEE to verify synchronization if function Synchro_Omp is used
109  LOGICAL,SAVE,ALLOCATABLE :: proc_synchro_omp(:)
110
111  INTEGER, SAVE :: numout_omp = -1
112  !$OMP  THREADPRIVATE(numout_omp)
113
114  ! For debugging OpenMP processes : id of OMP function for each task.
115  ! If one task is not in the same function, we can see it.
116  INTEGER(i_std),SAVE,ALLOCATABLE,DIMENSION(:) :: omp_function
117  ! It is not SHARED.
118  ! List of values :
119  CHARACTER(LEN=28), PARAMETER :: omp_fct_name(-1:72) = (/ &
120       "Initialization              ", &
121       "Synchro_Omp                 ", &
122       "check_buffer_i              ", &
123       "check_buffer_r              ", &
124       "check_buffer_l              ", &
125       "bcast_omp_c                 ", &
126       "bcast_omp_i                 ", &
127       "bcast_omp_i1                ", &
128       "bcast_omp_i2                ", &
129       "bcast_omp_i3                ", &
130       "bcast_omp_i4                ", &
131       "bcast_omp_r                 ", &
132       "bcast_omp_r1                ", &
133       "bcast_omp_r2                ", &
134       "bcast_omp_r3                ", &
135       "bcast_omp_r4                ", &
136       "bcast_omp_l                 ", &
137       "bcast_omp_l1                ", &
138       "bcast_omp_l2                ", &
139       "bcast_omp_l3                ", &
140       "bcast_omp_l4                ", &
141       "scatter_omp_i               ", &
142       "scatter_omp_i1              ", &
143       "scatter_omp_i2              ", &
144       "scatter_omp_i3              ", &
145       "scatter_omp_r               ", &
146       "scatter_omp_r1              ", &
147       "scatter_omp_r2              ", &
148       "scatter_omp_r3              ", &
149       "scatter_omp_l               ", &
150       "scatter_omp_l1              ", &
151       "scatter_omp_l2              ", &
152       "scatter_omp_l3              ", &
153       "gather_omp_i0               ", &
154       "gather_omp_i                ", &
155       "gather_omp_i1               ", &
156       "gather_omp_i2               ", &
157       "gather_omp_i3               ", &
158       "gather_omp_r0               ", &
159       "gather_omp_r                ", &
160       "gather_omp_r1               ", &
161       "gather_omp_r2               ", &
162       "gather_omp_r3               ", &
163       "gather_omp_l0               ", &
164       "gather_omp_l                ", &
165       "gather_omp_l1               ", &
166       "gather_omp_l2               ", &
167       "gather_omp_l3               ", &
168       "reduce_sum_omp_i            ", &
169       "reduce_sum_omp_i1           ", &
170       "reduce_sum_omp_i2           ", &
171       "reduce_sum_omp_i3           ", &
172       "reduce_sum_omp_i4           ", &
173       "reduce_sum_omp_r            ", &
174       "reduce_sum_omp_r1           ", &
175       "reduce_sum_omp_r2           ", &
176       "reduce_sum_omp_r3           ", &
177       "reduce_sum_omp_r4           ", &
178       "orch_bcast_omp_cgen         ", &
179       "orch_bcast_omp_igen         ", &
180       "orch_bcast_omp_rgen         ", &
181       "orch_bcast_omp_lgen         ", &
182       "orch_scatter_omp_igen       ", &
183       "orch_scatter_omp_rgen       ", &
184       "orch_scatter_omp_lgen       ", &
185       "orch_gather_omp_simple_igen ", &
186       "orch_gather_omp_igen        ", &
187       "orch_gather_omp_simple_rgen ", &
188       "orch_gather_omp_rgen        ", &
189       "orch_gather_omp_simple_lgen ", &
190       "orch_gather_omp_lgen        ", &
191       "orch_reduce_sum_omp_igen    ", &
192       "orch_reduce_sum_omp_rgen    ", &
193       "check_buffer_c              " /)
194
195  ! Previous value for own omp_function
196  INTEGER, SAVE :: omp_previous
197  !$OMP  THREADPRIVATE(omp_previous)
198
199  !
200  !! 3. Variables previously declared in mod_orchide_para
201  !
202
203  INTEGER,SAVE :: nbp_loc                                             !! number of local continental points
204  !$OMP THREADPRIVATE(nbp_loc)
205  INTEGER,SAVE :: offset
206  !$OMP THREADPRIVATE(offset)
207
208  LOGICAL,SAVE :: is_root_prc = .FALSE.                               !! Only root proc for MPI and OpenMP is true
209  !$OMP THREADPRIVATE(is_root_prc)
210
211  !! Global array used by stomate and sechiba
212  !-
213  !! index of land points on the 2D map
214  INTEGER(i_std),ALLOCATABLE,DIMENSION(:),SAVE   :: index_g
215  !-
216  !! indices of the 4 neighbours of each grid point (1=N, 2=E, 3=S, 4=W)
217  INTEGER(i_std),ALLOCATABLE,DIMENSION(:,:),SAVE :: neighbours_g
218  !-
219  !! resolution at each grid point in m (1=E-W, 2=N-S)
220  REAL(r_std),ALLOCATABLE,DIMENSION(:,:),SAVE    :: resolution_g 
221  REAL(r_std),ALLOCATABLE,DIMENSION(:),SAVE    :: area_g 
222  !-
223  !! Geographical coordinates
224  REAL(r_std),ALLOCATABLE,DIMENSION(:,:),SAVE    :: lalo_g
225  ! Global grid, for all process
226  REAL(r_std), ALLOCATABLE, DIMENSION(:,:), SAVE     :: lon_g, lat_g, zlev_g
227  !-
228  !! Fraction of continents
229  REAL(r_std),ALLOCATABLE,DIMENSION(:),SAVE      :: contfrac_g 
230
231
232END MODULE mod_orchidee_para_var
Note: See TracBrowser for help on using the repository browser.