1 | ! |
---|
2 | !$Header$ |
---|
3 | ! |
---|
4 | MODULE mod_phys_lmdz_omp_transfert |
---|
5 | |
---|
6 | PRIVATE |
---|
7 | |
---|
8 | REAL,PARAMETER :: grow_factor=1.5 |
---|
9 | INTEGER,PARAMETER :: size_min=1024 |
---|
10 | |
---|
11 | CHARACTER(LEN=size_min),SAVE :: buffer_c |
---|
12 | ! INTEGER,SAVE :: size_c=0 |
---|
13 | INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: buffer_i |
---|
14 | INTEGER,SAVE :: size_i=0 |
---|
15 | REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: buffer_r |
---|
16 | INTEGER,SAVE :: size_r=0 |
---|
17 | LOGICAL,SAVE,ALLOCATABLE,DIMENSION(:) :: buffer_l |
---|
18 | INTEGER,SAVE :: size_l=0 |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | INTERFACE bcast_omp |
---|
24 | MODULE PROCEDURE bcast_omp_c, & |
---|
25 | bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, & |
---|
26 | bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, & |
---|
27 | bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4 |
---|
28 | END INTERFACE |
---|
29 | |
---|
30 | INTERFACE scatter_omp |
---|
31 | MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, & |
---|
32 | scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, & |
---|
33 | scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3 |
---|
34 | END INTERFACE |
---|
35 | |
---|
36 | |
---|
37 | INTERFACE gather_omp |
---|
38 | MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, & |
---|
39 | gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, & |
---|
40 | gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3 |
---|
41 | END INTERFACE |
---|
42 | |
---|
43 | |
---|
44 | INTERFACE reduce_sum_omp |
---|
45 | MODULE PROCEDURE reduce_sum_omp_i,reduce_sum_omp_i1,reduce_sum_omp_i2,reduce_sum_omp_i3,reduce_sum_omp_i4, & |
---|
46 | reduce_sum_omp_r,reduce_sum_omp_r1,reduce_sum_omp_r2,reduce_sum_omp_r3,reduce_sum_omp_r4 |
---|
47 | END INTERFACE |
---|
48 | |
---|
49 | INTERFACE reduce_min_omp |
---|
50 | MODULE PROCEDURE reduce_min_omp_i,reduce_min_omp_i1,reduce_min_omp_i2,reduce_min_omp_i3,reduce_min_omp_i4, & |
---|
51 | reduce_min_omp_r,reduce_min_omp_r1,reduce_min_omp_r2,reduce_min_omp_r3,reduce_min_omp_r4 |
---|
52 | END INTERFACE |
---|
53 | |
---|
54 | |
---|
55 | PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, reduce_min_omp |
---|
56 | |
---|
57 | CONTAINS |
---|
58 | |
---|
59 | SUBROUTINE check_buffer_i(buff_size) |
---|
60 | IMPLICIT NONE |
---|
61 | INTEGER :: buff_size |
---|
62 | |
---|
63 | !$OMP BARRIER |
---|
64 | !$OMP MASTER |
---|
65 | IF (buff_size>size_i) THEN |
---|
66 | IF (ALLOCATED(buffer_i)) DEALLOCATE(buffer_i) |
---|
67 | size_i=MAX(size_min,INT(grow_factor*buff_size)) |
---|
68 | ALLOCATE(buffer_i(size_i)) |
---|
69 | ENDIF |
---|
70 | !$OMP END MASTER |
---|
71 | !$OMP BARRIER |
---|
72 | |
---|
73 | END SUBROUTINE check_buffer_i |
---|
74 | |
---|
75 | SUBROUTINE check_buffer_r(buff_size) |
---|
76 | IMPLICIT NONE |
---|
77 | INTEGER :: buff_size |
---|
78 | |
---|
79 | !$OMP BARRIER |
---|
80 | !$OMP MASTER |
---|
81 | IF (buff_size>size_r) THEN |
---|
82 | IF (ALLOCATED(buffer_r)) DEALLOCATE(buffer_r) |
---|
83 | size_r=MAX(size_min,INT(grow_factor*buff_size)) |
---|
84 | ALLOCATE(buffer_r(size_r)) |
---|
85 | ENDIF |
---|
86 | !$OMP END MASTER |
---|
87 | !$OMP BARRIER |
---|
88 | |
---|
89 | END SUBROUTINE check_buffer_r |
---|
90 | |
---|
91 | SUBROUTINE check_buffer_l(buff_size) |
---|
92 | IMPLICIT NONE |
---|
93 | INTEGER :: buff_size |
---|
94 | |
---|
95 | !$OMP BARRIER |
---|
96 | !$OMP MASTER |
---|
97 | IF (buff_size>size_l) THEN |
---|
98 | IF (ALLOCATED(buffer_l)) DEALLOCATE(buffer_l) |
---|
99 | size_l=MAX(size_min,INT(grow_factor*buff_size)) |
---|
100 | ALLOCATE(buffer_l(size_l)) |
---|
101 | ENDIF |
---|
102 | !$OMP END MASTER |
---|
103 | !$OMP BARRIER |
---|
104 | |
---|
105 | END SUBROUTINE check_buffer_l |
---|
106 | |
---|
107 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
108 | !! Definition des Broadcast --> 4D !! |
---|
109 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
110 | |
---|
111 | !! -- Les chaine de charact�re -- !! |
---|
112 | |
---|
113 | SUBROUTINE bcast_omp_c(var) |
---|
114 | IMPLICIT NONE |
---|
115 | CHARACTER(LEN=*),INTENT(INOUT) :: Var |
---|
116 | |
---|
117 | CALL bcast_omp_cgen(Var,len(Var),buffer_c) |
---|
118 | |
---|
119 | END SUBROUTINE bcast_omp_c |
---|
120 | |
---|
121 | !! -- Les entiers -- !! |
---|
122 | |
---|
123 | SUBROUTINE bcast_omp_i(var) |
---|
124 | IMPLICIT NONE |
---|
125 | INTEGER,INTENT(INOUT) :: Var |
---|
126 | INTEGER :: Var_tmp(1) |
---|
127 | |
---|
128 | Var_tmp(1)=Var |
---|
129 | CALL check_buffer_i(1) |
---|
130 | CALL bcast_omp_igen(Var_tmp,1,buffer_i) |
---|
131 | Var=Var_tmp(1) |
---|
132 | |
---|
133 | END SUBROUTINE bcast_omp_i |
---|
134 | |
---|
135 | |
---|
136 | SUBROUTINE bcast_omp_i1(var) |
---|
137 | IMPLICIT NONE |
---|
138 | INTEGER,INTENT(INOUT) :: Var(:) |
---|
139 | |
---|
140 | CALL check_buffer_i(size(Var)) |
---|
141 | CALL bcast_omp_igen(Var,size(Var),buffer_i) |
---|
142 | |
---|
143 | END SUBROUTINE bcast_omp_i1 |
---|
144 | |
---|
145 | |
---|
146 | SUBROUTINE bcast_omp_i2(var) |
---|
147 | IMPLICIT NONE |
---|
148 | INTEGER,INTENT(INOUT) :: Var(:,:) |
---|
149 | |
---|
150 | CALL check_buffer_i(size(Var)) |
---|
151 | CALL bcast_omp_igen(Var,size(Var),buffer_i) |
---|
152 | |
---|
153 | END SUBROUTINE bcast_omp_i2 |
---|
154 | |
---|
155 | |
---|
156 | SUBROUTINE bcast_omp_i3(var) |
---|
157 | IMPLICIT NONE |
---|
158 | INTEGER,INTENT(INOUT) :: Var(:,:,:) |
---|
159 | |
---|
160 | CALL check_buffer_i(size(Var)) |
---|
161 | CALL bcast_omp_igen(Var,size(Var),buffer_i) |
---|
162 | |
---|
163 | END SUBROUTINE bcast_omp_i3 |
---|
164 | |
---|
165 | |
---|
166 | SUBROUTINE bcast_omp_i4(var) |
---|
167 | IMPLICIT NONE |
---|
168 | INTEGER,INTENT(INOUT) :: Var(:,:,:,:) |
---|
169 | |
---|
170 | CALL check_buffer_i(size(Var)) |
---|
171 | CALL bcast_omp_igen(Var,size(Var),buffer_i) |
---|
172 | |
---|
173 | END SUBROUTINE bcast_omp_i4 |
---|
174 | |
---|
175 | |
---|
176 | !! -- Les reels -- !! |
---|
177 | |
---|
178 | SUBROUTINE bcast_omp_r(var) |
---|
179 | IMPLICIT NONE |
---|
180 | REAL,INTENT(INOUT) :: Var |
---|
181 | REAL :: Var_tmp(1) |
---|
182 | |
---|
183 | Var_tmp(1)=Var |
---|
184 | CALL check_buffer_r(1) |
---|
185 | CALL bcast_omp_rgen(Var_tmp,1,buffer_r) |
---|
186 | Var=Var_tmp(1) |
---|
187 | |
---|
188 | END SUBROUTINE bcast_omp_r |
---|
189 | |
---|
190 | |
---|
191 | SUBROUTINE bcast_omp_r1(var) |
---|
192 | IMPLICIT NONE |
---|
193 | REAL,INTENT(INOUT) :: Var(:) |
---|
194 | |
---|
195 | CALL check_buffer_r(size(Var)) |
---|
196 | CALL bcast_omp_rgen(Var,size(Var),buffer_r) |
---|
197 | |
---|
198 | END SUBROUTINE bcast_omp_r1 |
---|
199 | |
---|
200 | |
---|
201 | SUBROUTINE bcast_omp_r2(var) |
---|
202 | IMPLICIT NONE |
---|
203 | REAL,INTENT(INOUT) :: Var(:,:) |
---|
204 | |
---|
205 | CALL check_buffer_r(size(Var)) |
---|
206 | CALL bcast_omp_rgen(Var,size(Var),buffer_r) |
---|
207 | |
---|
208 | END SUBROUTINE bcast_omp_r2 |
---|
209 | |
---|
210 | |
---|
211 | SUBROUTINE bcast_omp_r3(var) |
---|
212 | IMPLICIT NONE |
---|
213 | REAL,INTENT(INOUT) :: Var(:,:,:) |
---|
214 | |
---|
215 | CALL check_buffer_r(size(Var)) |
---|
216 | CALL bcast_omp_rgen(Var,size(Var),buffer_r) |
---|
217 | |
---|
218 | END SUBROUTINE bcast_omp_r3 |
---|
219 | |
---|
220 | |
---|
221 | SUBROUTINE bcast_omp_r4(var) |
---|
222 | IMPLICIT NONE |
---|
223 | REAL,INTENT(INOUT) :: Var(:,:,:,:) |
---|
224 | |
---|
225 | CALL check_buffer_r(size(Var)) |
---|
226 | CALL bcast_omp_rgen(Var,size(Var),buffer_r) |
---|
227 | |
---|
228 | END SUBROUTINE bcast_omp_r4 |
---|
229 | |
---|
230 | |
---|
231 | !! -- Les booleans -- !! |
---|
232 | |
---|
233 | SUBROUTINE bcast_omp_l(var) |
---|
234 | IMPLICIT NONE |
---|
235 | LOGICAL,INTENT(INOUT) :: Var |
---|
236 | LOGICAL :: Var_tmp(1) |
---|
237 | |
---|
238 | Var_tmp(1)=Var |
---|
239 | CALL check_buffer_l(1) |
---|
240 | CALL bcast_omp_lgen(Var_tmp,1,buffer_l) |
---|
241 | Var=Var_tmp(1) |
---|
242 | |
---|
243 | END SUBROUTINE bcast_omp_l |
---|
244 | |
---|
245 | |
---|
246 | SUBROUTINE bcast_omp_l1(var) |
---|
247 | IMPLICIT NONE |
---|
248 | LOGICAL,INTENT(INOUT) :: Var(:) |
---|
249 | |
---|
250 | CALL check_buffer_l(size(Var)) |
---|
251 | CALL bcast_omp_lgen(Var,size(Var),buffer_l) |
---|
252 | |
---|
253 | END SUBROUTINE bcast_omp_l1 |
---|
254 | |
---|
255 | |
---|
256 | SUBROUTINE bcast_omp_l2(var) |
---|
257 | IMPLICIT NONE |
---|
258 | LOGICAL,INTENT(INOUT) :: Var(:,:) |
---|
259 | |
---|
260 | CALL check_buffer_l(size(Var)) |
---|
261 | CALL bcast_omp_lgen(Var,size(Var),buffer_l) |
---|
262 | |
---|
263 | END SUBROUTINE bcast_omp_l2 |
---|
264 | |
---|
265 | |
---|
266 | SUBROUTINE bcast_omp_l3(var) |
---|
267 | IMPLICIT NONE |
---|
268 | LOGICAL,INTENT(INOUT) :: Var(:,:,:) |
---|
269 | |
---|
270 | CALL check_buffer_l(size(Var)) |
---|
271 | CALL bcast_omp_lgen(Var,size(Var),buffer_l) |
---|
272 | |
---|
273 | END SUBROUTINE bcast_omp_l3 |
---|
274 | |
---|
275 | |
---|
276 | SUBROUTINE bcast_omp_l4(var) |
---|
277 | IMPLICIT NONE |
---|
278 | LOGICAL,INTENT(INOUT) :: Var(:,:,:,:) |
---|
279 | |
---|
280 | CALL check_buffer_l(size(Var)) |
---|
281 | CALL bcast_omp_lgen(Var,size(Var),buffer_l) |
---|
282 | |
---|
283 | END SUBROUTINE bcast_omp_l4 |
---|
284 | |
---|
285 | |
---|
286 | |
---|
287 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
288 | !! Definition des Scatter --> 4D !! |
---|
289 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
290 | |
---|
291 | SUBROUTINE scatter_omp_i(VarIn, VarOut) |
---|
292 | IMPLICIT NONE |
---|
293 | |
---|
294 | INTEGER,INTENT(IN),DIMENSION(:) :: VarIn |
---|
295 | INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
296 | |
---|
297 | CALL Check_buffer_i(size(VarIn)) |
---|
298 | CALL scatter_omp_igen(VarIn,Varout,1,buffer_i) |
---|
299 | |
---|
300 | END SUBROUTINE scatter_omp_i |
---|
301 | |
---|
302 | |
---|
303 | SUBROUTINE scatter_omp_i1(VarIn, VarOut) |
---|
304 | IMPLICIT NONE |
---|
305 | |
---|
306 | INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
307 | INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
308 | |
---|
309 | CALL Check_buffer_i(size(VarIn)) |
---|
310 | CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2),buffer_i) |
---|
311 | |
---|
312 | END SUBROUTINE scatter_omp_i1 |
---|
313 | |
---|
314 | |
---|
315 | SUBROUTINE scatter_omp_i2(VarIn, VarOut) |
---|
316 | IMPLICIT NONE |
---|
317 | |
---|
318 | INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
319 | INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
320 | |
---|
321 | CALL Check_buffer_i(size(VarIn)) |
---|
322 | CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_i) |
---|
323 | |
---|
324 | END SUBROUTINE scatter_omp_i2 |
---|
325 | |
---|
326 | |
---|
327 | SUBROUTINE scatter_omp_i3(VarIn, VarOut) |
---|
328 | IMPLICIT NONE |
---|
329 | |
---|
330 | INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
331 | INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
332 | |
---|
333 | CALL Check_buffer_i(size(VarIn)) |
---|
334 | CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_i) |
---|
335 | |
---|
336 | END SUBROUTINE scatter_omp_i3 |
---|
337 | |
---|
338 | |
---|
339 | |
---|
340 | |
---|
341 | SUBROUTINE scatter_omp_r(VarIn, VarOut) |
---|
342 | IMPLICIT NONE |
---|
343 | |
---|
344 | REAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
345 | REAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
346 | |
---|
347 | CALL Check_buffer_r(size(VarIn)) |
---|
348 | CALL scatter_omp_rgen(VarIn,Varout,1,buffer_r) |
---|
349 | |
---|
350 | END SUBROUTINE scatter_omp_r |
---|
351 | |
---|
352 | |
---|
353 | SUBROUTINE scatter_omp_r1(VarIn, VarOut) |
---|
354 | IMPLICIT NONE |
---|
355 | |
---|
356 | REAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
357 | REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
358 | |
---|
359 | CALL Check_buffer_r(size(VarIn)) |
---|
360 | CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2),buffer_r) |
---|
361 | |
---|
362 | END SUBROUTINE scatter_omp_r1 |
---|
363 | |
---|
364 | |
---|
365 | SUBROUTINE scatter_omp_r2(VarIn, VarOut) |
---|
366 | IMPLICIT NONE |
---|
367 | |
---|
368 | REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
369 | REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
370 | |
---|
371 | CALL Check_buffer_r(size(VarIn)) |
---|
372 | CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_r) |
---|
373 | |
---|
374 | END SUBROUTINE scatter_omp_r2 |
---|
375 | |
---|
376 | |
---|
377 | SUBROUTINE scatter_omp_r3(VarIn, VarOut) |
---|
378 | IMPLICIT NONE |
---|
379 | |
---|
380 | REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
381 | REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
382 | |
---|
383 | CALL Check_buffer_r(size(VarIn)) |
---|
384 | CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_r) |
---|
385 | |
---|
386 | END SUBROUTINE scatter_omp_r3 |
---|
387 | |
---|
388 | |
---|
389 | |
---|
390 | SUBROUTINE scatter_omp_l(VarIn, VarOut) |
---|
391 | IMPLICIT NONE |
---|
392 | |
---|
393 | LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
394 | LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
395 | |
---|
396 | CALL Check_buffer_l(size(VarIn)) |
---|
397 | CALL scatter_omp_lgen(VarIn,Varout,1,buffer_l) |
---|
398 | |
---|
399 | END SUBROUTINE scatter_omp_l |
---|
400 | |
---|
401 | |
---|
402 | SUBROUTINE scatter_omp_l1(VarIn, VarOut) |
---|
403 | IMPLICIT NONE |
---|
404 | |
---|
405 | LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
406 | LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
407 | |
---|
408 | CALL Check_buffer_l(size(VarIn)) |
---|
409 | CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2),buffer_l) |
---|
410 | |
---|
411 | END SUBROUTINE scatter_omp_l1 |
---|
412 | |
---|
413 | |
---|
414 | SUBROUTINE scatter_omp_l2(VarIn, VarOut) |
---|
415 | IMPLICIT NONE |
---|
416 | |
---|
417 | LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
418 | LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
419 | |
---|
420 | CALL Check_buffer_l(size(VarIn)) |
---|
421 | CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_l) |
---|
422 | |
---|
423 | END SUBROUTINE scatter_omp_l2 |
---|
424 | |
---|
425 | |
---|
426 | SUBROUTINE scatter_omp_l3(VarIn, VarOut) |
---|
427 | IMPLICIT NONE |
---|
428 | |
---|
429 | LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
430 | LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
431 | |
---|
432 | CALL Check_buffer_l(size(VarIn)) |
---|
433 | CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_l) |
---|
434 | |
---|
435 | END SUBROUTINE scatter_omp_l3 |
---|
436 | |
---|
437 | |
---|
438 | SUBROUTINE gather_omp_i(VarIn, VarOut) |
---|
439 | IMPLICIT NONE |
---|
440 | |
---|
441 | INTEGER,INTENT(IN),DIMENSION(:) :: VarIn |
---|
442 | INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
443 | |
---|
444 | CALL Check_buffer_i(size(VarOut)) |
---|
445 | CALL gather_omp_igen(VarIn,Varout,1,buffer_i) |
---|
446 | |
---|
447 | END SUBROUTINE gather_omp_i |
---|
448 | |
---|
449 | |
---|
450 | SUBROUTINE gather_omp_i1(VarIn, VarOut) |
---|
451 | IMPLICIT NONE |
---|
452 | |
---|
453 | INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
454 | INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
455 | |
---|
456 | CALL Check_buffer_i(size(VarOut)) |
---|
457 | CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2),buffer_i) |
---|
458 | |
---|
459 | END SUBROUTINE gather_omp_i1 |
---|
460 | |
---|
461 | |
---|
462 | SUBROUTINE gather_omp_i2(VarIn, VarOut) |
---|
463 | IMPLICIT NONE |
---|
464 | |
---|
465 | INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
466 | INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
467 | |
---|
468 | CALL Check_buffer_i(size(VarOut)) |
---|
469 | CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_i) |
---|
470 | |
---|
471 | END SUBROUTINE gather_omp_i2 |
---|
472 | |
---|
473 | |
---|
474 | SUBROUTINE gather_omp_i3(VarIn, VarOut) |
---|
475 | IMPLICIT NONE |
---|
476 | |
---|
477 | INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
478 | INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
479 | |
---|
480 | CALL Check_buffer_i(size(VarOut)) |
---|
481 | CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_i) |
---|
482 | |
---|
483 | END SUBROUTINE gather_omp_i3 |
---|
484 | |
---|
485 | |
---|
486 | |
---|
487 | SUBROUTINE gather_omp_r(VarIn, VarOut) |
---|
488 | IMPLICIT NONE |
---|
489 | |
---|
490 | REAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
491 | REAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
492 | |
---|
493 | CALL gather_omp_rgen(VarIn,Varout,1) |
---|
494 | |
---|
495 | END SUBROUTINE gather_omp_r |
---|
496 | |
---|
497 | |
---|
498 | SUBROUTINE gather_omp_r1(VarIn, VarOut) |
---|
499 | IMPLICIT NONE |
---|
500 | |
---|
501 | REAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
502 | REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
503 | |
---|
504 | CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)) |
---|
505 | |
---|
506 | END SUBROUTINE gather_omp_r1 |
---|
507 | |
---|
508 | |
---|
509 | SUBROUTINE gather_omp_r2(VarIn, VarOut) |
---|
510 | IMPLICIT NONE |
---|
511 | |
---|
512 | REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
513 | REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
514 | |
---|
515 | CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)) |
---|
516 | |
---|
517 | END SUBROUTINE gather_omp_r2 |
---|
518 | |
---|
519 | |
---|
520 | SUBROUTINE gather_omp_r3(VarIn, VarOut) |
---|
521 | IMPLICIT NONE |
---|
522 | |
---|
523 | REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
524 | REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
525 | |
---|
526 | CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4)) |
---|
527 | |
---|
528 | END SUBROUTINE gather_omp_r3 |
---|
529 | |
---|
530 | |
---|
531 | SUBROUTINE gather_omp_l(VarIn, VarOut) |
---|
532 | IMPLICIT NONE |
---|
533 | |
---|
534 | LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
535 | LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
536 | |
---|
537 | CALL Check_buffer_l(size(VarOut)) |
---|
538 | CALL gather_omp_lgen(VarIn,Varout,1,buffer_l) |
---|
539 | |
---|
540 | END SUBROUTINE gather_omp_l |
---|
541 | |
---|
542 | |
---|
543 | SUBROUTINE gather_omp_l1(VarIn, VarOut) |
---|
544 | IMPLICIT NONE |
---|
545 | |
---|
546 | LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
547 | LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
548 | |
---|
549 | CALL Check_buffer_l(size(VarOut)) |
---|
550 | CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2),buffer_l) |
---|
551 | |
---|
552 | END SUBROUTINE gather_omp_l1 |
---|
553 | |
---|
554 | |
---|
555 | SUBROUTINE gather_omp_l2(VarIn, VarOut) |
---|
556 | IMPLICIT NONE |
---|
557 | |
---|
558 | LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
559 | LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
560 | |
---|
561 | CALL Check_buffer_l(size(VarOut)) |
---|
562 | CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_l) |
---|
563 | |
---|
564 | END SUBROUTINE gather_omp_l2 |
---|
565 | |
---|
566 | |
---|
567 | SUBROUTINE gather_omp_l3(VarIn, VarOut) |
---|
568 | IMPLICIT NONE |
---|
569 | |
---|
570 | LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
571 | LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
572 | |
---|
573 | CALL Check_buffer_l(size(VarOut)) |
---|
574 | CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_l) |
---|
575 | |
---|
576 | END SUBROUTINE gather_omp_l3 |
---|
577 | |
---|
578 | |
---|
579 | |
---|
580 | |
---|
581 | SUBROUTINE reduce_sum_omp_i(VarIn, VarOut) |
---|
582 | IMPLICIT NONE |
---|
583 | |
---|
584 | INTEGER,INTENT(IN) :: VarIn |
---|
585 | INTEGER,INTENT(OUT) :: VarOut |
---|
586 | INTEGER :: VarIn_tmp(1) |
---|
587 | INTEGER :: VarOut_tmp(1) |
---|
588 | |
---|
589 | VarIn_tmp(1)=VarIn |
---|
590 | CALL Check_buffer_i(1) |
---|
591 | CALL reduce_sum_omp_igen(VarIn_tmp,Varout_tmp,1,buffer_i) |
---|
592 | VarOut=VarOut_tmp(1) |
---|
593 | |
---|
594 | END SUBROUTINE reduce_sum_omp_i |
---|
595 | |
---|
596 | SUBROUTINE reduce_sum_omp_i1(VarIn, VarOut) |
---|
597 | IMPLICIT NONE |
---|
598 | |
---|
599 | INTEGER,INTENT(IN),DIMENSION(:) :: VarIn |
---|
600 | INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
601 | |
---|
602 | CALL Check_buffer_i(size(VarIn)) |
---|
603 | CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
604 | |
---|
605 | END SUBROUTINE reduce_sum_omp_i1 |
---|
606 | |
---|
607 | |
---|
608 | SUBROUTINE reduce_sum_omp_i2(VarIn, VarOut) |
---|
609 | IMPLICIT NONE |
---|
610 | |
---|
611 | INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
612 | INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
613 | |
---|
614 | CALL Check_buffer_i(size(VarIn)) |
---|
615 | CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
616 | |
---|
617 | END SUBROUTINE reduce_sum_omp_i2 |
---|
618 | |
---|
619 | |
---|
620 | SUBROUTINE reduce_sum_omp_i3(VarIn, VarOut) |
---|
621 | IMPLICIT NONE |
---|
622 | |
---|
623 | INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
624 | INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
625 | |
---|
626 | CALL Check_buffer_i(size(VarIn)) |
---|
627 | CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
628 | |
---|
629 | END SUBROUTINE reduce_sum_omp_i3 |
---|
630 | |
---|
631 | |
---|
632 | SUBROUTINE reduce_sum_omp_i4(VarIn, VarOut) |
---|
633 | IMPLICIT NONE |
---|
634 | |
---|
635 | INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
636 | INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
637 | |
---|
638 | CALL Check_buffer_i(size(VarIn)) |
---|
639 | CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
640 | |
---|
641 | END SUBROUTINE reduce_sum_omp_i4 |
---|
642 | |
---|
643 | |
---|
644 | SUBROUTINE reduce_sum_omp_r(VarIn, VarOut) |
---|
645 | IMPLICIT NONE |
---|
646 | |
---|
647 | REAL,INTENT(IN) :: VarIn |
---|
648 | REAL,INTENT(OUT) :: VarOut |
---|
649 | REAL :: VarIn_tmp(1) |
---|
650 | REAL :: VarOut_tmp(1) |
---|
651 | |
---|
652 | VarIn_tmp(1)=VarIn |
---|
653 | CALL Check_buffer_r(1) |
---|
654 | CALL reduce_sum_omp_rgen(VarIn_tmp,Varout_tmp,1,buffer_r) |
---|
655 | VarOut=VarOut_tmp(1) |
---|
656 | |
---|
657 | END SUBROUTINE reduce_sum_omp_r |
---|
658 | |
---|
659 | SUBROUTINE reduce_sum_omp_r1(VarIn, VarOut) |
---|
660 | IMPLICIT NONE |
---|
661 | |
---|
662 | REAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
663 | REAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
664 | |
---|
665 | CALL Check_buffer_r(size(VarIn)) |
---|
666 | CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
667 | |
---|
668 | END SUBROUTINE reduce_sum_omp_r1 |
---|
669 | |
---|
670 | |
---|
671 | SUBROUTINE reduce_sum_omp_r2(VarIn, VarOut) |
---|
672 | IMPLICIT NONE |
---|
673 | |
---|
674 | REAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
675 | REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
676 | |
---|
677 | CALL Check_buffer_r(size(VarIn)) |
---|
678 | CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
679 | |
---|
680 | END SUBROUTINE reduce_sum_omp_r2 |
---|
681 | |
---|
682 | |
---|
683 | SUBROUTINE reduce_sum_omp_r3(VarIn, VarOut) |
---|
684 | IMPLICIT NONE |
---|
685 | |
---|
686 | REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
687 | REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
688 | |
---|
689 | CALL Check_buffer_r(size(VarIn)) |
---|
690 | CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
691 | |
---|
692 | END SUBROUTINE reduce_sum_omp_r3 |
---|
693 | |
---|
694 | |
---|
695 | SUBROUTINE reduce_sum_omp_r4(VarIn, VarOut) |
---|
696 | IMPLICIT NONE |
---|
697 | |
---|
698 | REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
699 | REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
700 | |
---|
701 | CALL Check_buffer_r(size(VarIn)) |
---|
702 | CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
703 | |
---|
704 | END SUBROUTINE reduce_sum_omp_r4 |
---|
705 | |
---|
706 | |
---|
707 | |
---|
708 | SUBROUTINE reduce_min_omp_i(VarIn, VarOut) |
---|
709 | IMPLICIT NONE |
---|
710 | |
---|
711 | INTEGER,INTENT(IN) :: VarIn |
---|
712 | INTEGER,INTENT(OUT) :: VarOut |
---|
713 | INTEGER :: VarIn_tmp(1) |
---|
714 | INTEGER :: VarOut_tmp(1) |
---|
715 | |
---|
716 | VarIn_tmp(1)=VarIn |
---|
717 | CALL Check_buffer_i(1) |
---|
718 | CALL reduce_min_omp_igen(VarIn_tmp,Varout_tmp,1,buffer_i) |
---|
719 | VarOut=VarOut_tmp(1) |
---|
720 | |
---|
721 | END SUBROUTINE reduce_min_omp_i |
---|
722 | |
---|
723 | SUBROUTINE reduce_min_omp_i1(VarIn, VarOut) |
---|
724 | IMPLICIT NONE |
---|
725 | |
---|
726 | INTEGER,INTENT(IN),DIMENSION(:) :: VarIn |
---|
727 | INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
728 | |
---|
729 | CALL Check_buffer_i(size(VarIn)) |
---|
730 | CALL reduce_min_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
731 | |
---|
732 | END SUBROUTINE reduce_min_omp_i1 |
---|
733 | |
---|
734 | |
---|
735 | SUBROUTINE reduce_min_omp_i2(VarIn, VarOut) |
---|
736 | IMPLICIT NONE |
---|
737 | |
---|
738 | INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
739 | INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
740 | |
---|
741 | CALL Check_buffer_i(size(VarIn)) |
---|
742 | CALL reduce_min_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
743 | |
---|
744 | END SUBROUTINE reduce_min_omp_i2 |
---|
745 | |
---|
746 | |
---|
747 | SUBROUTINE reduce_min_omp_i3(VarIn, VarOut) |
---|
748 | IMPLICIT NONE |
---|
749 | |
---|
750 | INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
751 | INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
752 | |
---|
753 | CALL Check_buffer_i(size(VarIn)) |
---|
754 | CALL reduce_min_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
755 | |
---|
756 | END SUBROUTINE reduce_min_omp_i3 |
---|
757 | |
---|
758 | |
---|
759 | SUBROUTINE reduce_min_omp_i4(VarIn, VarOut) |
---|
760 | IMPLICIT NONE |
---|
761 | |
---|
762 | INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
763 | INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
764 | |
---|
765 | CALL Check_buffer_i(size(VarIn)) |
---|
766 | CALL reduce_min_omp_igen(VarIn,Varout,Size(VarIn),buffer_i) |
---|
767 | |
---|
768 | END SUBROUTINE reduce_min_omp_i4 |
---|
769 | |
---|
770 | |
---|
771 | SUBROUTINE reduce_min_omp_r(VarIn, VarOut) |
---|
772 | IMPLICIT NONE |
---|
773 | |
---|
774 | REAL,INTENT(IN) :: VarIn |
---|
775 | REAL,INTENT(OUT) :: VarOut |
---|
776 | REAL :: VarIn_tmp(1) |
---|
777 | REAL :: VarOut_tmp(1) |
---|
778 | |
---|
779 | VarIn_tmp(1)=VarIn |
---|
780 | CALL Check_buffer_r(1) |
---|
781 | CALL reduce_min_omp_rgen(VarIn_tmp,Varout_tmp,1,buffer_r) |
---|
782 | VarOut=VarOut_tmp(1) |
---|
783 | |
---|
784 | END SUBROUTINE reduce_min_omp_r |
---|
785 | |
---|
786 | SUBROUTINE reduce_min_omp_r1(VarIn, VarOut) |
---|
787 | IMPLICIT NONE |
---|
788 | |
---|
789 | REAL,INTENT(IN),DIMENSION(:) :: VarIn |
---|
790 | REAL,INTENT(OUT),DIMENSION(:) :: VarOut |
---|
791 | |
---|
792 | CALL Check_buffer_r(size(VarIn)) |
---|
793 | CALL reduce_min_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
794 | |
---|
795 | END SUBROUTINE reduce_min_omp_r1 |
---|
796 | |
---|
797 | |
---|
798 | SUBROUTINE reduce_min_omp_r2(VarIn, VarOut) |
---|
799 | IMPLICIT NONE |
---|
800 | |
---|
801 | REAL,INTENT(IN),DIMENSION(:,:) :: VarIn |
---|
802 | REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut |
---|
803 | |
---|
804 | CALL Check_buffer_r(size(VarIn)) |
---|
805 | CALL reduce_min_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
806 | |
---|
807 | END SUBROUTINE reduce_min_omp_r2 |
---|
808 | |
---|
809 | |
---|
810 | SUBROUTINE reduce_min_omp_r3(VarIn, VarOut) |
---|
811 | IMPLICIT NONE |
---|
812 | |
---|
813 | REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn |
---|
814 | REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut |
---|
815 | |
---|
816 | CALL Check_buffer_r(size(VarIn)) |
---|
817 | CALL reduce_min_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
818 | |
---|
819 | END SUBROUTINE reduce_min_omp_r3 |
---|
820 | |
---|
821 | |
---|
822 | SUBROUTINE reduce_min_omp_r4(VarIn, VarOut) |
---|
823 | IMPLICIT NONE |
---|
824 | |
---|
825 | REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn |
---|
826 | REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut |
---|
827 | |
---|
828 | CALL Check_buffer_r(size(VarIn)) |
---|
829 | CALL reduce_min_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r) |
---|
830 | |
---|
831 | END SUBROUTINE reduce_min_omp_r4 |
---|
832 | |
---|
833 | |
---|
834 | |
---|
835 | |
---|
836 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
837 | ! LES ROUTINES GENERIQUES ! |
---|
838 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
839 | |
---|
840 | SUBROUTINE bcast_omp_cgen(Var,Nb,Buff) |
---|
841 | IMPLICIT NONE |
---|
842 | |
---|
843 | CHARACTER(LEN=*),INTENT(INOUT) :: Var |
---|
844 | CHARACTER(LEN=*),INTENT(INOUT) :: Buff |
---|
845 | INTEGER,INTENT(IN) :: Nb |
---|
846 | |
---|
847 | INTEGER :: i |
---|
848 | |
---|
849 | !$OMP MASTER |
---|
850 | Buff=Var |
---|
851 | !$OMP END MASTER |
---|
852 | !$OMP BARRIER |
---|
853 | |
---|
854 | DO i=1,Nb |
---|
855 | Var=Buff |
---|
856 | ENDDO |
---|
857 | !$OMP BARRIER |
---|
858 | |
---|
859 | END SUBROUTINE bcast_omp_cgen |
---|
860 | |
---|
861 | |
---|
862 | |
---|
863 | SUBROUTINE bcast_omp_igen(Var,Nb,Buff) |
---|
864 | IMPLICIT NONE |
---|
865 | |
---|
866 | INTEGER,INTENT(IN) :: Nb |
---|
867 | INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var |
---|
868 | INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff |
---|
869 | |
---|
870 | INTEGER :: i |
---|
871 | |
---|
872 | !$OMP MASTER |
---|
873 | DO i=1,Nb |
---|
874 | Buff(i)=Var(i) |
---|
875 | ENDDO |
---|
876 | !$OMP END MASTER |
---|
877 | !$OMP BARRIER |
---|
878 | |
---|
879 | DO i=1,Nb |
---|
880 | Var(i)=Buff(i) |
---|
881 | ENDDO |
---|
882 | !$OMP BARRIER |
---|
883 | |
---|
884 | END SUBROUTINE bcast_omp_igen |
---|
885 | |
---|
886 | |
---|
887 | SUBROUTINE bcast_omp_rgen(Var,Nb,Buff) |
---|
888 | IMPLICIT NONE |
---|
889 | |
---|
890 | INTEGER,INTENT(IN) :: Nb |
---|
891 | REAL,DIMENSION(Nb),INTENT(INOUT) :: Var |
---|
892 | REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff |
---|
893 | |
---|
894 | INTEGER :: i |
---|
895 | |
---|
896 | !$OMP MASTER |
---|
897 | DO i=1,Nb |
---|
898 | Buff(i)=Var(i) |
---|
899 | ENDDO |
---|
900 | !$OMP END MASTER |
---|
901 | !$OMP BARRIER |
---|
902 | |
---|
903 | DO i=1,Nb |
---|
904 | Var(i)=Buff(i) |
---|
905 | ENDDO |
---|
906 | !$OMP BARRIER |
---|
907 | |
---|
908 | END SUBROUTINE bcast_omp_rgen |
---|
909 | |
---|
910 | SUBROUTINE bcast_omp_lgen(Var,Nb,Buff) |
---|
911 | IMPLICIT NONE |
---|
912 | |
---|
913 | INTEGER,INTENT(IN) :: Nb |
---|
914 | LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var |
---|
915 | LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff |
---|
916 | |
---|
917 | INTEGER :: i |
---|
918 | |
---|
919 | !$OMP MASTER |
---|
920 | DO i=1,Nb |
---|
921 | Buff(i)=Var(i) |
---|
922 | ENDDO |
---|
923 | !$OMP END MASTER |
---|
924 | !$OMP BARRIER |
---|
925 | |
---|
926 | DO i=1,Nb |
---|
927 | Var(i)=Buff(i) |
---|
928 | ENDDO |
---|
929 | !$OMP BARRIER |
---|
930 | |
---|
931 | END SUBROUTINE bcast_omp_lgen |
---|
932 | |
---|
933 | |
---|
934 | SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff) |
---|
935 | USE mod_phys_lmdz_omp_data |
---|
936 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
937 | IMPLICIT NONE |
---|
938 | |
---|
939 | INTEGER,INTENT(IN) :: dimsize |
---|
940 | INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn |
---|
941 | INTEGER,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut |
---|
942 | INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff |
---|
943 | |
---|
944 | INTEGER :: i,ij |
---|
945 | |
---|
946 | !$OMP MASTER |
---|
947 | DO i=1,dimsize |
---|
948 | DO ij=1,klon_mpi |
---|
949 | Buff(ij,i)=VarIn(ij,i) |
---|
950 | ENDDO |
---|
951 | ENDDO |
---|
952 | !$OMP END MASTER |
---|
953 | !$OMP BARRIER |
---|
954 | |
---|
955 | DO i=1,dimsize |
---|
956 | DO ij=1,klon_omp |
---|
957 | VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i) |
---|
958 | ENDDO |
---|
959 | ENDDO |
---|
960 | !$OMP BARRIER |
---|
961 | |
---|
962 | END SUBROUTINE scatter_omp_igen |
---|
963 | |
---|
964 | |
---|
965 | SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff) |
---|
966 | USE mod_phys_lmdz_omp_data |
---|
967 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
968 | IMPLICIT NONE |
---|
969 | |
---|
970 | INTEGER,INTENT(IN) :: dimsize |
---|
971 | REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn |
---|
972 | REAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut |
---|
973 | REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff |
---|
974 | |
---|
975 | INTEGER :: i,ij |
---|
976 | |
---|
977 | !$OMP MASTER |
---|
978 | DO i=1,dimsize |
---|
979 | DO ij=1,klon_mpi |
---|
980 | Buff(ij,i)=VarIn(ij,i) |
---|
981 | ENDDO |
---|
982 | ENDDO |
---|
983 | !$OMP END MASTER |
---|
984 | !$OMP BARRIER |
---|
985 | |
---|
986 | DO i=1,dimsize |
---|
987 | DO ij=1,klon_omp |
---|
988 | VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i) |
---|
989 | ENDDO |
---|
990 | ENDDO |
---|
991 | !$OMP BARRIER |
---|
992 | |
---|
993 | END SUBROUTINE scatter_omp_rgen |
---|
994 | |
---|
995 | |
---|
996 | SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff) |
---|
997 | USE mod_phys_lmdz_omp_data |
---|
998 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
999 | IMPLICIT NONE |
---|
1000 | |
---|
1001 | INTEGER,INTENT(IN) :: dimsize |
---|
1002 | LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn |
---|
1003 | LOGICAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut |
---|
1004 | LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff |
---|
1005 | |
---|
1006 | INTEGER :: i,ij |
---|
1007 | |
---|
1008 | !$OMP MASTER |
---|
1009 | DO i=1,dimsize |
---|
1010 | DO ij=1,klon_mpi |
---|
1011 | Buff(ij,i)=VarIn(ij,i) |
---|
1012 | ENDDO |
---|
1013 | ENDDO |
---|
1014 | !$OMP END MASTER |
---|
1015 | !$OMP BARRIER |
---|
1016 | |
---|
1017 | DO i=1,dimsize |
---|
1018 | DO ij=1,klon_omp |
---|
1019 | VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i) |
---|
1020 | ENDDO |
---|
1021 | ENDDO |
---|
1022 | !$OMP BARRIER |
---|
1023 | |
---|
1024 | END SUBROUTINE scatter_omp_lgen |
---|
1025 | |
---|
1026 | |
---|
1027 | |
---|
1028 | |
---|
1029 | |
---|
1030 | SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff) |
---|
1031 | USE mod_phys_lmdz_omp_data |
---|
1032 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
1033 | IMPLICIT NONE |
---|
1034 | |
---|
1035 | INTEGER,INTENT(IN) :: dimsize |
---|
1036 | INTEGER,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn |
---|
1037 | INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut |
---|
1038 | INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff |
---|
1039 | |
---|
1040 | INTEGER :: i,ij |
---|
1041 | |
---|
1042 | DO i=1,dimsize |
---|
1043 | DO ij=1,klon_omp |
---|
1044 | Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i) |
---|
1045 | ENDDO |
---|
1046 | ENDDO |
---|
1047 | !$OMP BARRIER |
---|
1048 | |
---|
1049 | |
---|
1050 | !$OMP MASTER |
---|
1051 | DO i=1,dimsize |
---|
1052 | DO ij=1,klon_mpi |
---|
1053 | VarOut(ij,i)=Buff(ij,i) |
---|
1054 | ENDDO |
---|
1055 | ENDDO |
---|
1056 | !$OMP END MASTER |
---|
1057 | !$OMP BARRIER |
---|
1058 | |
---|
1059 | END SUBROUTINE gather_omp_igen |
---|
1060 | |
---|
1061 | |
---|
1062 | SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize) |
---|
1063 | USE mod_phys_lmdz_omp_data |
---|
1064 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
1065 | IMPLICIT NONE |
---|
1066 | |
---|
1067 | INTEGER,INTENT(IN) :: dimsize |
---|
1068 | REAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn |
---|
1069 | REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize),TARGET :: VarOut |
---|
1070 | |
---|
1071 | REAL, POINTER, SAVE :: Varout_ptr(:,:) ! Shared between threads NOT THREADPRIVATE |
---|
1072 | |
---|
1073 | INTEGER :: i,ij |
---|
1074 | |
---|
1075 | !$omp master |
---|
1076 | Varout_ptr => VarOut |
---|
1077 | !$omp end master |
---|
1078 | !$omp barrier |
---|
1079 | |
---|
1080 | DO i=1,dimsize |
---|
1081 | DO ij=1,klon_omp |
---|
1082 | Varout_ptr(klon_omp_begin-1+ij,i)=VarIn(ij,i) |
---|
1083 | ENDDO |
---|
1084 | ENDDO |
---|
1085 | !$omp barrier |
---|
1086 | END SUBROUTINE gather_omp_rgen |
---|
1087 | |
---|
1088 | |
---|
1089 | SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff) |
---|
1090 | USE mod_phys_lmdz_omp_data |
---|
1091 | USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi |
---|
1092 | IMPLICIT NONE |
---|
1093 | |
---|
1094 | INTEGER,INTENT(IN) :: dimsize |
---|
1095 | LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn |
---|
1096 | LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut |
---|
1097 | LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff |
---|
1098 | |
---|
1099 | INTEGER :: i,ij |
---|
1100 | |
---|
1101 | DO i=1,dimsize |
---|
1102 | DO ij=1,klon_omp |
---|
1103 | Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i) |
---|
1104 | ENDDO |
---|
1105 | ENDDO |
---|
1106 | !$OMP BARRIER |
---|
1107 | |
---|
1108 | |
---|
1109 | !$OMP MASTER |
---|
1110 | DO i=1,dimsize |
---|
1111 | DO ij=1,klon_mpi |
---|
1112 | VarOut(ij,i)=Buff(ij,i) |
---|
1113 | ENDDO |
---|
1114 | ENDDO |
---|
1115 | !$OMP END MASTER |
---|
1116 | !$OMP BARRIER |
---|
1117 | |
---|
1118 | END SUBROUTINE gather_omp_lgen |
---|
1119 | |
---|
1120 | |
---|
1121 | SUBROUTINE reduce_sum_omp_igen(VarIn,VarOut,dimsize,Buff) |
---|
1122 | IMPLICIT NONE |
---|
1123 | |
---|
1124 | INTEGER,INTENT(IN) :: dimsize |
---|
1125 | INTEGER,INTENT(IN),DIMENSION(dimsize) :: VarIn |
---|
1126 | INTEGER,INTENT(OUT),DIMENSION(dimsize) :: VarOut |
---|
1127 | INTEGER,INTENT(INOUT),DIMENSION(dimsize) :: Buff |
---|
1128 | |
---|
1129 | INTEGER :: i |
---|
1130 | |
---|
1131 | !$OMP MASTER |
---|
1132 | Buff(:)=0 |
---|
1133 | !$OMP END MASTER |
---|
1134 | !$OMP BARRIER |
---|
1135 | |
---|
1136 | !$OMP CRITICAL |
---|
1137 | DO i=1,dimsize |
---|
1138 | Buff(i)=Buff(i)+VarIn(i) |
---|
1139 | ENDDO |
---|
1140 | !$OMP END CRITICAL |
---|
1141 | !$OMP BARRIER |
---|
1142 | |
---|
1143 | !$OMP MASTER |
---|
1144 | DO i=1,dimsize |
---|
1145 | VarOut(i)=Buff(i) |
---|
1146 | ENDDO |
---|
1147 | !$OMP END MASTER |
---|
1148 | !$OMP BARRIER |
---|
1149 | |
---|
1150 | END SUBROUTINE reduce_sum_omp_igen |
---|
1151 | |
---|
1152 | SUBROUTINE reduce_sum_omp_rgen(VarIn,VarOut,dimsize,Buff) |
---|
1153 | IMPLICIT NONE |
---|
1154 | |
---|
1155 | INTEGER,INTENT(IN) :: dimsize |
---|
1156 | REAL,INTENT(IN),DIMENSION(dimsize) :: VarIn |
---|
1157 | REAL,INTENT(OUT),DIMENSION(dimsize) :: VarOut |
---|
1158 | REAL,INTENT(INOUT),DIMENSION(dimsize) :: Buff |
---|
1159 | |
---|
1160 | INTEGER :: i |
---|
1161 | |
---|
1162 | !$OMP MASTER |
---|
1163 | Buff(:)=0 |
---|
1164 | !$OMP END MASTER |
---|
1165 | !$OMP BARRIER |
---|
1166 | |
---|
1167 | !$OMP CRITICAL |
---|
1168 | DO i=1,dimsize |
---|
1169 | Buff(i)=Buff(i)+VarIn(i) |
---|
1170 | ENDDO |
---|
1171 | !$OMP END CRITICAL |
---|
1172 | !$OMP BARRIER |
---|
1173 | |
---|
1174 | !$OMP MASTER |
---|
1175 | DO i=1,dimsize |
---|
1176 | VarOut(i)=Buff(i) |
---|
1177 | ENDDO |
---|
1178 | !$OMP END MASTER |
---|
1179 | !$OMP BARRIER |
---|
1180 | |
---|
1181 | END SUBROUTINE reduce_sum_omp_rgen |
---|
1182 | |
---|
1183 | |
---|
1184 | SUBROUTINE reduce_min_omp_igen(VarIn,VarOut,dimsize,Buff) |
---|
1185 | IMPLICIT NONE |
---|
1186 | |
---|
1187 | INTEGER,INTENT(IN) :: dimsize |
---|
1188 | INTEGER,INTENT(IN),DIMENSION(dimsize) :: VarIn |
---|
1189 | INTEGER,INTENT(OUT),DIMENSION(dimsize) :: VarOut |
---|
1190 | INTEGER,INTENT(INOUT),DIMENSION(dimsize) :: Buff |
---|
1191 | |
---|
1192 | INTEGER :: i |
---|
1193 | INTEGER :: var |
---|
1194 | |
---|
1195 | !$OMP MASTER |
---|
1196 | Buff(:)=HUGE(var) |
---|
1197 | !$OMP END MASTER |
---|
1198 | !$OMP BARRIER |
---|
1199 | |
---|
1200 | !$OMP CRITICAL |
---|
1201 | DO i=1,dimsize |
---|
1202 | Buff(i)=MIN(Buff(i),VarIn(i)) |
---|
1203 | ENDDO |
---|
1204 | !$OMP END CRITICAL |
---|
1205 | !$OMP BARRIER |
---|
1206 | |
---|
1207 | !$OMP MASTER |
---|
1208 | DO i=1,dimsize |
---|
1209 | VarOut(i)=Buff(i) |
---|
1210 | ENDDO |
---|
1211 | !$OMP END MASTER |
---|
1212 | !$OMP BARRIER |
---|
1213 | |
---|
1214 | END SUBROUTINE reduce_min_omp_igen |
---|
1215 | |
---|
1216 | SUBROUTINE reduce_min_omp_rgen(VarIn,VarOut,dimsize,Buff) |
---|
1217 | IMPLICIT NONE |
---|
1218 | |
---|
1219 | INTEGER,INTENT(IN) :: dimsize |
---|
1220 | REAL,INTENT(IN),DIMENSION(dimsize) :: VarIn |
---|
1221 | REAL,INTENT(OUT),DIMENSION(dimsize) :: VarOut |
---|
1222 | REAL,INTENT(INOUT),DIMENSION(dimsize) :: Buff |
---|
1223 | |
---|
1224 | INTEGER :: i |
---|
1225 | REAL :: var |
---|
1226 | |
---|
1227 | !$OMP MASTER |
---|
1228 | Buff(:)=HUGE(var) |
---|
1229 | !$OMP END MASTER |
---|
1230 | !$OMP BARRIER |
---|
1231 | |
---|
1232 | !$OMP CRITICAL |
---|
1233 | DO i=1,dimsize |
---|
1234 | Buff(i)=MIN(Buff(i),VarIn(i)) |
---|
1235 | ENDDO |
---|
1236 | !$OMP END CRITICAL |
---|
1237 | !$OMP BARRIER |
---|
1238 | |
---|
1239 | !$OMP MASTER |
---|
1240 | DO i=1,dimsize |
---|
1241 | VarOut(i)=Buff(i) |
---|
1242 | ENDDO |
---|
1243 | !$OMP END MASTER |
---|
1244 | !$OMP BARRIER |
---|
1245 | |
---|
1246 | END SUBROUTINE reduce_min_omp_rgen |
---|
1247 | |
---|
1248 | |
---|
1249 | END MODULE mod_phys_lmdz_omp_transfert |
---|