TABLE OF CONTENTS


ABINIT/xmpi_send [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send

FUNCTION

  This module contains functions that calls MPI routine MPI_SEND,
  to send data from one processor to another,
  if we compile the code using the MPI CPP flags.
  xmpi_send is the generic function.

COPYRIGHT

  Copyright (C) 2001-2024 ABINIT group
  This file is distributed under the terms of the
  GNU General Public License, see ~ABINIT/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

SOURCE


ABINIT/xmpi_send_char [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_char

FUNCTION

  Sends data from one proc to another.
  Target: character.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

42 subroutine xmpi_send_char(xval,dest,tag,comm,ier)
43 
44 !Arguments-------------------------
45  character(len=*),intent(inout),target :: xval  
46  integer ,intent(in) :: dest,tag,comm
47  integer ,intent(out) :: ier
48 
49 !Local variables-------------------
50 #if defined HAVE_MPI
51  integer :: my_tag
52  character,pointer :: arr_xval(:)
53  type(c_ptr) :: cptr
54 #endif
55 
56 ! *************************************************************************
57 
58  ier=0
59 #if defined HAVE_MPI
60  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
61    my_tag = MOD(tag,xmpi_tag_ub)
62    cptr=c_loc(xval) ; call c_f_pointer(cptr,arr_xval,[len(xval)])
63    call MPI_SEND(arr_xval,len(xval),MPI_CHARACTER,dest,my_tag,comm,ier)
64  end if
65 #endif
66 
67 end subroutine xmpi_send_char

ABINIT/xmpi_send_dp [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_dp

FUNCTION

  Sends data from one proc to another.
  Target: double precision value.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

319 subroutine xmpi_send_dp(xval,dest,tag,comm,ier)
320 
321 !Arguments-------------------------
322  real(dp), DEV_CONTARRD intent(inout) :: xval
323  integer ,intent(in) :: dest,tag,comm
324  integer ,intent(out) :: ier
325 
326 !Local variables-------------------
327 #if defined HAVE_MPI
328  integer :: my_tag
329 #endif
330 
331 ! *************************************************************************
332 
333  ier=0
334 #if defined HAVE_MPI
335  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
336    my_tag = MOD(tag,xmpi_tag_ub)
337    call MPI_SEND([xval],1,MPI_DOUBLE_PRECISION,dest,my_tag,comm,ier)
338  end if
339 #endif
340 
341 end subroutine xmpi_send_dp

ABINIT/xmpi_send_dp1d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_dp1d

FUNCTION

  Sends data from one proc to another.
  Target: double precision one-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

365 subroutine xmpi_send_dp1d(xval,dest,tag,comm,ier)
366 
367 !Arguments-------------------------
368  real(dp), DEV_CONTARRD intent(inout) :: xval(:)
369  integer ,intent(in) :: dest,tag,comm
370  integer ,intent(out) :: ier
371 
372 !Local variables-------------------
373 #if defined HAVE_MPI
374  integer :: n1,my_tag
375 #endif
376 
377 ! *************************************************************************
378 
379  ier=0
380 #if defined HAVE_MPI
381  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
382    n1=size(xval,dim=1)
383    my_tag = MOD(tag,xmpi_tag_ub)
384    call MPI_SEND(xval,n1,MPI_DOUBLE_PRECISION,dest,my_tag,comm,ier)
385  end if
386 #endif
387 
388 end subroutine xmpi_send_dp1d

ABINIT/xmpi_send_dp2d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_dp2d

FUNCTION

  Sends data from one proc to another.
  Target: double precision two-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

412 subroutine xmpi_send_dp2d(xval,dest,tag,comm,ier)
413 
414 !Arguments-------------------------
415  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:)
416  integer ,intent(in) :: dest,tag,comm
417  integer ,intent(out) :: ier
418 
419 !Local variables-------------------
420 #if defined HAVE_MPI
421  integer :: my_dt,my_op,n1,n2,my_tag
422  integer(kind=int64) :: ntot
423 #endif
424 
425 ! *************************************************************************
426 
427  ier=0
428 #if defined HAVE_MPI
429  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
430    n1=size(xval,dim=1)
431    n2=size(xval,dim=2)
432    my_tag = MOD(tag,xmpi_tag_ub)
433 
434    !This product of dimensions can be greater than a 32bit integer
435    !We use a INT64 to store it. If it is too large, we switch to an
436    !alternate routine because MPI<4 doesnt handle 64 bit counts.
437    ntot=int(n1*n2,kind=int64)
438 
439    if (ntot<=xmpi_maxint32_64) then
440      call MPI_SEND(xval,n1*n2,MPI_DOUBLE_PRECISION,dest,my_tag,comm,ier)
441    else
442      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
443      call MPI_SEND(xval,1,my_dt,dest,my_tag,comm,ier)
444      call xmpi_largetype_free(my_dt,my_op)
445    end if
446 
447  end if
448 #endif
449 
450 end subroutine xmpi_send_dp2d

ABINIT/xmpi_send_dp3d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_dp3d

FUNCTION

  Sends data from one proc to another.
  Target: double precision three-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

474 subroutine xmpi_send_dp3d(xval,dest,tag,comm,ier)
475 
476 !Arguments-------------------------
477  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:)
478  integer ,intent(in) :: dest,tag,comm
479  integer ,intent(out) :: ier
480 
481 !Local variables-------------------
482 #if defined HAVE_MPI
483  integer :: my_dt,my_op,n1,n2,n3,my_tag
484  integer(kind=int64) :: ntot
485 #endif
486 
487 ! *************************************************************************
488 
489  ier=0
490 #if defined HAVE_MPI
491  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
492    n1=size(xval,dim=1)
493    n2=size(xval,dim=2)
494    n3=size(xval,dim=3)
495    my_tag = MOD(tag,xmpi_tag_ub)
496 
497    !This product of dimensions can be greater than a 32bit integer
498    !We use a INT64 to store it. If it is too large, we switch to an
499    !alternate routine because MPI<4 doesnt handle 64 bit counts.
500    ntot=int(n1*n2*n3,kind=int64)
501 
502    if (ntot<=xmpi_maxint32_64) then
503      call MPI_SEND(xval,n1*n2*n3,MPI_DOUBLE_PRECISION,dest,my_tag,comm,ier)
504    else
505      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
506      call MPI_SEND(xval,1,my_dt,dest,my_tag,comm,ier)
507      call xmpi_largetype_free(my_dt,my_op)
508    end if
509 
510  end if
511 #endif
512 
513 end subroutine xmpi_send_dp3d

ABINIT/xmpi_send_dp4d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_dp4d

FUNCTION

  Sends data from one proc to another.
  Target: double precision four-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

538 subroutine xmpi_send_dp4d(xval,dest,tag,comm,ier)
539 
540 !Arguments-------------------------
541  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:,:)
542  integer ,intent(in) :: dest,tag,comm
543  integer ,intent(out) :: ier
544 
545 !Local variables-------------------
546 #if defined HAVE_MPI
547  integer :: my_dt,my_op,n1,n2,n3,n4,my_tag
548  integer(kind=int64) :: ntot
549 #endif
550 
551 ! *************************************************************************
552 
553  ier=0
554 #if defined HAVE_MPI
555  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
556    n1=size(xval,dim=1)
557    n2=size(xval,dim=2)
558    n3=size(xval,dim=3)
559    n4=size(xval,dim=4)
560    my_tag = MOD(tag,xmpi_tag_ub)
561 
562    !This product of dimensions can be greater than a 32bit integer
563    !We use a INT64 to store it. If it is too large, we switch to an
564    !alternate routine because MPI<4 doesnt handle 64 bit counts.
565    ntot=int(n1*n2*n3*n4,kind=int64)
566 
567    if (ntot<=xmpi_maxint32_64) then
568      call MPI_SEND(xval,n1*n2*n3*n4,MPI_DOUBLE_PRECISION,dest,my_tag,comm,ier)
569    else
570      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
571      call MPI_SEND(xval,1,my_dt,dest,my_tag,comm,ier)
572      call xmpi_largetype_free(my_dt,my_op)
573    end if
574 
575  end if
576 #endif
577 
578 end subroutine xmpi_send_dp4d

