TABLE OF CONTENTS


ABINIT/xmpi_recv [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv

FUNCTION

  This module contains functions that call MPI routine MPI_RECV,
  to receive data on one processor sent by another,
  if we compile the code using the MPI CPP flags.
  xmpi_recv 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 .

TODO

SOURCE


ABINIT/xmpi_recv_char [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_char

FUNCTION

  Receives data from one proc sent by another.
  Target: character.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

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

ABINIT/xmpi_recv_dp [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_dp

FUNCTION

  Receives data from one proc sent by another.
  Target: double precision value.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

355 subroutine xmpi_recv_dp(xval,source,tag,comm,ier)
356 
357 !Arguments-------------------------
358  real(dp), DEV_CONTARRD intent(inout) :: xval
359  integer ,intent(in) :: source,tag,comm
360  integer ,intent(out) :: ier
361 
362 !Local variables-------------------
363 #if defined HAVE_MPI
364  integer :: my_tag
365  real(dp) :: arr_xval(1)
366 #endif
367 
368 ! *************************************************************************
369 
370  ier=0
371 #if defined HAVE_MPI
372  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
373    my_tag = MOD(tag,xmpi_tag_ub)
374    call MPI_RECV(arr_xval,1,MPI_DOUBLE_PRECISION,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
375    xval=arr_xval(1)
376  end if
377 #endif
378 
379 end subroutine xmpi_recv_dp

ABINIT/xmpi_recv_dp1d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_dp1d

FUNCTION

  Receives data from one proc sent by another.
  Target: double precision one-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

406 subroutine xmpi_recv_dp1d(xval,source,tag,comm,ier)
407 
408 !Arguments-------------------------
409  real(dp), DEV_CONTARRD intent(inout) :: xval(:)
410  integer ,intent(in) :: source,tag,comm
411  integer ,intent(out) :: ier
412 
413 !Local variables-------------------
414 #if defined HAVE_MPI
415  integer :: n1,my_tag
416 #endif
417 
418 ! *************************************************************************
419 
420  ier=0
421 #if defined HAVE_MPI
422  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
423    n1=size(xval,dim=1)
424    my_tag = MOD(tag,xmpi_tag_ub)
425    call MPI_RECV(xval,n1,MPI_DOUBLE_PRECISION,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
426  end if
427 #endif
428 
429 end subroutine xmpi_recv_dp1d

ABINIT/xmpi_recv_dp2d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_dp2d

FUNCTION

  Receives data from one proc sent by another.
  Target: double precision two-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

456 subroutine xmpi_recv_dp2d(xval,source,tag,comm,ier)
457 
458 !Arguments-------------------------
459  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:)
460  integer ,intent(in) :: source,tag,comm
461  integer ,intent(out) :: ier
462 
463 !Local variables-------------------
464 #if defined HAVE_MPI
465  integer :: my_dt,my_op,n1,n2,my_tag
466  integer(kind=int64) :: ntot
467 #endif
468 
469 ! *************************************************************************
470 
471  ier=0
472 #if defined HAVE_MPI
473  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
474    n1=size(xval,dim=1)
475    n2=size(xval,dim=2)
476    my_tag=MOD(tag,xmpi_tag_ub)
477 
478 
479    !This product of dimensions can be greater than a 32bit integer
480    !We use a INT64 to store it. If it is too large, we switch to an
481    !alternate routine because MPI<4 doesnt handle 64 bit counts.
482    ntot=int(n1*n2,kind=int64)
483 
484    if (ntot<=xmpi_maxint32_64) then
485      call MPI_RECV(xval,n1*n2,MPI_DOUBLE_PRECISION,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
486    else
487      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
488      call MPI_RECV(xval,1,my_dt,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
489      call xmpi_largetype_free(my_dt,my_op)
490    end if
491 
492  end if
493 #endif
494 
495 end subroutine xmpi_recv_dp2d

ABINIT/xmpi_recv_dp3d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_dp3d

FUNCTION

  Receives data from one proc sent by another.
  Target: double precision three-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

522 subroutine xmpi_recv_dp3d(xval,source,tag,comm,ier)
523 
524 !Arguments-------------------------
525  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:)
526  integer ,intent(in) :: source,tag,comm
527  integer ,intent(out)   :: ier
528 
529 !Local variables-------------------
530 #if defined HAVE_MPI
531  integer :: my_dt,my_op,n1,n2,n3,my_tag
532  integer(kind=int64) :: ntot
533 #endif
534 
535 ! *************************************************************************
536 
537  ier=0
538 #if defined HAVE_MPI
539  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
540    n1=size(xval,dim=1)
541    n2=size(xval,dim=2)
542    n3=size(xval,dim=3)
543    my_tag=MOD(tag,xmpi_tag_ub)
544 
545 
546    !This product of dimensions can be greater than a 32bit integer
547    !We use a INT64 to store it. If it is too large, we switch to an
548    !alternate routine because MPI<4 doesnt handle 64 bit counts.
549    ntot=int(n1*n2*n3,kind=int64)
550 
551    if (ntot<=xmpi_maxint32_64) then
552      call MPI_RECV(xval,n1*n2*n3,MPI_DOUBLE_PRECISION,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
553    else
554      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
555      call MPI_RECV(xval,1,my_dt,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
556      call xmpi_largetype_free(my_dt,my_op)
557    end if
558 
559  end if
560 #endif
561 
562 end subroutine xmpi_recv_dp3d

ABINIT/xmpi_recv_dp4d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_dp4d

FUNCTION

  Receives data from one proc sent by another.
  Target: double precision fourd-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

589 subroutine xmpi_recv_dp4d(xval,source,tag,comm,ier)
590 
591 !Arguments-------------------------
592  real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:,:)
593  integer ,intent(in) :: source,tag,comm
594  integer ,intent(out)   :: ier
595 
596 !Local variables-------------------
597 #if defined HAVE_MPI
598  integer :: my_dt,my_op,n1,n2,n3,n4,my_tag
599  integer(kind=int64) :: ntot
600 #endif
601 
602 ! *************************************************************************
603 
604  ier=0
605 #if defined HAVE_MPI
606  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
607    n1=size(xval,dim=1)
608    n2=size(xval,dim=2)
609    n3=size(xval,dim=3)
610    n4=size(xval,dim=4)
611    my_tag=MOD(tag,xmpi_tag_ub)
612 
613 
614    !This product of dimensions can be greater than a 32bit integer
615    !We use a INT64 to store it. If it is too large, we switch to an
616    !alternate routine because MPI<4 doesnt handle 64 bit counts.
617    ntot=int(n1*n2*n3*n4,kind=int64)
618 
619    if (ntot<=xmpi_maxint32_64) then
620      call MPI_RECV(xval,n1*n2*n3*n4,MPI_DOUBLE_PRECISION,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
621    else
622      call xmpi_largetype_create(ntot,MPI_DOUBLE_PRECISION,my_dt,my_op,MPI_OP_NULL)
623      call MPI_RECV(xval,1,my_dt,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
624      call xmpi_largetype_free(my_dt,my_op)
625    end if
626 
627  end if
628 #endif
629 
630 end subroutine xmpi_recv_dp4d

ABINIT/xmpi_recv_int1d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_int1d

FUNCTION

  Receives data from one proc sent by another.
  Target: integer one-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

165 subroutine xmpi_recv_int1d(xval,source,tag,comm,ier)
166 
167 !Arguments-------------------------
168  integer, DEV_CONTARRD intent(inout) :: xval(:)
169  integer,intent(in) :: source,tag,comm
170  integer,intent(out) :: ier
171 
172 !Local variables-------------------
173 #if defined HAVE_MPI
174  integer :: my_tag, n1
175 #endif
176 
177 ! *************************************************************************
178 
179  ier=0
180 #if defined HAVE_MPI
181  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
182    n1=size(xval,dim=1)
183    my_tag = MOD(tag,xmpi_tag_ub)
184    call MPI_RECV(xval,n1,MPI_INTEGER,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
185  end if
186 #endif
187 
188  end subroutine xmpi_recv_int1d

ABINIT/xmpi_recv_int2d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_int2d

FUNCTION

  Receives data from one proc sent by another.
  Target: integer two-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

PARENTS

CHILDREN

      mpi_recv

SOURCE

219 subroutine xmpi_recv_int2d(xval,source,tag,comm,ier)
220 
221 !Arguments-------------------------
222  integer,intent(inout) :: xval(:,:)
223  integer ,intent(in) :: source,tag,comm
224  integer ,intent(out)   :: ier
225 
226 !Local variables-------------------
227 #if defined HAVE_MPI
228  integer :: my_dt,my_op,n1,n2,my_tag
229  integer(kind=int64) :: ntot
230 #endif
231 
232 ! *************************************************************************
233 
234  ier=0
235 #if defined HAVE_MPI
236  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
237    n1=size(xval,dim=1)
238    n2=size(xval,dim=2)
239    my_tag=MOD(tag,xmpi_tag_ub)
240 
241 
242    !This product of dimensions can be greater than a 32bit integer
243    !We use a INT64 to store it. If it is too large, we switch to an
244    !alternate routine because MPI<4 doesnt handle 64 bit counts.
245    ntot=int(n1*n2,kind=int64)
246 
247    if (ntot<=xmpi_maxint32_64) then
248      call MPI_RECV(xval,n1*n2,MPI_INTEGER,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
249    else
250      call xmpi_largetype_create(ntot,MPI_INTEGER,my_dt,my_op,MPI_OP_NULL)
251      call MPI_RECV(xval,1,my_dt,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
252      call xmpi_largetype_free(my_dt,my_op)
253    end if
254 
255  end if
256 #endif
257 
258 end subroutine xmpi_recv_int2d

ABINIT/xmpi_recv_int3d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_int3d

FUNCTION

  Receives data from one proc sent by another.
  Target: integer three-dimensional arrays.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

PARENTS

CHILDREN

      mpi_recv

SOURCE

289 subroutine xmpi_recv_int3d(xval,source,tag,comm,ier)
290 
291 !Arguments-------------------------
292  integer,intent(inout) :: xval(:,:,:)
293  integer ,intent(in) :: source,tag,comm
294  integer ,intent(out)   :: ier
295 
296 !Local variables-------------------
297 #if defined HAVE_MPI
298  integer :: my_dt,my_op,n1,n2,n3,my_tag
299  integer(kind=int64) :: ntot
300 #endif
301 
302 ! *************************************************************************
303 
304  ier=0
305 #if defined HAVE_MPI
306  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
307    n1=size(xval,dim=1)
308    n2=size(xval,dim=2)
309    n3=size(xval,dim=3)
310    my_tag=MOD(tag,xmpi_tag_ub)
311 
312    !This product of dimensions can be greater than a 32bit integer
313    !We use a INT64 to store it. If it is too large, we switch to an
314    !alternate routine because MPI<4 doesnt handle 64 bit counts.
315    ntot=int(n1*n2*n3,kind=int64)
316 
317    if (ntot<=xmpi_maxint32_64) then
318      call MPI_RECV(xval,n1*n2*n3,MPI_INTEGER,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
319    else
320      call xmpi_largetype_create(ntot,MPI_INTEGER,my_dt,my_op,MPI_OP_NULL)
321      call MPI_RECV(xval,1,my_dt,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
322      call xmpi_largetype_free(my_dt,my_op)
323    end if
324 
325  end if
326 #endif
327 
328 end subroutine xmpi_recv_int3d

ABINIT/xmpi_recv_intv [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_recv_intv

FUNCTION

  Receives data from one processor sent by another.
  Target: single integer.

INPUTS

  source :: rank of source 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

NOTES

  status of MPI_RECV is explicitly ignored

SOURCE

 99 subroutine xmpi_recv_intv(xval,source,tag,comm,ier)
100 
101 !Arguments-------------------------
102  integer,intent(inout) :: xval
103  integer,intent(in) :: source,tag,comm
104  integer,intent(out)   :: ier
105 
106 !Local variables-------------------
107 #if defined HAVE_MPI
108  integer :: my_tag
109  integer :: arr_xval(1)
110 #endif
111 
112 ! *************************************************************************
113 
114  ier=0
115 #if defined HAVE_MPI
116  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
117    my_tag=MOD(tag,xmpi_tag_ub)
118    call MPI_RECV(arr_xval,1,MPI_INTEGER,source,my_tag,comm,MPI_STATUS_IGNORE,ier)
119    xval=arr_xval(1)
120  end if
121 #endif
122 
123  end subroutine xmpi_recv_intv