1 | module transfert_mod |
---|
2 | #ifdef CPP_USING_MPI |
---|
3 | |
---|
4 | #if defined(CPP_USING_MPI_NEW) |
---|
5 | #warning("Using new transfert_mpi (not default, not working with req_z1_scal)") |
---|
6 | ! transfert_mpi using manual pack/unpack (default) |
---|
7 | use transfert_mpi_mod, only : t_message, t_request, & |
---|
8 | req_i1, req_e1_scal, req_e1_vect, & |
---|
9 | req_i0, req_e0_scal, req_e0_vect, & |
---|
10 | req_z1_scal, & |
---|
11 | init_transfert, & |
---|
12 | init_message, & |
---|
13 | finalize_message, & |
---|
14 | send_message, & |
---|
15 | wait_message, & |
---|
16 | test_message |
---|
17 | |
---|
18 | #else |
---|
19 | use transfert_mpi_legacy_mod, only : t_message, t_request, & |
---|
20 | req_i1, req_e1_scal, req_e1_vect, & |
---|
21 | req_i0, req_e0_scal, req_e0_vect, & |
---|
22 | req_z1_scal, & |
---|
23 | init_transfert, & |
---|
24 | init_message => init_message_mpi, & |
---|
25 | finalize_message => finalize_message_mpi, & |
---|
26 | send_message => send_message_mpi, & |
---|
27 | wait_message => wait_message_mpi, & |
---|
28 | test_message => test_message_mpi |
---|
29 | #endif |
---|
30 | #else |
---|
31 | #warning("Using transfert_seq (unmaintained)") |
---|
32 | use transfert_mpi_legacy_mod, only : t_message, t_request, & |
---|
33 | req_i1, req_e1_scal, req_e1_vect, & |
---|
34 | req_i0, req_e0_scal, req_e0_vect, & |
---|
35 | req_z1_scal, & |
---|
36 | init_transfert, & |
---|
37 | init_message=>init_message_seq, & |
---|
38 | finalize_message => finalize_message_seq, & |
---|
39 | send_message => send_message_seq, & |
---|
40 | wait_message => wait_message_seq, & |
---|
41 | test_message => test_message_seq |
---|
42 | #endif |
---|
43 | use transfert_mpi_collectives_mod, only : gather_field, scatter_field, bcast_field, bcast_mpi |
---|
44 | use transfert_omp_mod, only : bcast_omp |
---|
45 | |
---|
46 | implicit none |
---|
47 | private |
---|
48 | public :: t_message, t_request, & |
---|
49 | req_i1, req_e1_scal, req_e1_vect, & |
---|
50 | req_i0, req_e0_scal, req_e0_vect, & |
---|
51 | req_z1_scal, & |
---|
52 | init_transfert, & |
---|
53 | init_message, & |
---|
54 | finalize_message, & |
---|
55 | send_message, & |
---|
56 | wait_message, & |
---|
57 | test_message, & |
---|
58 | transfert_request, & |
---|
59 | transfert_message, & |
---|
60 | gather_field, scatter_field, bcast_field, bcast, bcast_omp |
---|
61 | |
---|
62 | interface bcast |
---|
63 | module procedure bcast_c, & |
---|
64 | bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4, & |
---|
65 | bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, & |
---|
66 | bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4 |
---|
67 | end interface |
---|
68 | |
---|
69 | contains |
---|
70 | subroutine transfert_message(field, message) |
---|
71 | use field_mod, only : t_field |
---|
72 | type(t_field), pointer :: field(:) |
---|
73 | type(t_message) :: message |
---|
74 | |
---|
75 | call send_message(field, message) |
---|
76 | call wait_message(message) |
---|
77 | end subroutine |
---|
78 | |
---|
79 | subroutine transfert_request(field, request) |
---|
80 | use field_mod, only : t_field |
---|
81 | type(t_field),pointer :: field(:) |
---|
82 | type(t_request),pointer :: request(:) |
---|
83 | type(t_message), save :: message ! Save because shared between threads |
---|
84 | |
---|
85 | call init_message(field, request, message) |
---|
86 | call transfert_message(field, message) |
---|
87 | call finalize_message(message) |
---|
88 | end subroutine |
---|
89 | |
---|
90 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
91 | !! Definition des Broadcast --> 4D !! |
---|
92 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
93 | |
---|
94 | !! -- Les chaine de charactï¿œre -- !! |
---|
95 | |
---|
96 | SUBROUTINE bcast_c(var) |
---|
97 | IMPLICIT NONE |
---|
98 | CHARACTER(LEN=*),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_c |
---|
106 | |
---|
107 | !! -- Les entiers -- !! |
---|
108 | |
---|
109 | SUBROUTINE bcast_i(var) |
---|
110 | IMPLICIT NONE |
---|
111 | INTEGER,INTENT(INOUT) :: Var |
---|
112 | !$OMP MASTER |
---|
113 | CALL bcast_mpi(Var) |
---|
114 | !$OMP END MASTER |
---|
115 | CALL bcast_omp(Var) |
---|
116 | |
---|
117 | END SUBROUTINE bcast_i |
---|
118 | |
---|
119 | SUBROUTINE bcast_i1(var) |
---|
120 | IMPLICIT NONE |
---|
121 | INTEGER,INTENT(INOUT) :: Var(:) |
---|
122 | |
---|
123 | !$OMP MASTER |
---|
124 | CALL bcast_mpi(Var) |
---|
125 | !$OMP END MASTER |
---|
126 | CALL bcast_omp(Var) |
---|
127 | |
---|
128 | END SUBROUTINE bcast_i1 |
---|
129 | |
---|
130 | |
---|
131 | SUBROUTINE bcast_i2(var) |
---|
132 | IMPLICIT NONE |
---|
133 | INTEGER,INTENT(INOUT) :: Var(:,:) |
---|
134 | |
---|
135 | !$OMP MASTER |
---|
136 | CALL bcast_mpi(Var) |
---|
137 | !$OMP END MASTER |
---|
138 | CALL bcast_omp(Var) |
---|
139 | |
---|
140 | END SUBROUTINE bcast_i2 |
---|
141 | |
---|
142 | |
---|
143 | SUBROUTINE bcast_i3(var) |
---|
144 | IMPLICIT NONE |
---|
145 | INTEGER,INTENT(INOUT) :: Var(:,:,:) |
---|
146 | |
---|
147 | !$OMP MASTER |
---|
148 | CALL bcast_mpi(Var) |
---|
149 | !$OMP END MASTER |
---|
150 | CALL bcast_omp(Var) |
---|
151 | |
---|
152 | END SUBROUTINE bcast_i3 |
---|
153 | |
---|
154 | |
---|
155 | SUBROUTINE bcast_i4(var) |
---|
156 | IMPLICIT NONE |
---|
157 | INTEGER,INTENT(INOUT) :: Var(:,:,:,:) |
---|
158 | |
---|
159 | !$OMP MASTER |
---|
160 | CALL bcast_mpi(Var) |
---|
161 | !$OMP END MASTER |
---|
162 | CALL bcast_omp(Var) |
---|
163 | |
---|
164 | END SUBROUTINE bcast_i4 |
---|
165 | |
---|
166 | |
---|
167 | !! -- Les reels -- !! |
---|
168 | |
---|
169 | SUBROUTINE bcast_r(var) |
---|
170 | IMPLICIT NONE |
---|
171 | REAL,INTENT(INOUT) :: Var |
---|
172 | |
---|
173 | !$OMP MASTER |
---|
174 | CALL bcast_mpi(Var) |
---|
175 | !$OMP END MASTER |
---|
176 | CALL bcast_omp(Var) |
---|
177 | |
---|
178 | END SUBROUTINE bcast_r |
---|
179 | |
---|
180 | SUBROUTINE bcast_r1(var) |
---|
181 | IMPLICIT NONE |
---|
182 | REAL,INTENT(INOUT) :: Var(:) |
---|
183 | |
---|
184 | !$OMP MASTER |
---|
185 | CALL bcast_mpi(Var) |
---|
186 | !$OMP END MASTER |
---|
187 | CALL bcast_omp(Var) |
---|
188 | |
---|
189 | END SUBROUTINE bcast_r1 |
---|
190 | |
---|
191 | |
---|
192 | SUBROUTINE bcast_r2(var) |
---|
193 | IMPLICIT NONE |
---|
194 | REAL,INTENT(INOUT) :: Var(:,:) |
---|
195 | |
---|
196 | !$OMP MASTER |
---|
197 | CALL bcast_mpi(Var) |
---|
198 | !$OMP END MASTER |
---|
199 | CALL bcast_omp(Var) |
---|
200 | |
---|
201 | END SUBROUTINE bcast_r2 |
---|
202 | |
---|
203 | |
---|
204 | SUBROUTINE bcast_r3(var) |
---|
205 | IMPLICIT NONE |
---|
206 | REAL,INTENT(INOUT) :: Var(:,:,:) |
---|
207 | |
---|
208 | !$OMP MASTER |
---|
209 | CALL bcast_mpi(Var) |
---|
210 | !$OMP END MASTER |
---|
211 | CALL bcast_omp(Var) |
---|
212 | |
---|
213 | END SUBROUTINE bcast_r3 |
---|
214 | |
---|
215 | |
---|
216 | SUBROUTINE bcast_r4(var) |
---|
217 | IMPLICIT NONE |
---|
218 | REAL,INTENT(INOUT) :: Var(:,:,:,:) |
---|
219 | |
---|
220 | !$OMP MASTER |
---|
221 | CALL bcast_mpi(Var) |
---|
222 | !$OMP END MASTER |
---|
223 | CALL bcast_omp(Var) |
---|
224 | |
---|
225 | END SUBROUTINE bcast_r4 |
---|
226 | |
---|
227 | |
---|
228 | !! -- Les booleens -- !! |
---|
229 | |
---|
230 | SUBROUTINE bcast_l(var) |
---|
231 | IMPLICIT NONE |
---|
232 | LOGICAL,INTENT(INOUT) :: Var |
---|
233 | !$OMP MASTER |
---|
234 | CALL bcast_mpi(Var) |
---|
235 | !$OMP END MASTER |
---|
236 | CALL bcast_omp(Var) |
---|
237 | |
---|
238 | END SUBROUTINE bcast_l |
---|
239 | |
---|
240 | SUBROUTINE bcast_l1(var) |
---|
241 | IMPLICIT NONE |
---|
242 | LOGICAL,INTENT(INOUT) :: Var(:) |
---|
243 | |
---|
244 | !$OMP MASTER |
---|
245 | CALL bcast_mpi(Var) |
---|
246 | !$OMP END MASTER |
---|
247 | CALL bcast_omp(Var) |
---|
248 | |
---|
249 | END SUBROUTINE bcast_l1 |
---|
250 | |
---|
251 | |
---|
252 | SUBROUTINE bcast_l2(var) |
---|
253 | IMPLICIT NONE |
---|
254 | LOGICAL,INTENT(INOUT) :: Var(:,:) |
---|
255 | |
---|
256 | !$OMP MASTER |
---|
257 | CALL bcast_mpi(Var) |
---|
258 | !$OMP END MASTER |
---|
259 | CALL bcast_omp(Var) |
---|
260 | |
---|
261 | END SUBROUTINE bcast_l2 |
---|
262 | |
---|
263 | |
---|
264 | SUBROUTINE bcast_l3(var) |
---|
265 | IMPLICIT NONE |
---|
266 | LOGICAL,INTENT(INOUT) :: Var(:,:,:) |
---|
267 | |
---|
268 | !$OMP MASTER |
---|
269 | CALL bcast_mpi(Var) |
---|
270 | !$OMP END MASTER |
---|
271 | CALL bcast_omp(Var) |
---|
272 | |
---|
273 | END SUBROUTINE bcast_l3 |
---|
274 | |
---|
275 | |
---|
276 | SUBROUTINE bcast_l4(var) |
---|
277 | IMPLICIT NONE |
---|
278 | LOGICAL,INTENT(INOUT) :: Var(:,:,:,:) |
---|
279 | |
---|
280 | !$OMP MASTER |
---|
281 | CALL bcast_mpi(Var) |
---|
282 | !$OMP END MASTER |
---|
283 | CALL bcast_omp(Var) |
---|
284 | |
---|
285 | END SUBROUTINE bcast_l4 |
---|
286 | |
---|
287 | |
---|
288 | END MODULE transfert_mod |
---|