ABINIT/xmpi_send_int1d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_int1d

FUNCTION

  Sends data from one processor to another.
  Target: integer one-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

138 subroutine xmpi_send_int1d(xval,dest,tag,comm,ier)
139 
140 !Arguments-------------------------
141  integer, DEV_CONTARRD intent(inout) :: xval(:)
142  integer,intent(in) :: dest,tag,comm
143  integer,intent(out) :: ier
144 
145 !Local variables-------------------
146 #if defined HAVE_MPI
147  integer :: my_tag, n1
148 #endif
149 
150 ! *************************************************************************
151 
152  ier=0
153 #if defined HAVE_MPI
154  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
155    n1=size(xval,dim=1)
156    my_tag = MOD(tag,xmpi_tag_ub)
157    call MPI_SEND(xval,n1,MPI_INTEGER,dest,my_tag,comm,ier)
158  end if
159 #endif
160 
161  end subroutine xmpi_send_int1d

ABINIT/xmpi_send_int2d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_int2d

FUNCTION

  Sends data from one proc to another.
  Target: integer two-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

PARENTS

CHILDREN

      mpi_send

SOURCE

189 subroutine xmpi_send_int2d(xval,dest,tag,comm,ier)
190 
191 !Arguments-------------------------
192  integer,intent(inout) :: xval(:,:)
193  integer ,intent(in) :: dest,tag,comm
194  integer ,intent(out)   :: ier
195 
196 !Local variables-------------------
197 #if defined HAVE_MPI
198  integer :: my_dt,my_op,n1,n2,my_tag
199  integer(kind=int64) :: ntot
200 #endif
201 
202 ! *************************************************************************
203 
204  ier=0
205 #if defined HAVE_MPI
206  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
207    n1=size(xval,dim=1)
208    n2=size(xval,dim=2)
209    my_tag = MOD(tag,xmpi_tag_ub)
210 
211    !This product of dimensions can be greater than a 32bit integer
212    !We use a INT64 to store it. If it is too large, we switch to an
213    !alternate routine because MPI<4 doesnt handle 64 bit counts.
214    ntot=int(n1*n2,kind=int64)
215 
216    if (ntot<=xmpi_maxint32_64) then
217     call MPI_SEND(xval,n1*n2,MPI_INTEGER,dest,my_tag,comm,ier)
218    else
219      call xmpi_largetype_create(ntot,MPI_INTEGER,my_dt,my_op,MPI_OP_NULL)
220      call MPI_SEND(xval,1,my_dt,dest,my_tag,comm,ier)
221      call xmpi_largetype_free(my_dt,my_op)
222    end if
223 
224  end if
225 #endif
226 
227 end subroutine xmpi_send_int2d

