source: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_transfert_para.F90 @ 3026

Last change on this file since 3026 was 3011, checked in by emillour, 18 months ago

Common physics auxiliary routines:
Add possibility to broadcast 5D and 6D fields.
EM

File size: 30.1 KB
Line 
1!
2!$Header$
3!
4MODULE mod_phys_lmdz_transfert_para
5
6  USE mod_phys_lmdz_mpi_transfert
7  USE mod_phys_lmdz_omp_transfert
8
9
10
11  INTERFACE bcast
12    MODULE PROCEDURE bcast_c,                                     &
13                     bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4,bcast_i5,bcast_i6, &
14                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4,bcast_r5,bcast_r6, &
15                     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4,bcast_l5,bcast_l6
16  END INTERFACE
17
18  INTERFACE scatter
19    MODULE PROCEDURE scatter_i,scatter_i1,scatter_i2,scatter_i3, &
20                     scatter_r,scatter_r1,scatter_r2,scatter_r3, &
21                     scatter_l,scatter_l1,scatter_l2,scatter_l3
22  END INTERFACE
23
24 
25  INTERFACE gather
26    MODULE PROCEDURE gather_i,gather_i1,gather_i2,gather_i3, &
27                     gather_r,gather_r1,gather_r2,gather_r3, &
28                     gather_l,gather_l1,gather_l2,gather_l3 
29  END INTERFACE
30 
31  INTERFACE scatter2D
32    MODULE PROCEDURE scatter2D_i,scatter2D_i1,scatter2D_i2,scatter2D_i3, &
33                     scatter2D_r,scatter2D_r1,scatter2D_r2,scatter2D_r3, &
34                     scatter2D_l,scatter2D_l1,scatter2D_l2,scatter2D_l3
35  END INTERFACE
36
37  INTERFACE gather2D
38    MODULE PROCEDURE gather2D_i,gather2D_i1,gather2D_i2,gather2D_i3, &
39                     gather2D_r,gather2D_r1,gather2D_r2,gather2D_r3, &
40                     gather2D_l,gather2D_l1,gather2D_l2,gather2D_l3
41  END INTERFACE
42 
43  INTERFACE reduce_sum
44    MODULE PROCEDURE reduce_sum_i,reduce_sum_i1,reduce_sum_i2,reduce_sum_i3,reduce_sum_i4, &
45                     reduce_sum_r,reduce_sum_r1,reduce_sum_r2,reduce_sum_r3,reduce_sum_r4
46  END INTERFACE
47
48   
49CONTAINS
50
51!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
52!! Definition des Broadcast --> 4D   !!
53!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
54
55!! -- Les chaine de charactère -- !!
56
57  SUBROUTINE bcast_c(var)
58  IMPLICIT NONE
59    CHARACTER(LEN=*),INTENT(INOUT) :: Var
60   
61!$OMP MASTER
62    CALL bcast_mpi(Var)
63!$OMP END MASTER
64    CALL bcast_omp(Var)
65   
66  END SUBROUTINE bcast_c
67
68!! -- Les entiers -- !!
69 
70  SUBROUTINE bcast_i(var)
71  IMPLICIT NONE
72    INTEGER,INTENT(INOUT) :: Var
73!$OMP MASTER
74    CALL bcast_mpi(Var)
75!$OMP END MASTER
76    CALL bcast_omp(Var)
77   
78  END SUBROUTINE bcast_i
79
80  SUBROUTINE bcast_i1(var)
81  IMPLICIT NONE
82    INTEGER,INTENT(INOUT) :: Var(:)
83   
84!$OMP MASTER
85    CALL bcast_mpi(Var)
86!$OMP END MASTER
87    CALL bcast_omp(Var)
88   
89  END SUBROUTINE bcast_i1
90
91
92  SUBROUTINE bcast_i2(var)
93  IMPLICIT NONE
94    INTEGER,INTENT(INOUT) :: Var(:,:)
95   
96!$OMP MASTER
97    CALL bcast_mpi(Var)
98!$OMP END MASTER
99    CALL bcast_omp(Var)
100   
101  END SUBROUTINE bcast_i2
102
103
104  SUBROUTINE bcast_i3(var)
105  IMPLICIT NONE
106    INTEGER,INTENT(INOUT) :: Var(:,:,:)
107   
108!$OMP MASTER
109    CALL bcast_mpi(Var)
110!$OMP END MASTER
111    CALL bcast_omp(Var)
112   
113  END SUBROUTINE bcast_i3
114
115
116  SUBROUTINE bcast_i4(var)
117  IMPLICIT NONE
118    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
119   
120!$OMP MASTER
121    CALL bcast_mpi(Var)
122!$OMP END MASTER
123    CALL bcast_omp(Var)
124   
125  END SUBROUTINE bcast_i4
126
127 
128  SUBROUTINE bcast_i5(var)
129  IMPLICIT NONE
130    INTEGER,INTENT(INOUT) :: Var(:,:,:,:,:)
131   
132!$OMP MASTER
133    CALL bcast_mpi(Var)
134!$OMP END MASTER
135    CALL bcast_omp(Var)
136   
137  END SUBROUTINE bcast_i5
138
139
140  SUBROUTINE bcast_i6(var)
141  IMPLICIT NONE
142    INTEGER,INTENT(INOUT) :: Var(:,:,:,:,:,:)
143   
144!$OMP MASTER
145    CALL bcast_mpi(Var)
146!$OMP END MASTER
147    CALL bcast_omp(Var)
148   
149  END SUBROUTINE bcast_i6
150
151
152!! -- Les reels -- !!
153 
154  SUBROUTINE bcast_r(var)
155  IMPLICIT NONE
156    REAL,INTENT(INOUT) :: Var
157
158!$OMP MASTER
159    CALL bcast_mpi(Var)
160!$OMP END MASTER
161    CALL bcast_omp(Var)
162   
163  END SUBROUTINE bcast_r
164
165  SUBROUTINE bcast_r1(var)
166  IMPLICIT NONE
167    REAL,INTENT(INOUT) :: Var(:)
168   
169!$OMP MASTER
170    CALL bcast_mpi(Var)
171!$OMP END MASTER
172    CALL bcast_omp(Var)
173   
174  END SUBROUTINE bcast_r1
175
176
177  SUBROUTINE bcast_r2(var)
178  IMPLICIT NONE
179    REAL,INTENT(INOUT) :: Var(:,:)
180   
181!$OMP MASTER
182    CALL bcast_mpi(Var)
183!$OMP END MASTER
184    CALL bcast_omp(Var)
185   
186  END SUBROUTINE bcast_r2
187
188
189  SUBROUTINE bcast_r3(var)
190  IMPLICIT NONE
191    REAL,INTENT(INOUT) :: Var(:,:,:)
192   
193!$OMP MASTER
194    CALL bcast_mpi(Var)
195!$OMP END MASTER
196    CALL bcast_omp(Var)
197   
198  END SUBROUTINE bcast_r3
199
200
201  SUBROUTINE bcast_r4(var)
202  IMPLICIT NONE
203    REAL,INTENT(INOUT) :: Var(:,:,:,:)
204   
205!$OMP MASTER
206    CALL bcast_mpi(Var)
207!$OMP END MASTER
208    CALL bcast_omp(Var)
209   
210  END SUBROUTINE bcast_r4
211
212
213  SUBROUTINE bcast_r5(var)
214  IMPLICIT NONE
215    REAL,INTENT(INOUT) :: Var(:,:,:,:,:)
216   
217!$OMP MASTER
218    CALL bcast_mpi(Var)
219!$OMP END MASTER
220    CALL bcast_omp(Var)
221   
222  END SUBROUTINE bcast_r5
223
224
225  SUBROUTINE bcast_r6(var)
226  IMPLICIT NONE
227    REAL,INTENT(INOUT) :: Var(:,:,:,:,:,:)
228   
229!$OMP MASTER
230    CALL bcast_mpi(Var)
231!$OMP END MASTER
232    CALL bcast_omp(Var)
233   
234  END SUBROUTINE bcast_r6
235
236
237!! -- Les booleens -- !!
238 
239  SUBROUTINE bcast_l(var)
240  IMPLICIT NONE
241    LOGICAL,INTENT(INOUT) :: Var
242!$OMP MASTER
243    CALL bcast_mpi(Var)
244!$OMP END MASTER
245    CALL bcast_omp(Var)
246   
247  END SUBROUTINE bcast_l
248
249  SUBROUTINE bcast_l1(var)
250  IMPLICIT NONE
251    LOGICAL,INTENT(INOUT) :: Var(:)
252   
253!$OMP MASTER
254    CALL bcast_mpi(Var)
255!$OMP END MASTER
256    CALL bcast_omp(Var)
257   
258  END SUBROUTINE bcast_l1
259
260
261  SUBROUTINE bcast_l2(var)
262  IMPLICIT NONE
263    LOGICAL,INTENT(INOUT) :: Var(:,:)
264   
265!$OMP MASTER
266    CALL bcast_mpi(Var)
267!$OMP END MASTER
268    CALL bcast_omp(Var)
269   
270  END SUBROUTINE bcast_l2
271
272
273  SUBROUTINE bcast_l3(var)
274  IMPLICIT NONE
275    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
276   
277!$OMP MASTER
278    CALL bcast_mpi(Var)
279!$OMP END MASTER
280    CALL bcast_omp(Var)
281   
282  END SUBROUTINE bcast_l3
283
284
285  SUBROUTINE bcast_l4(var)
286  IMPLICIT NONE
287    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
288   
289!$OMP MASTER
290    CALL bcast_mpi(Var)
291!$OMP END MASTER
292    CALL bcast_omp(Var)
293   
294  END SUBROUTINE bcast_l4
295
296
297  SUBROUTINE bcast_l5(var)
298  IMPLICIT NONE
299    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:,:)
300   
301!$OMP MASTER
302    CALL bcast_mpi(Var)
303!$OMP END MASTER
304    CALL bcast_omp(Var)
305   
306  END SUBROUTINE bcast_l5
307
308
309  SUBROUTINE bcast_l6(var)
310  IMPLICIT NONE
311    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:,:,:)
312   
313!$OMP MASTER
314    CALL bcast_mpi(Var)
315!$OMP END MASTER
316    CALL bcast_omp(Var)
317   
318  END SUBROUTINE bcast_l6
319
320
321!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
322!! Definition des Scatter   --> 4D   !!
323!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
324
325  SUBROUTINE scatter_i(VarIn, VarOut)
326    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
327    IMPLICIT NONE
328 
329    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
330    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
331
332    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
333   
334!$OMP MASTER
335      CALL scatter_mpi(VarIn,Var_tmp)
336!$OMP END MASTER
337
338      CALL scatter_omp(Var_tmp,Varout)
339   
340  END SUBROUTINE scatter_i
341
342
343  SUBROUTINE scatter_i1(VarIn, VarOut)
344    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
345    IMPLICIT NONE
346 
347    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
348    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
349
350    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
351
352!$OMP MASTER
353      CALL scatter_mpi(VarIn,Var_tmp)
354!$OMP END MASTER
355      CALL scatter_omp(Var_tmp,Varout)
356   
357  END SUBROUTINE scatter_i1
358
359
360  SUBROUTINE scatter_i2(VarIn, VarOut)
361    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
362    IMPLICIT NONE
363 
364    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
365    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
366   
367    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
368
369!$OMP MASTER
370      CALL scatter_mpi(VarIn,Var_tmp)
371!$OMP END MASTER
372      CALL scatter_omp(Var_tmp,Varout)
373   
374  END SUBROUTINE scatter_i2
375
376
377  SUBROUTINE scatter_i3(VarIn, VarOut)
378    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
379    IMPLICIT NONE
380 
381    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
382    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
383
384    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
385
386!$OMP MASTER
387      CALL scatter_mpi(VarIn,Var_tmp)
388!$OMP END MASTER
389      CALL scatter_omp(Var_tmp,VarOut)
390   
391  END SUBROUTINE scatter_i3
392
393
394  SUBROUTINE scatter_r(VarIn, VarOut)
395    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
396    IMPLICIT NONE
397 
398    REAL,INTENT(IN),DIMENSION(:) :: VarIn
399    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
400
401    REAL,DIMENSION(klon_mpi) :: Var_tmp
402   
403!$OMP MASTER
404      CALL scatter_mpi(VarIn,Var_tmp)
405!$OMP END MASTER
406
407      CALL scatter_omp(Var_tmp,Varout)
408   
409  END SUBROUTINE scatter_r
410
411
412  SUBROUTINE scatter_r1(VarIn, VarOut)
413    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
414    IMPLICIT NONE
415 
416    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
417    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
418
419    REAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
420
421!$OMP MASTER
422      CALL scatter_mpi(VarIn,Var_tmp)
423!$OMP END MASTER
424      CALL scatter_omp(Var_tmp,Varout)
425   
426  END SUBROUTINE scatter_r1
427
428
429  SUBROUTINE scatter_r2(VarIn, VarOut)
430    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
431    IMPLICIT NONE
432 
433    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
434    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
435   
436    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
437
438!$OMP MASTER
439      CALL scatter_mpi(VarIn,Var_tmp)
440!$OMP END MASTER
441      CALL scatter_omp(Var_tmp,Varout)
442   
443  END SUBROUTINE scatter_r2
444
445
446  SUBROUTINE scatter_r3(VarIn, VarOut)
447    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
448    IMPLICIT NONE
449 
450    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
451    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
452
453    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
454
455!$OMP MASTER
456      CALL scatter_mpi(VarIn,Var_tmp)
457!$OMP END MASTER
458      CALL scatter_omp(Var_tmp,VarOut)
459   
460  END SUBROUTINE scatter_r3
461 
462 
463
464  SUBROUTINE scatter_l(VarIn, VarOut)
465    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
466    IMPLICIT NONE
467 
468    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
469    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
470
471    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
472   
473!$OMP MASTER
474      CALL scatter_mpi(VarIn,Var_tmp)
475!$OMP END MASTER
476
477      CALL scatter_omp(Var_tmp,Varout)
478   
479  END SUBROUTINE scatter_l
480
481
482  SUBROUTINE scatter_l1(VarIn, VarOut)
483    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
484    IMPLICIT NONE
485 
486    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
487    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
488
489    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
490
491!$OMP MASTER
492      CALL scatter_mpi(VarIn,Var_tmp)
493!$OMP END MASTER
494      CALL scatter_omp(Var_tmp,Varout)
495   
496  END SUBROUTINE scatter_l1
497
498
499  SUBROUTINE scatter_l2(VarIn, VarOut)
500    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
501    IMPLICIT NONE
502 
503    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
504    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
505   
506    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
507
508!$OMP MASTER
509      CALL scatter_mpi(VarIn,Var_tmp)
510!$OMP END MASTER
511      CALL scatter_omp(Var_tmp,Varout)
512   
513  END SUBROUTINE scatter_l2
514
515
516  SUBROUTINE scatter_l3(VarIn, VarOut)
517    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
518    IMPLICIT NONE
519 
520    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
521    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
522
523    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
524
525!$OMP MASTER
526      CALL scatter_mpi(VarIn,Var_tmp)
527!$OMP END MASTER
528      CALL scatter_omp(Var_tmp,VarOut)
529   
530  END SUBROUTINE scatter_l3
531
532
533
534!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
535!! Definition des Gather   --> 4D   !!
536!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
537 
538!!!!! --> Les entiers
539
540  SUBROUTINE gather_i(VarIn, VarOut)
541    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
542    IMPLICIT NONE
543 
544    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
545    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
546   
547    INTEGER, DIMENSION(klon_mpi) :: Var_tmp
548   
549    CALL gather_omp(VarIn,Var_tmp)
550!$OMP MASTER
551    CALL gather_mpi(Var_tmp,Varout)
552!$OMP END MASTER
553 
554  END SUBROUTINE gather_i
555
556
557  SUBROUTINE gather_i1(VarIn, VarOut)
558    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
559    IMPLICIT NONE
560 
561    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
562    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
563   
564    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
565   
566    CALL gather_omp(VarIn,Var_tmp)
567!$OMP MASTER
568    CALL gather_mpi(Var_tmp,Varout)
569!$OMP END MASTER
570 
571  END SUBROUTINE gather_i1
572
573
574  SUBROUTINE gather_i2(VarIn, VarOut)
575    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
576    IMPLICIT NONE
577 
578    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
579    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
580   
581    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
582   
583    CALL gather_omp(VarIn,Var_tmp)
584!$OMP MASTER
585    CALL gather_mpi(Var_tmp,VarOut)
586!$OMP END MASTER
587 
588  END SUBROUTINE gather_i2
589
590
591  SUBROUTINE gather_i3(VarIn, VarOut)
592    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
593    IMPLICIT NONE
594 
595    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
596    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
597   
598    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
599   
600    CALL gather_omp(VarIn,Var_tmp)
601!$OMP MASTER
602    CALL gather_mpi(Var_tmp,VarOut)
603!$OMP END MASTER
604 
605  END SUBROUTINE gather_i3
606
607
608!!!!! --> Les reels
609
610  SUBROUTINE gather_r(VarIn, VarOut)
611    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
612    IMPLICIT NONE
613 
614    REAL,INTENT(IN),DIMENSION(:) :: VarIn
615    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
616   
617    REAL, DIMENSION(klon_mpi) :: Var_tmp
618   
619    CALL gather_omp(VarIn,Var_tmp)
620!$OMP MASTER
621    CALL gather_mpi(Var_tmp,VarOut)
622!$OMP END MASTER
623 
624  END SUBROUTINE gather_r
625
626
627  SUBROUTINE gather_r1(VarIn, VarOut)
628    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
629    IMPLICIT NONE
630 
631    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
632    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
633   
634    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
635   
636    CALL gather_omp(VarIn,Var_tmp)
637!$OMP MASTER
638    CALL gather_mpi(Var_tmp,VarOut)
639!$OMP END MASTER
640 
641  END SUBROUTINE gather_r1
642
643
644  SUBROUTINE gather_r2(VarIn, VarOut)
645    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
646    IMPLICIT NONE
647 
648    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
649    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
650   
651    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
652   
653    CALL gather_omp(VarIn,Var_tmp)
654!$OMP MASTER
655    CALL gather_mpi(Var_tmp,VarOut)
656!$OMP END MASTER
657 
658  END SUBROUTINE gather_r2
659
660
661  SUBROUTINE gather_r3(VarIn, VarOut)
662    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
663    IMPLICIT NONE
664 
665    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
666    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
667   
668    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
669   
670    CALL gather_omp(VarIn,Var_tmp)
671!$OMP MASTER
672    CALL gather_mpi(Var_tmp,VarOut)
673!$OMP END MASTER
674 
675  END SUBROUTINE gather_r3
676
677
678!!!!! --> Les booleens
679
680  SUBROUTINE gather_l(VarIn, VarOut)
681    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
682    IMPLICIT NONE
683 
684    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
685    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
686   
687    LOGICAL, DIMENSION(klon_mpi) :: Var_tmp
688   
689    CALL gather_omp(VarIn,Var_tmp)
690!$OMP MASTER
691    CALL gather_mpi(Var_tmp,VarOut)
692!$OMP END MASTER
693 
694  END SUBROUTINE gather_l
695
696
697  SUBROUTINE gather_l1(VarIn, VarOut)
698    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
699    IMPLICIT NONE
700 
701    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
702    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
703   
704    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
705   
706    CALL gather_omp(VarIn,Var_tmp)
707!$OMP MASTER
708    CALL gather_mpi(Var_tmp,VarOut)
709!$OMP END MASTER
710 
711  END SUBROUTINE gather_l1
712
713
714  SUBROUTINE gather_l2(VarIn, VarOut)
715    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
716    IMPLICIT NONE
717 
718    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
719    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
720   
721    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
722   
723    CALL gather_omp(VarIn,Var_tmp)
724!$OMP MASTER
725    CALL gather_mpi(Var_tmp,VarOut)
726!$OMP END MASTER
727 
728  END SUBROUTINE gather_l2
729
730
731  SUBROUTINE gather_l3(VarIn, VarOut)
732    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
733    IMPLICIT NONE
734 
735    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
736    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
737   
738    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
739   
740    CALL gather_omp(VarIn,Var_tmp)
741!$OMP MASTER
742    CALL gather_mpi(Var_tmp,VarOut)
743!$OMP END MASTER
744 
745  END SUBROUTINE gather_l3
746
747
748!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
749!! Definition des Scatter2D   --> 4D   !!
750!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
751
752
753!!!!! --> Les entiers
754
755  SUBROUTINE scatter2D_i(VarIn, VarOut)
756    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
757    IMPLICIT NONE
758 
759    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
760    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
761
762    INTEGER,DIMENSION(klon_mpi) :: Var_tmp   
763
764!$OMP MASTER   
765    CALL scatter2D_mpi(VarIn,Var_tmp)
766!$OMP END MASTER
767    CALL scatter_omp(Var_tmp,VarOut)
768
769  END SUBROUTINE scatter2D_i
770
771
772  SUBROUTINE scatter2D_i1(VarIn, VarOut)
773    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
774    IMPLICIT NONE
775 
776    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
777    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
778
779    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp   
780
781!$OMP MASTER   
782    CALL scatter2D_mpi(VarIn,Var_tmp)
783!$OMP END MASTER
784    CALL scatter_omp(Var_tmp,VarOut)
785
786  END SUBROUTINE scatter2D_i1
787 
788
789  SUBROUTINE scatter2D_i2(VarIn, VarOut)
790    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
791    IMPLICIT NONE
792 
793    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
794    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
795
796    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp   
797
798!$OMP MASTER   
799    CALL scatter2D_mpi(VarIn,Var_tmp)
800!$OMP END MASTER
801    CALL scatter_omp(Var_tmp,VarOut)
802
803  END SUBROUTINE scatter2D_i2 
804
805
806  SUBROUTINE scatter2D_i3(VarIn, VarOut)
807    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
808    IMPLICIT NONE
809 
810    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
811    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
812
813    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp   
814
815!$OMP MASTER   
816    CALL scatter2D_mpi(VarIn,Var_tmp)
817!$OMP END MASTER
818    CALL scatter_omp(Var_tmp,VarOut)
819
820  END SUBROUTINE scatter2D_i3
821 
822
823!!!!! --> Les reels
824
825  SUBROUTINE scatter2D_r(VarIn, VarOut)
826    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
827    IMPLICIT NONE
828 
829    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
830    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
831
832    REAL,DIMENSION(klon_mpi) :: Var_tmp   
833
834!$OMP MASTER   
835    CALL scatter2D_mpi(VarIn,Var_tmp)
836!$OMP END MASTER
837    CALL scatter_omp(Var_tmp,VarOut)
838
839  END SUBROUTINE scatter2D_r
840
841
842  SUBROUTINE scatter2D_r1(VarIn, VarOut)
843    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
844    IMPLICIT NONE
845 
846    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
847    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
848
849    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp   
850
851!$OMP MASTER   
852    CALL scatter2D_mpi(VarIn,Var_tmp)
853!$OMP END MASTER
854    CALL scatter_omp(Var_tmp,VarOut)
855
856  END SUBROUTINE scatter2D_r1
857 
858
859  SUBROUTINE scatter2D_r2(VarIn, VarOut)
860    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
861    IMPLICIT NONE
862 
863    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
864    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
865
866    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp   
867
868!$OMP MASTER   
869    CALL scatter2D_mpi(VarIn,Var_tmp)
870!$OMP END MASTER
871    CALL scatter_omp(Var_tmp,VarOut)
872
873  END SUBROUTINE scatter2D_r2 
874
875
876  SUBROUTINE scatter2D_r3(VarIn, VarOut)
877    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
878    IMPLICIT NONE
879 
880    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
881    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
882
883    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp   
884
885!$OMP MASTER   
886    CALL scatter2D_mpi(VarIn,Var_tmp)
887!$OMP END MASTER
888    CALL scatter_omp(Var_tmp,VarOut)
889
890  END SUBROUTINE scatter2D_r3
891   
892   
893!!!!! --> Les booleens
894
895
896  SUBROUTINE scatter2D_l(VarIn, VarOut)
897    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
898    IMPLICIT NONE
899 
900    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
901    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
902
903    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp   
904
905!$OMP MASTER   
906    CALL scatter2D_mpi(VarIn,Var_tmp)
907!$OMP END MASTER
908    CALL scatter_omp(Var_tmp,VarOut)
909
910  END SUBROUTINE scatter2D_l
911
912
913  SUBROUTINE scatter2D_l1(VarIn, VarOut)
914    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
915    IMPLICIT NONE
916 
917    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
918    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
919
920    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp   
921
922!$OMP MASTER   
923    CALL scatter2D_mpi(VarIn,Var_tmp)
924!$OMP END MASTER
925    CALL scatter_omp(Var_tmp,VarOut)
926
927  END SUBROUTINE scatter2D_l1
928 
929
930  SUBROUTINE scatter2D_l2(VarIn, VarOut)
931    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
932    IMPLICIT NONE
933 
934    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
935    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
936
937    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp   
938
939!$OMP MASTER   
940    CALL scatter2D_mpi(VarIn,Var_tmp)
941!$OMP END MASTER
942    CALL scatter_omp(Var_tmp,VarOut)
943
944  END SUBROUTINE scatter2D_l2 
945
946
947  SUBROUTINE scatter2D_l3(VarIn, VarOut)
948    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
949    IMPLICIT NONE
950 
951    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
952    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
953
954    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp   
955
956!$OMP MASTER   
957    CALL scatter2D_mpi(VarIn,Var_tmp)
958!$OMP END MASTER
959    CALL scatter_omp(Var_tmp,VarOut)
960
961  END SUBROUTINE scatter2D_l3
962
963
964!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
965!! Definition des Gather2D   --> 4D   !!
966!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
967
968!!!!! --> Les entiers
969
970  SUBROUTINE gather2D_i(VarIn, VarOut)
971    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
972    IMPLICIT NONE
973 
974    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
975    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
976   
977    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
978
979    CALL gather_omp(VarIn,Var_tmp)
980!$OMP MASTER
981    CALL gather2D_mpi(Var_tmp,VarOut)
982!$OMP END MASTER   
983
984  END SUBROUTINE gather2D_i
985 
986
987  SUBROUTINE gather2D_i1(VarIn, VarOut)
988    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
989    IMPLICIT NONE
990 
991    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
992    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
993   
994    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
995
996    CALL gather_omp(VarIn,Var_tmp)
997!$OMP MASTER
998    CALL gather2D_mpi(Var_tmp,VarOut)
999!$OMP END MASTER   
1000
1001  END SUBROUTINE gather2D_i1
1002
1003 
1004  SUBROUTINE gather2D_i2(VarIn, VarOut)
1005    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1006    IMPLICIT NONE
1007 
1008    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1009    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1010   
1011    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
1012
1013    CALL gather_omp(VarIn,Var_tmp)
1014!$OMP MASTER
1015    CALL gather2D_mpi(Var_tmp,VarOut)
1016!$OMP END MASTER   
1017
1018  END SUBROUTINE gather2D_i2
1019
1020
1021  SUBROUTINE gather2D_i3(VarIn, VarOut)
1022    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1023    IMPLICIT NONE
1024 
1025    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1026    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1027   
1028    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
1029
1030    CALL gather_omp(VarIn,Var_tmp)
1031!$OMP MASTER
1032    CALL gather2D_mpi(Var_tmp,VarOut)
1033!$OMP END MASTER   
1034
1035  END SUBROUTINE gather2D_i3
1036
1037
1038!!!!! --> Les reels
1039
1040  SUBROUTINE gather2D_r(VarIn, VarOut)
1041    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1042    IMPLICIT NONE
1043 
1044    REAL,INTENT(IN),DIMENSION(:) :: VarIn
1045    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1046   
1047    REAL,DIMENSION(klon_mpi) :: Var_tmp
1048
1049    CALL gather_omp(VarIn,Var_tmp)
1050!$OMP MASTER
1051    CALL gather2D_mpi(Var_tmp,VarOut)
1052!$OMP END MASTER   
1053
1054  END SUBROUTINE gather2D_r
1055 
1056
1057  SUBROUTINE gather2D_r1(VarIn, VarOut)
1058    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1059    IMPLICIT NONE
1060 
1061    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1062    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1063   
1064    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
1065
1066    CALL gather_omp(VarIn,Var_tmp)
1067!$OMP MASTER
1068    CALL gather2D_mpi(Var_tmp,VarOut)
1069!$OMP END MASTER   
1070
1071  END SUBROUTINE gather2D_r1
1072
1073 
1074  SUBROUTINE gather2D_r2(VarIn, VarOut)
1075    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1076    IMPLICIT NONE
1077 
1078    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1079    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1080   
1081    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
1082
1083    CALL gather_omp(VarIn,Var_tmp)
1084!$OMP MASTER
1085    CALL gather2D_mpi(Var_tmp,VarOut)
1086!$OMP END MASTER   
1087
1088  END SUBROUTINE gather2D_r2
1089
1090
1091  SUBROUTINE gather2D_r3(VarIn, VarOut)
1092    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1093    IMPLICIT NONE
1094 
1095    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1096    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1097   
1098    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
1099
1100    CALL gather_omp(VarIn,Var_tmp)
1101!$OMP MASTER
1102    CALL gather2D_mpi(Var_tmp,VarOut)
1103!$OMP END MASTER   
1104
1105  END SUBROUTINE gather2D_r3
1106 
1107
1108!!!!! --> Les booleens
1109
1110  SUBROUTINE gather2D_l(VarIn, VarOut)
1111    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1112    IMPLICIT NONE
1113 
1114    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
1115    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1116   
1117    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
1118
1119    CALL gather_omp(VarIn,Var_tmp)
1120!$OMP MASTER
1121    CALL gather2D_mpi(Var_tmp,VarOut)
1122!$OMP END MASTER   
1123
1124  END SUBROUTINE gather2D_l
1125 
1126
1127  SUBROUTINE gather2D_l1(VarIn, VarOut)
1128    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1129    IMPLICIT NONE
1130 
1131    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1132    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1133   
1134    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
1135
1136    CALL gather_omp(VarIn,Var_tmp)
1137!$OMP MASTER
1138    CALL gather2D_mpi(Var_tmp,VarOut)
1139!$OMP END MASTER   
1140
1141  END SUBROUTINE gather2D_l1
1142
1143 
1144  SUBROUTINE gather2D_l2(VarIn, VarOut)
1145    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1146    IMPLICIT NONE
1147 
1148    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1149    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1150   
1151    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
1152
1153    CALL gather_omp(VarIn,Var_tmp)
1154!$OMP MASTER
1155    CALL gather2D_mpi(Var_tmp,VarOut)
1156!$OMP END MASTER   
1157
1158  END SUBROUTINE gather2D_l2
1159
1160
1161  SUBROUTINE gather2D_l3(VarIn, VarOut)
1162    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1163    IMPLICIT NONE
1164 
1165    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1166    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1167   
1168    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
1169
1170    CALL gather_omp(VarIn,Var_tmp)
1171!$OMP MASTER
1172    CALL gather2D_mpi(Var_tmp,VarOut)
1173!$OMP END MASTER   
1174
1175  END SUBROUTINE gather2D_l3
1176 
1177
1178!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1179!! Definition des reduce_sum   --> 4D   !!
1180!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1181
1182! Les entiers
1183
1184  SUBROUTINE reduce_sum_i(VarIn, VarOut)
1185    IMPLICIT NONE
1186 
1187    INTEGER,INTENT(IN)  :: VarIn
1188    INTEGER,INTENT(OUT) :: VarOut
1189   
1190    INTEGER             :: Var_tmp
1191           
1192    CALL reduce_sum_omp(VarIn,Var_tmp)
1193!$OMP MASTER     
1194    CALL reduce_sum_mpi(Var_tmp,VarOut)
1195!$OMP END MASTER
1196 
1197  END SUBROUTINE reduce_sum_i 
1198
1199
1200  SUBROUTINE reduce_sum_i1(VarIn, VarOut)
1201    IMPLICIT NONE
1202 
1203    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
1204    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
1205   
1206    INTEGER,DIMENSION(SIZE(VarIn))   :: Var_tmp
1207           
1208    CALL reduce_sum_omp(VarIn,Var_tmp)
1209!$OMP MASTER     
1210    CALL reduce_sum_mpi(Var_tmp,VarOut)
1211!$OMP END MASTER
1212 
1213  END SUBROUTINE reduce_sum_i1 
1214
1215
1216  SUBROUTINE reduce_sum_i2(VarIn, VarOut)
1217    IMPLICIT NONE
1218 
1219    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
1220    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
1221   
1222    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
1223           
1224    CALL reduce_sum_omp(VarIn,Var_tmp)
1225!$OMP MASTER     
1226    CALL reduce_sum_mpi(Var_tmp,VarOut)
1227!$OMP END MASTER
1228 
1229  END SUBROUTINE reduce_sum_i2 
1230 
1231
1232  SUBROUTINE reduce_sum_i3(VarIn, VarOut)
1233    IMPLICIT NONE
1234 
1235    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
1236    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1237   
1238    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
1239           
1240    CALL reduce_sum_omp(VarIn,Var_tmp)
1241!$OMP MASTER     
1242    CALL reduce_sum_mpi(Var_tmp,VarOut)
1243!$OMP END MASTER
1244 
1245  END SUBROUTINE reduce_sum_i3 
1246
1247
1248  SUBROUTINE reduce_sum_i4(VarIn, VarOut)
1249    IMPLICIT NONE
1250 
1251    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
1252    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1253   
1254    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
1255           
1256    CALL reduce_sum_omp(VarIn,Var_tmp)
1257!$OMP MASTER     
1258    CALL reduce_sum_mpi(Var_tmp,VarOut)
1259!$OMP END MASTER
1260 
1261  END SUBROUTINE reduce_sum_i4 
1262
1263
1264! Les reels
1265
1266  SUBROUTINE reduce_sum_r(VarIn, VarOut)
1267    IMPLICIT NONE
1268 
1269    REAL,INTENT(IN)  :: VarIn
1270    REAL,INTENT(OUT) :: VarOut
1271   
1272    REAL             :: Var_tmp
1273           
1274    CALL reduce_sum_omp(VarIn,Var_tmp)
1275!$OMP MASTER     
1276    CALL reduce_sum_mpi(Var_tmp,VarOut)
1277!$OMP END MASTER
1278 
1279  END SUBROUTINE reduce_sum_r 
1280
1281
1282  SUBROUTINE reduce_sum_r1(VarIn, VarOut)
1283    IMPLICIT NONE
1284 
1285    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
1286    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
1287   
1288    REAL,DIMENSION(SIZE(VarIn))   :: Var_tmp
1289           
1290    CALL reduce_sum_omp(VarIn,Var_tmp)
1291!$OMP MASTER     
1292    CALL reduce_sum_mpi(Var_tmp,VarOut)
1293!$OMP END MASTER
1294 
1295  END SUBROUTINE reduce_sum_r1 
1296
1297
1298  SUBROUTINE reduce_sum_r2(VarIn, VarOut)
1299    IMPLICIT NONE
1300 
1301    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
1302    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1303   
1304    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
1305           
1306    CALL reduce_sum_omp(VarIn,Var_tmp)
1307!$OMP MASTER     
1308    CALL reduce_sum_mpi(Var_tmp,VarOut)
1309!$OMP END MASTER
1310 
1311  END SUBROUTINE reduce_sum_r2 
1312 
1313
1314  SUBROUTINE reduce_sum_r3(VarIn, VarOut)
1315    IMPLICIT NONE
1316 
1317    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
1318    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1319   
1320    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
1321           
1322    CALL reduce_sum_omp(VarIn,Var_tmp)
1323!$OMP MASTER     
1324    CALL reduce_sum_mpi(Var_tmp,VarOut)
1325!$OMP END MASTER
1326 
1327  END SUBROUTINE reduce_sum_r3 
1328
1329
1330  SUBROUTINE reduce_sum_r4(VarIn, VarOut)
1331    IMPLICIT NONE
1332 
1333    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
1334    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1335   
1336    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
1337           
1338    CALL reduce_sum_omp(VarIn,Var_tmp)
1339!$OMP MASTER     
1340    CALL reduce_sum_mpi(Var_tmp,VarOut)
1341!$OMP END MASTER
1342 
1343  END SUBROUTINE reduce_sum_r4 
1344
1345   
1346END MODULE mod_phys_lmdz_transfert_para
1347
Note: See TracBrowser for help on using the repository browser.