source: codes/icosagcm/branches/SATURN_DYNAMICO/ICOSAGCM/src/transfert.F90 @ 268

Last change on this file since 268 was 261, checked in by ymipsl, 10 years ago

Add bcast functionnalities for MPI

YM

File size: 4.7 KB
Line 
1MODULE transfert_mod
2
3#ifdef CPP_USING_MPI
4  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request=>transfert_request_mpi, req_i1,req_e1_vect, &
5                                req_e1_scal, req_i0, req_e0_vect, req_e0_scal, request_add_point, create_request, gather_field, scatter_field, &
6                                t_message,init_message=>init_message_mpi,transfert_message=>transfert_message_mpi,  &
7                                send_message=>send_message_mpi,test_message=>test_message_mpi,wait_message=>wait_message_mpi,barrier, &
8                                bcast_mpi
9#else
10  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request=>transfert_request_seq, req_i1,req_e1_vect, &
11                                req_e1_scal,req_i0, req_e0_vect, req_e0_scal, request_add_point, create_request, gather_field, scatter_field,&
12                                t_message,init_message=>init_message_seq,transfert_message=>transfert_message_seq,  &
13                                send_message=>send_message_seq,test_message=>test_message_seq,wait_message=>wait_message_seq,barrier, &
14                                bcast_mpi
15#endif
16
17  USE transfert_omp_mod
18 
19  INTERFACE bcast
20    MODULE PROCEDURE bcast_c,                                     &
21                     bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4, &
22                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, &
23                     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4
24
25  END INTERFACE
26
27
28CONTAINS
29
30
31!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32!! Definition des Broadcast --> 4D   !!
33!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34
35!! -- Les chaine de charactère -- !!
36
37  SUBROUTINE bcast_c(var)
38  IMPLICIT NONE
39    CHARACTER(LEN=*),INTENT(INOUT) :: Var
40   
41!$OMP MASTER
42    CALL bcast_mpi(Var)
43!$OMP END MASTER
44    CALL bcast_omp(Var)
45   
46  END SUBROUTINE bcast_c
47
48!! -- Les entiers -- !!
49 
50  SUBROUTINE bcast_i(var)
51  IMPLICIT NONE
52    INTEGER,INTENT(INOUT) :: Var
53!$OMP MASTER
54    CALL bcast_mpi(Var)
55!$OMP END MASTER
56    CALL bcast_omp(Var)
57   
58  END SUBROUTINE bcast_i
59
60  SUBROUTINE bcast_i1(var)
61  IMPLICIT NONE
62    INTEGER,INTENT(INOUT) :: Var(:)
63   
64!$OMP MASTER
65    CALL bcast_mpi(Var)
66!$OMP END MASTER
67    CALL bcast_omp(Var)
68   
69  END SUBROUTINE bcast_i1
70
71
72  SUBROUTINE bcast_i2(var)
73  IMPLICIT NONE
74    INTEGER,INTENT(INOUT) :: Var(:,:)
75   
76!$OMP MASTER
77    CALL bcast_mpi(Var)
78!$OMP END MASTER
79    CALL bcast_omp(Var)
80   
81  END SUBROUTINE bcast_i2
82
83
84  SUBROUTINE bcast_i3(var)
85  IMPLICIT NONE
86    INTEGER,INTENT(INOUT) :: Var(:,:,:)
87   
88!$OMP MASTER
89    CALL bcast_mpi(Var)
90!$OMP END MASTER
91    CALL bcast_omp(Var)
92   
93  END SUBROUTINE bcast_i3
94
95
96  SUBROUTINE bcast_i4(var)
97  IMPLICIT NONE
98    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
99   
100!$OMP MASTER
101    CALL bcast_mpi(Var)
102!$OMP END MASTER
103    CALL bcast_omp(Var)
104   
105  END SUBROUTINE bcast_i4
106
107 
108!! -- Les reels -- !!
109 
110  SUBROUTINE bcast_r(var)
111  IMPLICIT NONE
112    REAL,INTENT(INOUT) :: Var
113
114!$OMP MASTER
115    CALL bcast_mpi(Var)
116!$OMP END MASTER
117    CALL bcast_omp(Var)
118   
119  END SUBROUTINE bcast_r
120
121  SUBROUTINE bcast_r1(var)
122  IMPLICIT NONE
123    REAL,INTENT(INOUT) :: Var(:)
124   
125!$OMP MASTER
126    CALL bcast_mpi(Var)
127!$OMP END MASTER
128    CALL bcast_omp(Var)
129   
130  END SUBROUTINE bcast_r1
131
132
133  SUBROUTINE bcast_r2(var)
134  IMPLICIT NONE
135    REAL,INTENT(INOUT) :: Var(:,:)
136   
137!$OMP MASTER
138    CALL bcast_mpi(Var)
139!$OMP END MASTER
140    CALL bcast_omp(Var)
141   
142  END SUBROUTINE bcast_r2
143
144
145  SUBROUTINE bcast_r3(var)
146  IMPLICIT NONE
147    REAL,INTENT(INOUT) :: Var(:,:,:)
148   
149!$OMP MASTER
150    CALL bcast_mpi(Var)
151!$OMP END MASTER
152    CALL bcast_omp(Var)
153   
154  END SUBROUTINE bcast_r3
155
156
157  SUBROUTINE bcast_r4(var)
158  IMPLICIT NONE
159    REAL,INTENT(INOUT) :: Var(:,:,:,:)
160   
161!$OMP MASTER
162    CALL bcast_mpi(Var)
163!$OMP END MASTER
164    CALL bcast_omp(Var)
165   
166  END SUBROUTINE bcast_r4 
167
168
169!! -- Les booleens -- !!
170 
171  SUBROUTINE bcast_l(var)
172  IMPLICIT NONE
173    LOGICAL,INTENT(INOUT) :: Var
174!$OMP MASTER
175    CALL bcast_mpi(Var)
176!$OMP END MASTER
177    CALL bcast_omp(Var)
178   
179  END SUBROUTINE bcast_l
180
181  SUBROUTINE bcast_l1(var)
182  IMPLICIT NONE
183    LOGICAL,INTENT(INOUT) :: Var(:)
184   
185!$OMP MASTER
186    CALL bcast_mpi(Var)
187!$OMP END MASTER
188    CALL bcast_omp(Var)
189   
190  END SUBROUTINE bcast_l1
191
192
193  SUBROUTINE bcast_l2(var)
194  IMPLICIT NONE
195    LOGICAL,INTENT(INOUT) :: Var(:,:)
196   
197!$OMP MASTER
198    CALL bcast_mpi(Var)
199!$OMP END MASTER
200    CALL bcast_omp(Var)
201   
202  END SUBROUTINE bcast_l2
203
204
205  SUBROUTINE bcast_l3(var)
206  IMPLICIT NONE
207    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
208   
209!$OMP MASTER
210    CALL bcast_mpi(Var)
211!$OMP END MASTER
212    CALL bcast_omp(Var)
213   
214  END SUBROUTINE bcast_l3
215
216
217  SUBROUTINE bcast_l4(var)
218  IMPLICIT NONE
219    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
220   
221!$OMP MASTER
222    CALL bcast_mpi(Var)
223!$OMP END MASTER
224    CALL bcast_omp(Var)
225   
226  END SUBROUTINE bcast_l4
227
228 
229END MODULE transfert_mod
Note: See TracBrowser for help on using the repository browser.