ABINIT/xmpi_send_int3d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_int3d

FUNCTION

  Sends data from one proc to another.
  Target: integer three-dimensional arrays.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

PARENTS

CHILDREN

      mpi_send

SOURCE

256 subroutine xmpi_send_int3d(xval,dest,tag,comm,ier)
257 
258 !Arguments-------------------------
259  integer,intent(inout) :: xval(:,:,:)
260  integer ,intent(in) :: dest,tag,comm
261  integer ,intent(out)   :: ier
262 
263 !Local variables-------------------
264 #if defined HAVE_MPI
265  integer :: my_dt,my_op,n1,n2,n3,my_tag
266  integer(kind=int64) :: ntot
267 #endif
268 
269 ! *************************************************************************
270 
271  ier=0
272 #if defined HAVE_MPI
273  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
274    n1=size(xval,dim=1)
275    n2=size(xval,dim=2)
276    n3=size(xval,dim=3)
277    my_tag = MOD(tag,xmpi_tag_ub)
278 
279    !This product of dimensions can be greater than a 32bit integer
280    !We use a INT64 to store it. If it is too large, we switch to an
281    !alternate routine because MPI<4 doesnt handle 64 bit counts.
282    ntot=int(n1*n2*n3,kind=int64)
283 
284    if (ntot<=xmpi_maxint32_64) then
285      call MPI_SEND(xval,n1*n2*n3,MPI_INTEGER,dest,my_tag,comm,ier)
286    else
287      call xmpi_largetype_create(ntot,MPI_INTEGER,my_dt,my_op,MPI_OP_NULL)
288      call MPI_SEND(xval,1,my_dt,dest,my_tag,comm,ier)
289      call xmpi_largetype_free(my_dt,my_op)
290    end if
291 
292  end if
293 #endif
294 
295 end subroutine xmpi_send_int3d

ABINIT/xmpi_send_intv [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_send_intv

FUNCTION

  Sends data from one processor to another.
  Target: single integer.

INPUTS

  dest :: rank of destination process
  tag :: integer message tag
  comm :: MPI communicator

OUTPUT

  ier= exit status, a non-zero value meaning there is an error

SIDE EFFECTS

  xval= buffer array

SOURCE

 91 subroutine xmpi_send_intv(xval,dest,tag,comm,ier)
 92 
 93 !Arguments-------------------------
 94  integer,intent(inout) :: xval
 95  integer,intent(in) :: dest,tag,comm
 96  integer,intent(out)   :: ier
 97 
 98 !Local variables-------------------
 99 #if defined HAVE_MPI
100  integer :: my_tag
101 #endif
102 
103 ! *************************************************************************
104 
105  ier=0
106 #if defined HAVE_MPI
107  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
108    my_tag = MOD(tag,xmpi_tag_ub)
109    call MPI_SEND([xval],1,MPI_INTEGER,dest,my_tag,comm,ier)
110  end if
111 #endif
112 
113  end subroutine xmpi_send_intv