TABLE OF CONTENTS


ABINIT/xmpi_irecv [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_irecv

FUNCTION

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

[ Top ] [ Functions ]

NAME

  xmpi_irecv_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

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

SIDE EFFECTS

  xval= buffer array

NOTES

  status of MPI_IRECV is explicitly ignored

PARENTS

CHILDREN

      mpi_irecv

SOURCE

165 subroutine xmpi_irecv_dp1d(xval,source,tag,comm,request,ierr)
166 
167 !Arguments-------------------------
168  real(dp) ABI_ASYNC, intent(inout) :: xval(:)
169  integer, intent(in) :: source,tag,comm
170  integer, intent(out) :: ierr
171  integer, intent(out) :: request
172 
173 !Local variables-------------------
174 #if defined HAVE_MPI
175  integer :: my_tag,n1
176 #endif
177 
178 ! *************************************************************************
179 
180  ierr=0
181 #if defined HAVE_MPI
182  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
183    n1=size(xval,dim=1)
184    my_tag=MOD(tag,xmpi_tag_ub)
185    call MPI_IRECV(xval,n1,MPI_DOUBLE_PRECISION,source,my_tag,comm,request,ierr)
186    xmpi_count_requests = xmpi_count_requests + 1
187  end if
188 #endif
189 
190 end subroutine xmpi_irecv_dp1d

ABINIT/xmpi_irecv_dp2d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_irecv_dp2d

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

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

SIDE EFFECTS

  xval= buffer array

NOTES

  status of MPI_IRECV is explicitly ignored

PARENTS

CHILDREN

      mpi_irecv

SOURCE

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

ABINIT/xmpi_irecv_dp3d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_irecv_dp3d

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

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

SIDE EFFECTS

  xval= buffer array

NOTES

  status of MPI_IRECV is explicitly ignored

PARENTS

CHILDREN

      mpi_irecv

SOURCE

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

ABINIT/xmpi_irecv_int1d [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_irecv_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

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

SIDE EFFECTS

  xval= buffer array

PARENTS

CHILDREN

      mpi_irecv

SOURCE

108 subroutine xmpi_irecv_int1d(xval,source,tag,comm,request,ierr)
109 
110 !Arguments-------------------------
111  integer ABI_ASYNC, intent(inout) :: xval(:)
112  integer,intent(in) :: source,tag,comm
113  integer, intent(out) :: request
114  integer,intent(out) :: ierr
115 !Local variables-------------------
116 
117 #if defined HAVE_MPI
118   integer :: n1,my_tag
119 #endif
120 
121 ! *************************************************************************
122 
123  ierr=0
124 #if defined HAVE_MPI
125  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
126    my_tag=MOD(tag,xmpi_tag_ub)
127    n1=size(xval)
128    call MPI_IRECV(xval,n1,MPI_INTEGER,source,my_tag,comm,request,ierr)
129    xmpi_count_requests = xmpi_count_requests + 1
130  end if
131 #endif
132 
133  end subroutine xmpi_irecv_int1d

ABINIT/xmpi_irecv_intv [ Functions ]

[ Top ] [ Functions ]

NAME

  xmpi_irecv_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

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

SIDE EFFECTS

  xval= buffer array

NOTES

  status of MPI_IRECV is explicitly ignored

PARENTS

CHILDREN

      mpi_irecv

SOURCE

52 subroutine xmpi_irecv_intv(xval,source,tag,comm,request,ierr)
53 
54 !Arguments-------------------------
55  integer ABI_ASYNC, intent(inout), target :: xval
56  integer,intent(in) :: source,tag,comm
57  integer,intent(out) :: ierr
58  integer, intent(out) :: request
59 
60 !Local variables-------------------
61 #if defined HAVE_MPI
62  integer :: my_tag
63  integer, pointer :: arr_xval(:)
64  type(c_ptr) :: cptr
65 #endif
66 
67 ! *************************************************************************
68 
69  ierr=0
70 #if defined HAVE_MPI
71  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
72    my_tag=MOD(tag,xmpi_tag_ub)
73    cptr=c_loc(xval) ; call c_f_pointer(cptr,arr_xval,[1])
74    call MPI_IRECV(arr_xval,1,MPI_INTEGER,source,my_tag,comm,request,ierr)
75    xmpi_count_requests = xmpi_count_requests + 1
76  end if
77 #endif
78 
79  end subroutine xmpi_irecv_intv