source: LMDZ4/trunk/libf/phylmd/mod_phys_lmdz_transfert_para.F90 @ 951

Last change on this file since 951 was 775, checked in by Laurent Fairhead, 17 years ago

Suite du merge entre la version et la HEAD: quelques modifications
de Yann sur le

LF

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.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, &
14                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, &
15                     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4
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!! -- Les reels -- !!
129 
130  SUBROUTINE bcast_r(var)
131  IMPLICIT NONE
132    REAL,INTENT(INOUT) :: Var
133
134!$OMP MASTER
135    CALL bcast_mpi(Var)
136!$OMP END MASTER
137    CALL bcast_omp(Var)
138   
139  END SUBROUTINE bcast_r
140
141  SUBROUTINE bcast_r1(var)
142  IMPLICIT NONE
143    REAL,INTENT(INOUT) :: Var(:)
144   
145!$OMP MASTER
146    CALL bcast_mpi(Var)
147!$OMP END MASTER
148    CALL bcast_omp(Var)
149   
150  END SUBROUTINE bcast_r1
151
152
153  SUBROUTINE bcast_r2(var)
154  IMPLICIT NONE
155    REAL,INTENT(INOUT) :: Var(:,:)
156   
157!$OMP MASTER
158    CALL bcast_mpi(Var)
159!$OMP END MASTER
160    CALL bcast_omp(Var)
161   
162  END SUBROUTINE bcast_r2
163
164
165  SUBROUTINE bcast_r3(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_r3
175
176
177  SUBROUTINE bcast_r4(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_r4
187
188
189!! -- Les booleens -- !!
190 
191  SUBROUTINE bcast_l(var)
192  IMPLICIT NONE
193    LOGICAL,INTENT(INOUT) :: Var
194!$OMP MASTER
195    CALL bcast_mpi(Var)
196!$OMP END MASTER
197    CALL bcast_omp(Var)
198   
199  END SUBROUTINE bcast_l
200
201  SUBROUTINE bcast_l1(var)
202  IMPLICIT NONE
203    LOGICAL,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_l1
211
212
213  SUBROUTINE bcast_l2(var)
214  IMPLICIT NONE
215    LOGICAL,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_l2
223
224
225  SUBROUTINE bcast_l3(var)
226  IMPLICIT NONE
227    LOGICAL,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_l3
235
236
237  SUBROUTINE bcast_l4(var)
238  IMPLICIT NONE
239    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
240   
241!$OMP MASTER
242    CALL bcast_mpi(Var)
243!$OMP END MASTER
244    CALL bcast_omp(Var)
245   
246  END SUBROUTINE bcast_l4
247
248
249!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
250!! Definition des Scatter   --> 4D   !!
251!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
252
253  SUBROUTINE scatter_i(VarIn, VarOut)
254    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
255    IMPLICIT NONE
256 
257    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
258    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
259
260    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
261   
262!$OMP MASTER
263      CALL scatter_mpi(VarIn,Var_tmp)
264!$OMP END MASTER
265
266      CALL scatter_omp(Var_tmp,Varout)
267   
268  END SUBROUTINE scatter_i
269
270
271  SUBROUTINE scatter_i1(VarIn, VarOut)
272    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
273    IMPLICIT NONE
274 
275    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
276    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
277
278    CALL body(VarIn,VarOut,SIZE(Varout,2))
279   
280  CONTAINS
281    SUBROUTINE body(VarIn,VarOut,s1)
282      INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
283      INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
284      INTEGER,INTENT(IN) :: s1
285      INTEGER,DIMENSION(klon_mpi,s1) :: Var_tmp
286     
287!$OMP MASTER
288        CALL scatter_mpi(VarIn,Var_tmp)
289!$OMP END MASTER
290        CALL scatter_omp(Var_tmp,Varout)
291    END SUBROUTINE body
292
293  END SUBROUTINE scatter_i1
294
295
296  SUBROUTINE scatter_i2(VarIn, VarOut)
297    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
298    IMPLICIT NONE
299 
300    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
301    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
302   
303    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3))
304   
305  CONTAINS
306    SUBROUTINE body(VarIn,VarOut,s1,s2)
307      INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
308      INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
309      INTEGER,INTENT(IN) :: s1,s2
310      INTEGER,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
311     
312!$OMP MASTER
313        CALL scatter_mpi(VarIn,Var_tmp)
314!$OMP END MASTER
315        CALL scatter_omp(Var_tmp,Varout)
316    END SUBROUTINE body
317   
318  END SUBROUTINE scatter_i2
319
320
321  SUBROUTINE scatter_i3(VarIn, VarOut)
322    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
323    IMPLICIT NONE
324 
325    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
326    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
327
328    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,3))
329   
330  CONTAINS
331    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
332      INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
333      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
334      INTEGER,INTENT(IN) :: s1,s2,s3
335      INTEGER,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
336     
337!$OMP MASTER
338        CALL scatter_mpi(VarIn,Var_tmp)
339!$OMP END MASTER
340        CALL scatter_omp(Var_tmp,Varout)
341    END SUBROUTINE body
342   
343  END SUBROUTINE scatter_i3
344
345
346  SUBROUTINE scatter_r(VarIn, VarOut)
347    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
348    IMPLICIT NONE
349 
350    REAL,INTENT(IN),DIMENSION(:) :: VarIn
351    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
352
353    REAL,DIMENSION(klon_mpi) :: Var_tmp
354   
355!$OMP MASTER
356      CALL scatter_mpi(VarIn,Var_tmp)
357!$OMP END MASTER
358
359      CALL scatter_omp(Var_tmp,Varout)
360   
361  END SUBROUTINE scatter_r
362
363
364  SUBROUTINE scatter_r1(VarIn, VarOut)
365    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
366    IMPLICIT NONE
367 
368    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
369    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
370
371    CALL body(VarIn,VarOut,SIZE(Varout,2))
372   
373  CONTAINS
374    SUBROUTINE body(VarIn,VarOut,s1)
375      REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
376      REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
377      INTEGER,INTENT(IN) :: s1
378      REAL,DIMENSION(klon_mpi,s1) :: Var_tmp
379     
380!$OMP MASTER
381        CALL scatter_mpi(VarIn,Var_tmp)
382!$OMP END MASTER
383        CALL scatter_omp(Var_tmp,Varout)
384    END SUBROUTINE body
385   
386  END SUBROUTINE scatter_r1
387
388
389  SUBROUTINE scatter_r2(VarIn, VarOut)
390    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
391    IMPLICIT NONE
392 
393    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
394    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
395   
396    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3))
397   
398  CONTAINS
399    SUBROUTINE body(VarIn,VarOut,s1,s2)
400      REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
401      REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
402      INTEGER,INTENT(IN) :: s1,s2
403      REAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
404     
405!$OMP MASTER
406        CALL scatter_mpi(VarIn,Var_tmp)
407!$OMP END MASTER
408        CALL scatter_omp(Var_tmp,Varout)
409    END SUBROUTINE body
410   
411  END SUBROUTINE scatter_r2
412
413
414  SUBROUTINE scatter_r3(VarIn, VarOut)
415    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
416    IMPLICIT NONE
417 
418    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
419    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
420
421    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,3))
422   
423  CONTAINS
424    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
425      REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
426      REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
427      INTEGER,INTENT(IN) :: s1,s2,s3
428      REAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
429     
430!$OMP MASTER
431        CALL scatter_mpi(VarIn,Var_tmp)
432!$OMP END MASTER
433        CALL scatter_omp(Var_tmp,Varout)
434    END SUBROUTINE body
435   
436  END SUBROUTINE scatter_r3
437 
438 
439
440  SUBROUTINE scatter_l(VarIn, VarOut)
441    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
442    IMPLICIT NONE
443 
444    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
445    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
446
447    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
448   
449!$OMP MASTER
450      CALL scatter_mpi(VarIn,Var_tmp)
451!$OMP END MASTER
452
453      CALL scatter_omp(Var_tmp,Varout)
454   
455  END SUBROUTINE scatter_l
456
457
458  SUBROUTINE scatter_l1(VarIn, VarOut)
459    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
460    IMPLICIT NONE
461 
462    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
463    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
464
465    CALL body(VarIn,VarOut,SIZE(Varout,2))
466   
467  CONTAINS
468    SUBROUTINE body(VarIn,VarOut,s1)
469      LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
470      LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
471      INTEGER,INTENT(IN) :: s1
472      LOGICAL,DIMENSION(klon_mpi,s1) :: Var_tmp
473     
474!$OMP MASTER
475        CALL scatter_mpi(VarIn,Var_tmp)
476!$OMP END MASTER
477        CALL scatter_omp(Var_tmp,Varout)
478    END SUBROUTINE body
479   
480  END SUBROUTINE scatter_l1
481
482
483  SUBROUTINE scatter_l2(VarIn, VarOut)
484    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
485    IMPLICIT NONE
486 
487    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
488    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
489   
490    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3))
491   
492  CONTAINS
493    SUBROUTINE body(VarIn,VarOut,s1,s2)
494      LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
495      LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
496      INTEGER,INTENT(IN) :: s1,s2
497      LOGICAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
498     
499!$OMP MASTER
500        CALL scatter_mpi(VarIn,Var_tmp)
501!$OMP END MASTER
502        CALL scatter_omp(Var_tmp,Varout)
503    END SUBROUTINE body
504
505  END SUBROUTINE scatter_l2
506
507
508  SUBROUTINE scatter_l3(VarIn, VarOut)
509    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
510    IMPLICIT NONE
511 
512    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
513    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
514
515    CALL body(VarIn,VarOut,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,3))
516   
517  CONTAINS
518    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
519      LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
520      LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
521      INTEGER,INTENT(IN) :: s1,s2,s3
522      LOGICAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
523     
524!$OMP MASTER
525        CALL scatter_mpi(VarIn,Var_tmp)
526!$OMP END MASTER
527        CALL scatter_omp(Var_tmp,Varout)
528    END SUBROUTINE body
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    CALL body(VarIn,VarOut,SIZE(VarIn,2))
565   
566  CONTAINS
567    SUBROUTINE body(VarIn,VarOut,s1)
568      INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
569      INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
570      INTEGER,INTENT(IN) :: s1
571      INTEGER,DIMENSION(klon_mpi,s1) :: Var_tmp
572     
573      CALL gather_omp(VarIn,Var_tmp)
574!$OMP MASTER
575      CALL gather_mpi(Var_tmp,Varout)
576!$OMP END MASTER
577
578    END SUBROUTINE body
579 
580  END SUBROUTINE gather_i1
581
582
583  SUBROUTINE gather_i2(VarIn, VarOut)
584    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
585    IMPLICIT NONE
586 
587    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
588    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
589   
590    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
591   
592  CONTAINS
593    SUBROUTINE body(VarIn,VarOut,s1,s2)
594      INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
595      INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
596      INTEGER,INTENT(IN) :: s1,s2
597      INTEGER,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
598     
599      CALL gather_omp(VarIn,Var_tmp)
600!$OMP MASTER
601      CALL gather_mpi(Var_tmp,Varout)
602!$OMP END MASTER
603
604    END SUBROUTINE body
605 
606  END SUBROUTINE gather_i2
607
608
609  SUBROUTINE gather_i3(VarIn, VarOut)
610    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
611    IMPLICIT NONE
612 
613    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
614    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
615   
616    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
617   
618  CONTAINS
619    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
620      INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
621      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
622      INTEGER,INTENT(IN) :: s1,s2,s3
623      INTEGER,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
624     
625      CALL gather_omp(VarIn,Var_tmp)
626!$OMP MASTER
627      CALL gather_mpi(Var_tmp,Varout)
628!$OMP END MASTER
629
630    END SUBROUTINE body
631 
632  END SUBROUTINE gather_i3
633
634
635!!!!! --> Les reels
636
637  SUBROUTINE gather_r(VarIn, VarOut)
638    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
639    IMPLICIT NONE
640 
641    REAL,INTENT(IN),DIMENSION(:) :: VarIn
642    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
643   
644    REAL, DIMENSION(klon_mpi) :: Var_tmp
645   
646    CALL gather_omp(VarIn,Var_tmp)
647!$OMP MASTER
648    CALL gather_mpi(Var_tmp,VarOut)
649!$OMP END MASTER
650 
651  END SUBROUTINE gather_r
652
653
654  SUBROUTINE gather_r1(VarIn, VarOut)
655    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
656    IMPLICIT NONE
657 
658    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
659    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
660   
661    CALL body(VarIn,VarOut,SIZE(VarIn,2))
662   
663  CONTAINS
664    SUBROUTINE body(VarIn,VarOut,s1)
665      REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
666      REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
667      INTEGER,INTENT(IN) :: s1
668      REAL,DIMENSION(klon_mpi,s1) :: 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 body
676 
677  END SUBROUTINE gather_r1
678
679
680  SUBROUTINE gather_r2(VarIn, VarOut)
681    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
682    IMPLICIT NONE
683 
684    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
685    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
686   
687    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
688   
689  CONTAINS
690    SUBROUTINE body(VarIn,VarOut,s1,s2)
691      REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
692      REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
693      INTEGER,INTENT(IN) :: s1,s2
694      REAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
695     
696      CALL gather_omp(VarIn,Var_tmp)
697!$OMP MASTER
698      CALL gather_mpi(Var_tmp,Varout)
699!$OMP END MASTER
700
701    END SUBROUTINE body
702 
703  END SUBROUTINE gather_r2
704
705
706  SUBROUTINE gather_r3(VarIn, VarOut)
707    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
708    IMPLICIT NONE
709 
710    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
711    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
712   
713    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
714   
715  CONTAINS
716    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
717      REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
718      REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
719      INTEGER,INTENT(IN) :: s1,s2,s3
720      REAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
721     
722      CALL gather_omp(VarIn,Var_tmp)
723!$OMP MASTER
724      CALL gather_mpi(Var_tmp,Varout)
725!$OMP END MASTER
726
727    END SUBROUTINE body
728 
729  END SUBROUTINE gather_r3
730
731
732!!!!! --> Les booleens
733
734  SUBROUTINE gather_l(VarIn, VarOut)
735    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
736    IMPLICIT NONE
737 
738    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
739    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
740   
741    LOGICAL, DIMENSION(klon_mpi) :: Var_tmp
742   
743    CALL gather_omp(VarIn,Var_tmp)
744!$OMP MASTER
745    CALL gather_mpi(Var_tmp,VarOut)
746!$OMP END MASTER
747 
748  END SUBROUTINE gather_l
749
750
751  SUBROUTINE gather_l1(VarIn, VarOut)
752    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
753    IMPLICIT NONE
754 
755    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
756    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
757   
758    CALL body(VarIn,VarOut,SIZE(VarIn,2))
759   
760  CONTAINS
761    SUBROUTINE body(VarIn,VarOut,s1)
762      LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
763      LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
764      INTEGER,INTENT(IN) :: s1
765      LOGICAL,DIMENSION(klon_mpi,s1) :: Var_tmp
766     
767      CALL gather_omp(VarIn,Var_tmp)
768!$OMP MASTER
769      CALL gather_mpi(Var_tmp,Varout)
770!$OMP END MASTER
771
772    END SUBROUTINE body
773 
774  END SUBROUTINE gather_l1
775
776
777  SUBROUTINE gather_l2(VarIn, VarOut)
778    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
779    IMPLICIT NONE
780 
781    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
782    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
783   
784    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
785   
786  CONTAINS
787    SUBROUTINE body(VarIn,VarOut,s1,s2)
788      LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
789      LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
790      INTEGER,INTENT(IN) :: s1,s2
791      LOGICAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
792     
793      CALL gather_omp(VarIn,Var_tmp)
794!$OMP MASTER
795      CALL gather_mpi(Var_tmp,Varout)
796!$OMP END MASTER
797
798    END SUBROUTINE body
799 
800  END SUBROUTINE gather_l2
801
802
803  SUBROUTINE gather_l3(VarIn, VarOut)
804    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
805    IMPLICIT NONE
806 
807    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
808    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
809   
810    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
811   
812  CONTAINS
813    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
814      LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
815      LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
816      INTEGER,INTENT(IN) :: s1,s2,s3
817      LOGICAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
818     
819      CALL gather_omp(VarIn,Var_tmp)
820!$OMP MASTER
821      CALL gather_mpi(Var_tmp,Varout)
822!$OMP END MASTER
823
824    END SUBROUTINE body
825 
826  END SUBROUTINE gather_l3
827
828
829!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
830!! Definition des Scatter2D   --> 4D   !!
831!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
832
833
834!!!!! --> Les entiers
835
836  SUBROUTINE scatter2D_i(VarIn, VarOut)
837    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
838    IMPLICIT NONE
839 
840    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
841    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
842
843    INTEGER,DIMENSION(klon_mpi) :: Var_tmp   
844
845!$OMP MASTER   
846    CALL scatter2D_mpi(VarIn,Var_tmp)
847!$OMP END MASTER
848    CALL scatter_omp(Var_tmp,VarOut)
849
850  END SUBROUTINE scatter2D_i
851
852
853  SUBROUTINE scatter2D_i1(VarIn, VarOut)
854    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
855    IMPLICIT NONE
856 
857    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
858    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
859
860    CALL body(VarIn,VarOut,SIZE(VarOut,2))
861   
862  CONTAINS
863    SUBROUTINE body(VarIn,VarOut,s1)
864      INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
865      INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
866      INTEGER,INTENT(IN) :: s1
867      INTEGER,DIMENSION(klon_mpi,s1) :: Var_tmp
868     
869!$OMP MASTER   
870      CALL scatter2D_mpi(VarIn,Var_tmp)
871!$OMP END MASTER
872      CALL scatter_omp(Var_tmp,VarOut)
873
874    END SUBROUTINE body
875
876  END SUBROUTINE scatter2D_i1
877 
878
879  SUBROUTINE scatter2D_i2(VarIn, VarOut)
880    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
881    IMPLICIT NONE
882 
883    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
884    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
885
886    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3))
887   
888  CONTAINS
889    SUBROUTINE body(VarIn,VarOut,s1,s2)
890      INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
891      INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
892      INTEGER,INTENT(IN) :: s1,s2
893      INTEGER,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
894     
895!$OMP MASTER   
896      CALL scatter2D_mpi(VarIn,Var_tmp)
897!$OMP END MASTER
898      CALL scatter_omp(Var_tmp,VarOut)
899
900    END SUBROUTINE body
901
902  END SUBROUTINE scatter2D_i2 
903
904
905  SUBROUTINE scatter2D_i3(VarIn, VarOut)
906    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
907    IMPLICIT NONE
908 
909    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
910    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
911
912    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4))
913   
914  CONTAINS
915    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
916      INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
917      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
918      INTEGER,INTENT(IN) :: s1,s2,s3
919      INTEGER,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
920     
921!$OMP MASTER   
922      CALL scatter2D_mpi(VarIn,Var_tmp)
923!$OMP END MASTER
924      CALL scatter_omp(Var_tmp,VarOut)
925
926    END SUBROUTINE body
927
928  END SUBROUTINE scatter2D_i3
929 
930
931!!!!! --> Les reels
932
933  SUBROUTINE scatter2D_r(VarIn, VarOut)
934    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
935    IMPLICIT NONE
936 
937    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
938    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
939
940    REAL,DIMENSION(klon_mpi) :: Var_tmp   
941
942!$OMP MASTER   
943    CALL scatter2D_mpi(VarIn,Var_tmp)
944!$OMP END MASTER
945    CALL scatter_omp(Var_tmp,VarOut)
946
947  END SUBROUTINE scatter2D_r
948
949
950  SUBROUTINE scatter2D_r1(VarIn, VarOut)
951    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
952    IMPLICIT NONE
953 
954    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
955    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
956
957    CALL body(VarIn,VarOut,SIZE(VarOut,2))
958   
959  CONTAINS
960    SUBROUTINE body(VarIn,VarOut,s1)
961      REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
962      REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
963      INTEGER,INTENT(IN) :: s1
964      REAL,DIMENSION(klon_mpi,s1) :: Var_tmp
965     
966!$OMP MASTER   
967      CALL scatter2D_mpi(VarIn,Var_tmp)
968!$OMP END MASTER
969      CALL scatter_omp(Var_tmp,VarOut)
970
971    END SUBROUTINE body
972
973  END SUBROUTINE scatter2D_r1
974 
975
976  SUBROUTINE scatter2D_r2(VarIn, VarOut)
977    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
978    IMPLICIT NONE
979 
980    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
981    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
982
983    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3))
984   
985  CONTAINS
986    SUBROUTINE body(VarIn,VarOut,s1,s2)
987      REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
988      REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
989      INTEGER,INTENT(IN) :: s1,s2
990      REAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
991     
992!$OMP MASTER   
993      CALL scatter2D_mpi(VarIn,Var_tmp)
994!$OMP END MASTER
995      CALL scatter_omp(Var_tmp,VarOut)
996
997    END SUBROUTINE body
998
999  END SUBROUTINE scatter2D_r2 
1000
1001
1002  SUBROUTINE scatter2D_r3(VarIn, VarOut)
1003    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1004    IMPLICIT NONE
1005 
1006    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
1007    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1008
1009    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4))
1010   
1011  CONTAINS
1012    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1013      REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
1014      REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1015      INTEGER,INTENT(IN) :: s1,s2,s3
1016      REAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
1017     
1018!$OMP MASTER   
1019      CALL scatter2D_mpi(VarIn,Var_tmp)
1020!$OMP END MASTER
1021      CALL scatter_omp(Var_tmp,VarOut)
1022
1023    END SUBROUTINE body
1024
1025  END SUBROUTINE scatter2D_r3
1026   
1027   
1028!!!!! --> Les booleens
1029
1030
1031  SUBROUTINE scatter2D_l(VarIn, VarOut)
1032    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1033    IMPLICIT NONE
1034 
1035    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1036    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
1037
1038    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp   
1039
1040!$OMP MASTER   
1041    CALL scatter2D_mpi(VarIn,Var_tmp)
1042!$OMP END MASTER
1043    CALL scatter_omp(Var_tmp,VarOut)
1044
1045  END SUBROUTINE scatter2D_l
1046
1047
1048  SUBROUTINE scatter2D_l1(VarIn, VarOut)
1049    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1050    IMPLICIT NONE
1051 
1052    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1053    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1054
1055    CALL body(VarIn,VarOut,SIZE(VarOut,2))
1056   
1057  CONTAINS
1058    SUBROUTINE body(VarIn,VarOut,s1)
1059      LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1060      LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1061      INTEGER,INTENT(IN) :: s1
1062      LOGICAL,DIMENSION(klon_mpi,s1) :: Var_tmp
1063     
1064!$OMP MASTER   
1065      CALL scatter2D_mpi(VarIn,Var_tmp)
1066!$OMP END MASTER
1067      CALL scatter_omp(Var_tmp,VarOut)
1068
1069    END SUBROUTINE body
1070
1071  END SUBROUTINE scatter2D_l1
1072 
1073
1074  SUBROUTINE scatter2D_l2(VarIn, VarOut)
1075    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1076    IMPLICIT NONE
1077 
1078    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1079    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1080
1081    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3))
1082   
1083  CONTAINS
1084    SUBROUTINE body(VarIn,VarOut,s1,s2)
1085      LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1086      LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1087      INTEGER,INTENT(IN) :: s1,s2
1088      LOGICAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
1089     
1090!$OMP MASTER   
1091      CALL scatter2D_mpi(VarIn,Var_tmp)
1092!$OMP END MASTER
1093      CALL scatter_omp(Var_tmp,VarOut)
1094
1095    END SUBROUTINE body
1096
1097  END SUBROUTINE scatter2D_l2 
1098
1099
1100  SUBROUTINE scatter2D_l3(VarIn, VarOut)
1101    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1102    IMPLICIT NONE
1103 
1104    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
1105    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1106
1107    CALL body(VarIn,VarOut,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4))
1108   
1109  CONTAINS
1110    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1111      LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
1112      LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1113      INTEGER,INTENT(IN) :: s1,s2,s3
1114      LOGICAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
1115     
1116!$OMP MASTER   
1117      CALL scatter2D_mpi(VarIn,Var_tmp)
1118!$OMP END MASTER
1119      CALL scatter_omp(Var_tmp,VarOut)
1120
1121    END SUBROUTINE body
1122
1123  END SUBROUTINE scatter2D_l3
1124
1125
1126!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1127!! Definition des Gather2D   --> 4D   !!
1128!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1129
1130!!!!! --> Les entiers
1131
1132  SUBROUTINE gather2D_i(VarIn, VarOut)
1133    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1134    IMPLICIT NONE
1135 
1136    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
1137    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
1138   
1139    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
1140
1141    CALL gather_omp(VarIn,Var_tmp)
1142!$OMP MASTER
1143    CALL gather2D_mpi(Var_tmp,VarOut)
1144!$OMP END MASTER   
1145
1146  END SUBROUTINE gather2D_i
1147 
1148
1149  SUBROUTINE gather2D_i1(VarIn, VarOut)
1150    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1151    IMPLICIT NONE
1152    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
1153    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1154   
1155    CALL body(VarIn,VarOut,SIZE(VarIn,2))
1156   
1157  CONTAINS
1158    SUBROUTINE body(VarIn,VarOut,s1)
1159      INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
1160      INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1161      INTEGER,INTENT(IN) :: s1
1162      INTEGER,DIMENSION(klon_mpi,s1) :: Var_tmp
1163     
1164      CALL gather_omp(VarIn,Var_tmp)
1165!$OMP MASTER
1166      CALL gather2D_mpi(Var_tmp,VarOut)
1167!$OMP END MASTER   
1168
1169    END SUBROUTINE body
1170
1171  END SUBROUTINE gather2D_i1
1172
1173 
1174  SUBROUTINE gather2D_i2(VarIn, VarOut)
1175    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1176    IMPLICIT NONE
1177 
1178    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1179    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1180   
1181    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
1182   
1183  CONTAINS
1184    SUBROUTINE body(VarIn,VarOut,s1,s2)
1185      INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1186      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1187      INTEGER,INTENT(IN) :: s1,s2
1188      INTEGER,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
1189     
1190      CALL gather_omp(VarIn,Var_tmp)
1191!$OMP MASTER
1192      CALL gather2D_mpi(Var_tmp,VarOut)
1193!$OMP END MASTER   
1194
1195    END SUBROUTINE body
1196
1197  END SUBROUTINE gather2D_i2
1198
1199
1200  SUBROUTINE gather2D_i3(VarIn, VarOut)
1201    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1202    IMPLICIT NONE
1203 
1204    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1205    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1206   
1207    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
1208   
1209  CONTAINS
1210    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1211      INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1212      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1213      INTEGER,INTENT(IN) :: s1,s2,s3
1214      INTEGER,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
1215     
1216      CALL gather_omp(VarIn,Var_tmp)
1217!$OMP MASTER
1218      CALL gather2D_mpi(Var_tmp,VarOut)
1219!$OMP END MASTER   
1220
1221    END SUBROUTINE body
1222
1223  END SUBROUTINE gather2D_i3
1224
1225
1226!!!!! --> Les reels
1227
1228  SUBROUTINE gather2D_r(VarIn, VarOut)
1229    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1230    IMPLICIT NONE
1231 
1232    REAL,INTENT(IN),DIMENSION(:) :: VarIn
1233    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1234   
1235    REAL,DIMENSION(klon_mpi) :: Var_tmp
1236
1237    CALL gather_omp(VarIn,Var_tmp)
1238!$OMP MASTER
1239    CALL gather2D_mpi(Var_tmp,VarOut)
1240!$OMP END MASTER   
1241
1242  END SUBROUTINE gather2D_r
1243 
1244
1245  SUBROUTINE gather2D_r1(VarIn, VarOut)
1246    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1247    IMPLICIT NONE
1248 
1249    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1250    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1251   
1252    CALL body(VarIn,VarOut,SIZE(VarIn,2))
1253   
1254  CONTAINS
1255    SUBROUTINE body(VarIn,VarOut,s1)
1256      REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1257      REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1258      INTEGER,INTENT(IN) :: s1
1259      REAL,DIMENSION(klon_mpi,s1) :: Var_tmp
1260     
1261      CALL gather_omp(VarIn,Var_tmp)
1262!$OMP MASTER
1263      CALL gather2D_mpi(Var_tmp,VarOut)
1264!$OMP END MASTER   
1265
1266    END SUBROUTINE body
1267
1268  END SUBROUTINE gather2D_r1
1269
1270 
1271  SUBROUTINE gather2D_r2(VarIn, VarOut)
1272    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1273    IMPLICIT NONE
1274 
1275    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1276    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1277   
1278    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
1279   
1280  CONTAINS
1281    SUBROUTINE body(VarIn,VarOut,s1,s2)
1282      REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1283      REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1284      INTEGER,INTENT(IN) :: s1,s2
1285      REAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
1286     
1287      CALL gather_omp(VarIn,Var_tmp)
1288!$OMP MASTER
1289      CALL gather2D_mpi(Var_tmp,VarOut)
1290!$OMP END MASTER   
1291
1292    END SUBROUTINE body
1293
1294  END SUBROUTINE gather2D_r2
1295
1296
1297  SUBROUTINE gather2D_r3(VarIn, VarOut)
1298    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1299    IMPLICIT NONE
1300 
1301    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1302    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1303   
1304    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
1305   
1306  CONTAINS
1307    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1308      REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1309      REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1310      INTEGER,INTENT(IN) :: s1,s2,s3
1311      REAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
1312     
1313      CALL gather_omp(VarIn,Var_tmp)
1314!$OMP MASTER
1315      CALL gather2D_mpi(Var_tmp,VarOut)
1316!$OMP END MASTER   
1317
1318    END SUBROUTINE body
1319
1320  END SUBROUTINE gather2D_r3
1321 
1322
1323!!!!! --> Les booleens
1324
1325  SUBROUTINE gather2D_l(VarIn, VarOut)
1326    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1327    IMPLICIT NONE
1328 
1329    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
1330    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1331   
1332    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
1333
1334    CALL gather_omp(VarIn,Var_tmp)
1335!$OMP MASTER
1336    CALL gather2D_mpi(Var_tmp,VarOut)
1337!$OMP END MASTER   
1338
1339  END SUBROUTINE gather2D_l
1340 
1341
1342  SUBROUTINE gather2D_l1(VarIn, VarOut)
1343    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1344    IMPLICIT NONE
1345 
1346    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1347    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1348   
1349    CALL body(VarIn,VarOut,SIZE(VarIn,2))
1350   
1351  CONTAINS
1352    SUBROUTINE body(VarIn,VarOut,s1)
1353      LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1354      LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1355      INTEGER,INTENT(IN) :: s1
1356      LOGICAL,DIMENSION(klon_mpi,s1) :: Var_tmp
1357     
1358      CALL gather_omp(VarIn,Var_tmp)
1359!$OMP MASTER
1360      CALL gather2D_mpi(Var_tmp,VarOut)
1361!$OMP END MASTER   
1362
1363    END SUBROUTINE body
1364
1365  END SUBROUTINE gather2D_l1
1366
1367 
1368  SUBROUTINE gather2D_l2(VarIn, VarOut)
1369    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1370    IMPLICIT NONE
1371 
1372    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1373    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1374   
1375    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3))
1376   
1377  CONTAINS
1378    SUBROUTINE body(VarIn,VarOut,s1,s2)
1379      LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1380      LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1381      INTEGER,INTENT(IN) :: s1,s2
1382      LOGICAL,DIMENSION(klon_mpi,s1,s2) :: Var_tmp
1383     
1384      CALL gather_omp(VarIn,Var_tmp)
1385!$OMP MASTER
1386      CALL gather2D_mpi(Var_tmp,VarOut)
1387!$OMP END MASTER   
1388
1389    END SUBROUTINE body
1390
1391  END SUBROUTINE gather2D_l2
1392
1393
1394  SUBROUTINE gather2D_l3(VarIn, VarOut)
1395    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
1396    IMPLICIT NONE
1397 
1398    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1399    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1400   
1401    CALL body(VarIn,VarOut,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
1402   
1403  CONTAINS
1404    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1405      LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1406      LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
1407      INTEGER,INTENT(IN) :: s1,s2,s3
1408      LOGICAL,DIMENSION(klon_mpi,s1,s2,s3) :: Var_tmp
1409     
1410      CALL gather_omp(VarIn,Var_tmp)
1411!$OMP MASTER
1412      CALL gather2D_mpi(Var_tmp,VarOut)
1413!$OMP END MASTER   
1414
1415    END SUBROUTINE body
1416
1417  END SUBROUTINE gather2D_l3
1418 
1419
1420!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1421!! Definition des reduce_sum   --> 4D   !!
1422!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1423
1424! Les entiers
1425
1426  SUBROUTINE reduce_sum_i(VarIn, VarOut)
1427    IMPLICIT NONE
1428 
1429    INTEGER,INTENT(IN)  :: VarIn
1430    INTEGER,INTENT(OUT) :: VarOut
1431   
1432    INTEGER             :: Var_tmp
1433           
1434    CALL reduce_sum_omp(VarIn,Var_tmp)
1435!$OMP MASTER     
1436    CALL reduce_sum_mpi(Var_tmp,VarOut)
1437!$OMP END MASTER
1438 
1439  END SUBROUTINE reduce_sum_i 
1440
1441
1442  SUBROUTINE reduce_sum_i1(VarIn, VarOut)
1443    IMPLICIT NONE
1444 
1445    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
1446    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
1447   
1448    CALL body(VarIn,VarOut,SIZE(VarIn,1))
1449   
1450  CONTAINS
1451    SUBROUTINE body(VarIn,VarOut,s1)
1452      INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
1453      INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
1454      INTEGER,INTENT(IN) :: s1
1455      INTEGER,DIMENSION(s1) :: Var_tmp
1456     
1457      CALL reduce_sum_omp(VarIn,Var_tmp)
1458!$OMP MASTER     
1459      CALL reduce_sum_mpi(Var_tmp,VarOut)
1460!$OMP END MASTER
1461
1462    END SUBROUTINE body
1463 
1464  END SUBROUTINE reduce_sum_i1 
1465
1466
1467  SUBROUTINE reduce_sum_i2(VarIn, VarOut)
1468    IMPLICIT NONE
1469 
1470    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
1471    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
1472   
1473    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2))
1474   
1475  CONTAINS
1476    SUBROUTINE body(VarIn,VarOut,s1,s2)
1477      INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
1478      INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
1479      INTEGER,INTENT(IN) :: s1,s2
1480      INTEGER,DIMENSION(s1,s2) :: Var_tmp
1481     
1482      CALL reduce_sum_omp(VarIn,Var_tmp)
1483!$OMP MASTER     
1484      CALL reduce_sum_mpi(Var_tmp,VarOut)
1485!$OMP END MASTER
1486
1487    END SUBROUTINE body
1488 
1489  END SUBROUTINE reduce_sum_i2 
1490 
1491
1492  SUBROUTINE reduce_sum_i3(VarIn, VarOut)
1493    IMPLICIT NONE
1494 
1495    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
1496    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1497   
1498    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))
1499   
1500  CONTAINS
1501    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1502      INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1503      INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1504      INTEGER,INTENT(IN) :: s1,s2,s3
1505      INTEGER,DIMENSION(s1,s2,s3) :: Var_tmp
1506     
1507      CALL reduce_sum_omp(VarIn,Var_tmp)
1508!$OMP MASTER     
1509      CALL reduce_sum_mpi(Var_tmp,VarOut)
1510!$OMP END MASTER
1511
1512    END SUBROUTINE body
1513 
1514  END SUBROUTINE reduce_sum_i3 
1515
1516
1517  SUBROUTINE reduce_sum_i4(VarIn, VarOut)
1518    IMPLICIT NONE
1519 
1520    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
1521    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1522   
1523    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
1524   
1525  CONTAINS
1526    SUBROUTINE body(VarIn,VarOut,s1,s2,s3,s4)
1527      INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1528      INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1529      INTEGER,INTENT(IN) :: s1,s2,s3,s4
1530      INTEGER,DIMENSION(s1,s2,s3,s4) :: Var_tmp
1531     
1532      CALL reduce_sum_omp(VarIn,Var_tmp)
1533!$OMP MASTER     
1534      CALL reduce_sum_mpi(Var_tmp,VarOut)
1535!$OMP END MASTER
1536
1537    END SUBROUTINE body
1538   
1539  END SUBROUTINE reduce_sum_i4 
1540
1541
1542! Les reels
1543
1544  SUBROUTINE reduce_sum_r(VarIn, VarOut)
1545    IMPLICIT NONE
1546 
1547    REAL,INTENT(IN)  :: VarIn
1548    REAL,INTENT(OUT) :: VarOut
1549   
1550    REAL             :: Var_tmp
1551           
1552    CALL reduce_sum_omp(VarIn,Var_tmp)
1553!$OMP MASTER     
1554    CALL reduce_sum_mpi(Var_tmp,VarOut)
1555!$OMP END MASTER
1556 
1557  END SUBROUTINE reduce_sum_r 
1558
1559
1560  SUBROUTINE reduce_sum_r1(VarIn, VarOut)
1561    IMPLICIT NONE
1562 
1563    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
1564    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
1565   
1566    CALL body(VarIn,VarOut,SIZE(VarIn,1))
1567   
1568  CONTAINS
1569    SUBROUTINE body(VarIn,VarOut,s1)
1570      REAL,INTENT(IN),DIMENSION(:) :: VarIn
1571      REAL,INTENT(OUT),DIMENSION(:) :: VarOut
1572      INTEGER,INTENT(IN) :: s1
1573      REAL,DIMENSION(s1) :: Var_tmp
1574     
1575      CALL reduce_sum_omp(VarIn,Var_tmp)
1576!$OMP MASTER     
1577      CALL reduce_sum_mpi(Var_tmp,VarOut)
1578!$OMP END MASTER
1579
1580    END SUBROUTINE body
1581 
1582  END SUBROUTINE reduce_sum_r1 
1583
1584
1585  SUBROUTINE reduce_sum_r2(VarIn, VarOut)
1586    IMPLICIT NONE
1587 
1588    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
1589    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1590   
1591    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2))
1592   
1593  CONTAINS
1594    SUBROUTINE body(VarIn,VarOut,s1,s2)
1595      REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
1596      REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
1597      INTEGER,INTENT(IN) :: s1,s2
1598      REAL,DIMENSION(s1,s2) :: Var_tmp
1599     
1600      CALL reduce_sum_omp(VarIn,Var_tmp)
1601!$OMP MASTER     
1602      CALL reduce_sum_mpi(Var_tmp,VarOut)
1603!$OMP END MASTER
1604
1605    END SUBROUTINE body
1606 
1607  END SUBROUTINE reduce_sum_r2 
1608 
1609
1610  SUBROUTINE reduce_sum_r3(VarIn, VarOut)
1611    IMPLICIT NONE
1612 
1613    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
1614    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1615   
1616    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))
1617   
1618  CONTAINS
1619    SUBROUTINE body(VarIn,VarOut,s1,s2,s3)
1620      REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
1621      REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
1622      INTEGER,INTENT(IN) :: s1,s2,s3
1623      REAL,DIMENSION(s1,s2,s3) :: Var_tmp
1624     
1625      CALL reduce_sum_omp(VarIn,Var_tmp)
1626!$OMP MASTER     
1627      CALL reduce_sum_mpi(Var_tmp,VarOut)
1628!$OMP END MASTER
1629
1630    END SUBROUTINE body
1631 
1632  END SUBROUTINE reduce_sum_r3 
1633
1634
1635  SUBROUTINE reduce_sum_r4(VarIn, VarOut)
1636    IMPLICIT NONE
1637 
1638    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
1639    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1640   
1641    CALL body(VarIn,VarOut,SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))
1642   
1643  CONTAINS
1644    SUBROUTINE body(VarIn,VarOut,s1,s2,s3,s4)
1645      REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
1646      REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
1647      INTEGER,INTENT(IN) :: s1,s2,s3,s4
1648      REAL,DIMENSION(s1,s2,s3,s4) :: Var_tmp
1649     
1650      CALL reduce_sum_omp(VarIn,Var_tmp)
1651!$OMP MASTER     
1652      CALL reduce_sum_mpi(Var_tmp,VarOut)
1653!$OMP END MASTER
1654
1655    END SUBROUTINE body
1656   
1657  END SUBROUTINE reduce_sum_r4 
1658
1659   
1660END MODULE mod_phys_lmdz_transfert_para
1661
Note: See TracBrowser for help on using the repository browser.