1!{\src2tex{textfont=tt}}
2!!****f* ABINIT/xmpi_send
3!! NAME
4!!  xmpi_send
5!!
6!! FUNCTION
7!!  This module contains functions that calls MPI routine MPI_SEND,
8!!  to send data from one processor to another,
9!!  if we compile the code using the MPI CPP flags.
10!!  xmpi_send is the generic function.
11!!
12!! COPYRIGHT
13!!  Copyright (C) 2001-2016 ABINIT group
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_send_intv
22!! NAME
23!!  xmpi_send_intv
24!!
25!! FUNCTION
26!!  Sends data from one processor to another.
27!!  Target: single integer.
28!!
29!! INPUTS
30!!  dest :: rank of destination process
31!!  tag :: integer message tag
32!!  spaceComm :: MPI communicator
33!!
34!! OUTPUT
35!!  ier= exit status, a non-zero value meaning there is an error
36!!
37!! SIDE EFFECTS
38!!  xval= buffer array
39!!
40!! SOURCE
41
42subroutine xmpi_send_intv(xval,dest,tag,spaceComm,ier)
43
44
45
46!This section has been created automatically by the script Abilint (TD).
47!Do not modify the following lines by hand.
48#undef ABI_FUNC
49#define ABI_FUNC 'xmpi_send_intv'
50!End of the abilint section
51
52 implicit none
53
54!Arguments-------------------------
55 integer,intent(inout) :: xval
56 integer,intent(in) :: dest,tag,spaceComm
57 integer,intent(out)   :: ier
58
59!Local variables-------------------
60#if defined HAVE_MPI
61 integer :: my_tag
62#endif
63
64! *************************************************************************
65
66 ier=0
67#if defined HAVE_MPI
68 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
69   my_tag = MOD(tag,xmpi_tag_ub)
70   call MPI_SEND(xval,1,MPI_INTEGER,dest,my_tag,spaceComm,ier)
71 end if
72#endif
73
74 end subroutine xmpi_send_intv
75
76!!***
77
78!!****f* ABINIT/xmpi_send_int1d
79!! NAME
80!!  xmpi_send_int1d
81!!
82!! FUNCTION
83!!  Sends data from one processor to another.
84!!  Target: integer one-dimensional arrays.
85!!
86!! INPUTS
87!!  dest :: rank of destination process
88!!  tag :: integer message tag
89!!  spaceComm :: MPI communicator
90!!
91!! OUTPUT
92!!  ier= exit status, a non-zero value meaning there is an error
93!!
94!! SIDE EFFECTS
95!!  xval= buffer array
96!!
97!! SOURCE
98
99subroutine xmpi_send_int1d(xval,dest,tag,spaceComm,ier)
100
101
102
103!This section has been created automatically by the script Abilint (TD).
104!Do not modify the following lines by hand.
105#undef ABI_FUNC
106#define ABI_FUNC 'xmpi_send_int1d'
107!End of the abilint section
108
109 implicit none
110
111!Arguments-------------------------
112 integer, DEV_CONTARRD intent(inout) :: xval(:)
113 integer,intent(in) :: dest,tag,spaceComm
114 integer,intent(out) :: ier
115
116!Local variables-------------------
117#if defined HAVE_MPI
118 integer :: my_tag, n1
119#endif
120
121! *************************************************************************
122
123 ier=0
124#if defined HAVE_MPI
125 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
126   n1=size(xval,dim=1)
127   my_tag = MOD(tag,xmpi_tag_ub)
128   call MPI_SEND(xval,n1,MPI_INTEGER,dest,my_tag,spaceComm,ier)
129 end if
130#endif
131
132 end subroutine xmpi_send_int1d
133!!***
134
135!!****f* ABINIT/xmpi_send_int2d
136!! NAME
137!!  xmpi_send_int2d
138!!
139!! FUNCTION
140!!  Sends data from one proc to another.
141!!  Target: integer two-dimensional arrays.
142!!
143!! INPUTS
144!!  dest :: rank of destination process
145!!  tag :: integer message tag
146!!  spaceComm :: MPI communicator
147!!
148!! OUTPUT
149!!  ier= exit status, a non-zero value meaning there is an error
150!!
151!! SIDE EFFECTS
152!!  xval= buffer array
153!!
154!! PARENTS
155!!
156!! CHILDREN
157!!      mpi_send
158!!
159!! SOURCE
160subroutine xmpi_send_int2d(xval,dest,tag,spaceComm,ier)
161
162
163 use defs_basis
164#if defined HAVE_MPI2 && ! defined HAVE_MPI_INCLUDED_ONCE
165 use mpi
166#endif
167
168!This section has been created automatically by the script Abilint (TD).
169!Do not modify the following lines by hand.
170#undef ABI_FUNC
171#define ABI_FUNC 'xmpi_send_int2d'
172!End of the abilint section
173
174 implicit none
175
176#if defined HAVE_MPI1
177 include 'mpif.h'
178#endif
179
180!Arguments-------------------------
181 integer,intent(inout) :: xval(:,:)
182 integer ,intent(in) :: dest,tag,spaceComm
183 integer ,intent(out)   :: ier
184
185!Local variables-------------------
186#if defined HAVE_MPI
187 integer :: n1,n2,my_tag
188#endif
189
190! *************************************************************************
191
192 ier=0
193#if defined HAVE_MPI
194 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
195   n1=size(xval,dim=1)
196   n2=size(xval,dim=2)
197   my_tag = MOD(tag,xmpi_tag_ub+1)
198   call MPI_SEND(xval,n1*n2,MPI_INTEGER,dest,my_tag,spaceComm,ier)
199 end if
200#endif
201
202end subroutine xmpi_send_int2d
203!!***
204
205!!****f* ABINIT/xmpi_send_dp1d
206!! NAME
207!!  xmpi_send_dp1d
208!!
209!! FUNCTION
210!!  Sends data from one proc to another.
211!!  Target: double precision one-dimensional arrays.
212!!
213!! INPUTS
214!!  dest :: rank of destination process
215!!  tag :: integer message tag
216!!  spaceComm :: MPI communicator
217!!
218!! OUTPUT
219!!  ier= exit status, a non-zero value meaning there is an error
220!!
221!! SIDE EFFECTS
222!!  xval= buffer array
223!!
224!! SOURCE
225
226subroutine xmpi_send_dp1d(xval,dest,tag,spaceComm,ier)
227
228
229
230!This section has been created automatically by the script Abilint (TD).
231!Do not modify the following lines by hand.
232#undef ABI_FUNC
233#define ABI_FUNC 'xmpi_send_dp1d'
234!End of the abilint section
235
236 implicit none
237
238!Arguments-------------------------
239 real(dp), DEV_CONTARRD intent(inout) :: xval(:)
240 integer ,intent(in) :: dest,tag,spaceComm
241 integer ,intent(out) :: ier
242
243!Local variables-------------------
244#if defined HAVE_MPI
245 integer :: n1,my_tag
246#endif
247
248! *************************************************************************
249
250 ier=0
251#if defined HAVE_MPI
252 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
253   n1=size(xval,dim=1)
254   my_tag = MOD(tag,xmpi_tag_ub)
255   call MPI_SEND(xval,n1,MPI_DOUBLE_PRECISION,dest,my_tag,spaceComm,ier)
256 end if
257#endif
258
259end subroutine xmpi_send_dp1d
260!!***
261
262!!****f* ABINIT/xmpi_send_dp2d
263!! NAME
264!!  xmpi_send_dp2d
265!!
266!! FUNCTION
267!!  Sends data from one proc to another.
268!!  Target: double precision two-dimensional arrays.
269!!
270!! INPUTS
271!!  dest :: rank of destination process
272!!  tag :: integer message tag
273!!  spaceComm :: MPI communicator
274!!
275!! OUTPUT
276!!  ier= exit status, a non-zero value meaning there is an error
277!!
278!! SIDE EFFECTS
279!!  xval= buffer array
280!!
281!! SOURCE
282subroutine xmpi_send_dp2d(xval,dest,tag,spaceComm,ier)
283
284
285
286!This section has been created automatically by the script Abilint (TD).
287!Do not modify the following lines by hand.
288#undef ABI_FUNC
289#define ABI_FUNC 'xmpi_send_dp2d'
290!End of the abilint section
291
292 implicit none
293
294!Arguments-------------------------
295 real(dp), DEV_CONTARRD intent(inout) :: xval(:,:)
296 integer ,intent(in) :: dest,tag,spaceComm
297 integer ,intent(out) :: ier
298
299!Local variables-------------------
300#if defined HAVE_MPI
301 integer :: n1,n2,my_tag
302#endif
303
304! *************************************************************************
305
306 ier=0
307#if defined HAVE_MPI
308 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
309   n1=size(xval,dim=1)
310   n2=size(xval,dim=2)
311   my_tag = MOD(tag,xmpi_tag_ub)
312   call MPI_SEND(xval,n1*n2,MPI_DOUBLE_PRECISION,dest,my_tag,spaceComm,ier)
313 end if
314#endif
315
316end subroutine xmpi_send_dp2d
317!!***
318
319!!****f* ABINIT/xmpi_send_dp3d
320!! NAME
321!!  xmpi_send_dp3d
322!!
323!! FUNCTION
324!!  Sends data from one proc to another.
325!!  Target: double precision three-dimensional arrays.
326!!
327!! INPUTS
328!!  dest :: rank of destination process
329!!  tag :: integer message tag
330!!  spaceComm :: MPI communicator
331!!
332!! OUTPUT
333!!  ier= exit status, a non-zero value meaning there is an error
334!!
335!! SIDE EFFECTS
336!!  xval= buffer array
337!!
338!! SOURCE
339
340subroutine xmpi_send_dp3d(xval,dest,tag,spaceComm,ier)
341
342
343
344!This section has been created automatically by the script Abilint (TD).
345!Do not modify the following lines by hand.
346#undef ABI_FUNC
347#define ABI_FUNC 'xmpi_send_dp3d'
348!End of the abilint section
349
350 implicit none
351
352!Arguments-------------------------
353 real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:)
354 integer ,intent(in) :: dest,tag,spaceComm
355 integer ,intent(out) :: ier
356
357!Local variables-------------------
358#if defined HAVE_MPI
359 integer :: n1,n2,n3,my_tag
360#endif
361
362! *************************************************************************
363
364 ier=0
365#if defined HAVE_MPI
366 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then
367   n1=size(xval,dim=1)
368   n2=size(xval,dim=2)
369   n3=size(xval,dim=3)
370   my_tag = MOD(tag,xmpi_tag_ub)
371   call MPI_SEND(xval,n1*n2*n3,MPI_DOUBLE_PRECISION,dest,my_tag,spaceComm,ier)
372 end if
373#endif
374
375end subroutine xmpi_send_dp3d
376!!***
377!
378