Branch data Line data Source code
1 : : !{\src2tex{textfont=tt}}
2 : : !!****f* ABINIT/xmpi_ibcast
3 : : !! NAME
4 : : !! xmpi_ibcast
5 : : !!
6 : : !! FUNCTION
7 : : !! This module contains functions that calls MPI routine MPI_IBCAST,
8 : : !! to broadcast data from one processor to other procs inside a communicator,
9 : : !! if we compile the code using the MPI CPP flags.
10 : : !! xmpi_ibcast is the generic function.
11 : : !!
12 : : !! COPYRIGHT
13 : : !! Copyright (C) 2001-2026 ABINIT group (MG)
14 : : !! This file is distributed under the terms of the
15 : : !! GNU General Public License, see ~ABINIT/COPYING
16 : : !! or http://www.gnu.org/copyleft/gpl.txt .
17 : : !!
18 : : !! SOURCE
19 : : !!***
20 : :
21 : : !!****f* ABINIT/xmpi_ibcast_int1d
22 : : !! NAME
23 : : !! xmpi_ibcast_int1d
24 : : !!
25 : : !! FUNCTION
26 : : !! Sends data from one processor to others inside comm without blocking
27 : : !! Target: integer one-dimensional arrays.
28 : : !!
29 : : !! INPUTS
30 : : !! root: rank of broadcast root (integer)
31 : : !! comm: MPI communicator
32 : : !!
33 : : !! OUTPUT
34 : : !! ierr= exit status, a non-zero value meaning there is an error
35 : : !!
36 : : !! SIDE EFFECTS
37 : : !! xval= buffer array
38 : : !!
39 : : !! SOURCE
40 : :
41 [ # # ]: 0 : subroutine xmpi_ibcast_int1d(xval, root, comm, request, ierr)
42 : :
43 : : !Arguments-------------------------
44 : : integer ABI_ASYNC, intent(inout) :: xval(:)
45 : : integer, intent(in) :: root, comm
46 : : integer, intent(out) :: request, ierr
47 : :
48 : : ! *************************************************************************
49 : :
50 : 0 : ierr=0
51 : : #ifdef HAVE_MPI_IBCAST
52 [ # # ]: 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
53 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_INTEGER, root, comm, request, ierr)
54 : 0 : xmpi_count_requests = xmpi_count_requests + 1
55 : 0 : return
56 : : end if
57 : : #endif
58 : :
59 : : ! Call the blocking version and return null request.
60 : 0 : call xmpi_bcast(xval, root, comm, ierr)
61 : 0 : request = xmpi_request_null
62 : :
63 : : end subroutine xmpi_ibcast_int1d
64 : : !!***
65 : :
66 : : !!****f* ABINIT/xmpi_ibcast_int4d
67 : : !! NAME
68 : : !! xmpi_ibcast_int4d
69 : : !!
70 : : !! FUNCTION
71 : : !! Sends data from one processor to others inside comm without blocking
72 : : !! Target: integer one-dimensional arrays.
73 : : !!
74 : : !! INPUTS
75 : : !! root: rank of broadcast root (integer)
76 : : !! comm: MPI communicator
77 : : !!
78 : : !! OUTPUT
79 : : !! ierr= exit status, a non-zero value meaning there is an error
80 : : !!
81 : : !! SIDE EFFECTS
82 : : !! xval= buffer array
83 : : !!
84 : : !! SOURCE
85 : :
86 [ # # ]: 0 : subroutine xmpi_ibcast_int4d(xval, root, comm, request, ierr)
87 : :
88 : : !Arguments-------------------------
89 : : integer ABI_ASYNC, intent(inout) :: xval(:,:,:,:)
90 : : integer, intent(in) :: root, comm
91 : : integer, intent(out) :: request, ierr
92 : :
93 : : ! *************************************************************************
94 : :
95 : 0 : ierr=0
96 : : #ifdef HAVE_MPI_IBCAST
97 [ # # ]: 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
98 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_INTEGER, root, comm, request, ierr)
99 : 0 : xmpi_count_requests = xmpi_count_requests + 1
100 : 0 : return
101 : : end if
102 : : #endif
103 : :
104 : : ! Call the blocking version and return null request.
105 : 0 : call xmpi_bcast(xval, root, comm, ierr)
106 : 0 : request = xmpi_request_null
107 : :
108 : : end subroutine xmpi_ibcast_int4d
109 : : !!***
110 : :
111 : : !!****f* ABINIT/xmpi_ibcast_dp1d
112 : : !! NAME
113 : : !! xmpi_ibcast_int1d
114 : : !!
115 : : !! FUNCTION
116 : : !! Sends data from one processor to others inside comm without blocking
117 : : !! Target: double one-dimensional dp arrays.
118 : : !!
119 : : !! INPUTS
120 : : !! root: rank of broadcast root (integer)
121 : : !! comm: MPI communicator
122 : : !!
123 : : !! OUTPUT
124 : : !! ierr= exit status, a non-zero value meaning there is an error
125 : : !!
126 : : !! SIDE EFFECTS
127 : : !! xval= buffer array
128 : : !!
129 : : !! SOURCE
130 : :
131 [ - + ]: 16633 : subroutine xmpi_ibcast_dp1d(xval, root, comm, request, ierr)
132 : :
133 : : !Arguments-------------------------
134 : : real(dp) ABI_ASYNC, intent(inout) :: xval(:)
135 : : integer, intent(in) :: root, comm
136 : : integer, intent(out) :: request, ierr
137 : :
138 : : ! *************************************************************************
139 : :
140 : 16633 : ierr=0
141 : : #ifdef HAVE_MPI_IBCAST
142 [ + + ]: 16633 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
143 [ + + - + ]: 9704 : call MPI_IBCAST(xval, product(shape(xval)), MPI_DOUBLE_PRECISION, root, comm, request, ierr)
144 : 4852 : xmpi_count_requests = xmpi_count_requests + 1
145 : 4852 : return
146 : : end if
147 : : #endif
148 : :
149 : : ! Call the blocking version and return null request.
150 : 11781 : call xmpi_bcast(xval, root, comm, ierr)
151 : 11781 : request = xmpi_request_null
152 : :
153 : : end subroutine xmpi_ibcast_dp1d
154 : : !!***
155 : :
156 : : !!****f* ABINIT/xmpi_ibcast_dp2d
157 : : !! NAME
158 : : !! xmpi_ibcast_dp2d
159 : : !!
160 : : !! FUNCTION
161 : : !! Sends data from one processor to others inside comm without blocking
162 : : !! Target: double two-dimensional dp arrays.
163 : : !!
164 : : !! INPUTS
165 : : !! root: rank of broadcast root (integer)
166 : : !! comm: MPI communicator
167 : : !!
168 : : !! OUTPUT
169 : : !! ierr= exit status, a non-zero value meaning there is an error
170 : : !!
171 : : !! SIDE EFFECTS
172 : : !! xval= buffer array
173 : : !!
174 : : !! SOURCE
175 : :
176 [ - + ]: 11781 : subroutine xmpi_ibcast_dp2d(xval, root, comm, request, ierr)
177 : :
178 : : !Arguments-------------------------
179 : : real(dp) ABI_ASYNC, intent(inout) :: xval(:, :)
180 : : integer, intent(in) :: root, comm
181 : : integer, intent(out) :: request, ierr
182 : :
183 : : ! *************************************************************************
184 : :
185 : 11781 : ierr=0
186 : : #ifdef HAVE_MPI_IBCAST
187 [ - + ]: 11781 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
188 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_DOUBLE_PRECISION, root, comm, request, ierr)
189 : 0 : xmpi_count_requests = xmpi_count_requests + 1
190 : 0 : return
191 : : end if
192 : : #endif
193 : :
194 : : ! Call the blocking version and return null request.
195 : 11781 : call xmpi_bcast(xval, root, comm, ierr)
196 : 11781 : request = xmpi_request_null
197 : :
198 : : end subroutine xmpi_ibcast_dp2d
199 : : !!***
200 : :
201 : : !!****f* ABINIT/xmpi_ibcast_dp3d
202 : : !! NAME
203 : : !! xmpi_ibcast_dp3d
204 : : !!
205 : : !! FUNCTION
206 : : !! Sends data from one processor to others inside comm without blocking
207 : : !! Target: double three-dimensional dp arrays.
208 : : !!
209 : : !! INPUTS
210 : : !! root: rank of broadcast root (integer)
211 : : !! comm: MPI communicator
212 : : !!
213 : : !! OUTPUT
214 : : !! ierr= exit status, a non-zero value meaning there is an error
215 : : !!
216 : : !! SIDE EFFECTS
217 : : !! xval= buffer array
218 : : !!
219 : : !! SOURCE
220 : :
221 [ # # ]: 0 : subroutine xmpi_ibcast_dp3d(xval, root, comm, request, ierr)
222 : :
223 : : !Arguments-------------------------
224 : : real(dp) ABI_ASYNC, intent(inout) :: xval(:, :, :)
225 : : integer, intent(in) :: root, comm
226 : : integer, intent(out) :: request, ierr
227 : :
228 : : ! *************************************************************************
229 : :
230 : 0 : ierr=0
231 : : #ifdef HAVE_MPI_IBCAST
232 [ # # ]: 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
233 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_DOUBLE_PRECISION, root, comm, request, ierr)
234 : 0 : xmpi_count_requests = xmpi_count_requests + 1
235 : 0 : return
236 : : end if
237 : : #endif
238 : :
239 : : ! Call the blocking version and return null request.
240 : 0 : call xmpi_bcast(xval, root, comm, ierr)
241 : 0 : request = xmpi_request_null
242 : :
243 : : end subroutine xmpi_ibcast_dp3d
244 : : !!***
245 : :
246 : : !!****f* ABINIT/xmpi_ibcast_dp4d
247 : : !! NAME
248 : : !! xmpi_ibcast_dp4d
249 : : !!
250 : : !! FUNCTION
251 : : !! Sends data from one processor to others inside comm without blocking
252 : : !! Target: double three-dimensional dp arrays.
253 : : !!
254 : : !! INPUTS
255 : : !! root: rank of broadcast root (integer)
256 : : !! comm: MPI communicator
257 : : !!
258 : : !! OUTPUT
259 : : !! ierr= exit status, a non-zero value meaning there is an error
260 : : !!
261 : : !! SIDE EFFECTS
262 : : !! xval= buffer array
263 : : !!
264 : : !! SOURCE
265 : :
266 [ - + ]: 4852 : subroutine xmpi_ibcast_dp4d(xval, root, comm, request, ierr)
267 : :
268 : : !Arguments-------------------------
269 : : real(dp) ABI_ASYNC, intent(inout) :: xval(:, :, :, :)
270 : : integer, intent(in) :: root, comm
271 : : integer, intent(out) :: request, ierr
272 : :
273 : : ! *************************************************************************
274 : :
275 : 4852 : ierr=0
276 : : #ifdef HAVE_MPI_IBCAST
277 [ + - ]: 4852 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
278 [ + + - + ]: 24260 : call MPI_IBCAST(xval, product(shape(xval)), MPI_DOUBLE_PRECISION, root, comm, request, ierr)
279 : 4852 : xmpi_count_requests = xmpi_count_requests + 1
280 : 4852 : return
281 : : end if
282 : : #endif
283 : :
284 : : ! Call the blocking version and return null request.
285 : 0 : call xmpi_bcast(xval, root, comm, ierr)
286 : 0 : request = xmpi_request_null
287 : :
288 : : end subroutine xmpi_ibcast_dp4d
289 : : !!***
290 : :
291 : : !!****f* ABINIT/xmpi_ibcast_dpc2d
292 : : !! NAME
293 : : !! xmpi_ibcast_dpc2d
294 : : !!
295 : : !! FUNCTION
296 : : !! Sends data from one processor to others inside comm without blocking
297 : : !! Target: double precision two-dimensional complex arrays.
298 : : !!
299 : : !! INPUTS
300 : : !! root: rank of broadcast root (integer)
301 : : !! comm: MPI communicator
302 : : !!
303 : : !! OUTPUT
304 : : !! ierr= exit status, a non-zero value meaning there is an error
305 : : !!
306 : : !! SIDE EFFECTS
307 : : !! xval= buffer array
308 : : !!
309 : : !! SOURCE
310 : :
311 [ # # ]: 0 : subroutine xmpi_ibcast_dpc2d(xval, root, comm, request, ierr)
312 : :
313 : : !Arguments-------------------------
314 : : complex(dp) ABI_ASYNC, intent(inout) :: xval(:, :)
315 : : integer, intent(in) :: root, comm
316 : : integer, intent(out) :: request, ierr
317 : :
318 : : ! *************************************************************************
319 : :
320 : 0 : ierr=0
321 : : #ifdef HAVE_MPI_IBCAST
322 [ # # ]: 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
323 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_DOUBLE_COMPLEX, root, comm, request, ierr)
324 : 0 : xmpi_count_requests = xmpi_count_requests + 1
325 : 0 : return
326 : : end if
327 : : #endif
328 : :
329 : : ! Call the blocking version and return null request.
330 : 0 : call xmpi_bcast(xval, root, comm, ierr)
331 : 0 : request = xmpi_request_null
332 : :
333 : : end subroutine xmpi_ibcast_dpc2d
334 : : !!***
335 : :
336 : : !!****f* ABINIT/xmpi_ibcast_spc2d
337 : : !! NAME
338 : : !! xmpi_ibcast_spc2d
339 : : !!
340 : : !! FUNCTION
341 : : !! Sends data from one processor to others inside comm without blocking
342 : : !! Target: single precision two-dimensional complex arrays.
343 : : !!
344 : : !! INPUTS
345 : : !! root: rank of broadcast root (integer)
346 : : !! comm: MPI communicator
347 : : !!
348 : : !! OUTPUT
349 : : !! ierr= exit status, a non-zero value meaning there is an error
350 : : !!
351 : : !! SIDE EFFECTS
352 : : !! xval= buffer array
353 : : !!
354 : : !! SOURCE
355 : :
356 [ # # ]: 0 : subroutine xmpi_ibcast_spc2d(xval, root, comm, request, ierr)
357 : :
358 : : !Arguments-------------------------
359 : : complex(sp) ABI_ASYNC, intent(inout) :: xval(:, :)
360 : : integer, intent(in) :: root, comm
361 : : integer, intent(out) :: request, ierr
362 : :
363 : : ! *************************************************************************
364 : :
365 : 0 : ierr=0
366 : : #ifdef HAVE_MPI_IBCAST
367 [ # # ]: 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
368 [ # # # # ]: 0 : call MPI_IBCAST(xval, product(shape(xval)), MPI_COMPLEX, root, comm, request, ierr)
369 : 0 : xmpi_count_requests = xmpi_count_requests + 1
370 : 0 : return
371 : : end if
372 : : #endif
373 : :
374 : : ! Call the blocking version and return null request.
375 : 0 : call xmpi_bcast(xval, root, comm, ierr)
376 : 0 : request = xmpi_request_null
377 : :
378 : : end subroutine xmpi_ibcast_spc2d
379 : : !!***
|