Line data Source code
1 : !{\src2tex{textfont=tt}}
2 : !!****f* ABINIT/xmpi_alltoall
3 : !! NAME
4 : !! xmpi_alltoall
5 : !!
6 : !! FUNCTION
7 : !! This module contains functions that calls MPI routine,
8 : !! if we compile the code using the MPI CPP flags.
9 : !! xmpi_alltoall is the generic function.
10 : !!
11 : !! COPYRIGHT
12 : !! Copyright (C) 2001-2026 ABINIT group (AR,XG)
13 : !! This file is distributed under the terms of the
14 : !! GNU General Public License, see ~ABINIT/COPYING
15 : !! or http://www.gnu.org/copyleft/gpl.txt .
16 : !!
17 : !! SOURCE
18 :
19 : !!***
20 :
21 : !!****f* ABINIT/xmpi_alltoall_int
22 : !! NAME
23 : !! xmpi_alltoall_int
24 : !!
25 : !! FUNCTION
26 : !! Sends data from all to all processes.
27 : !! Target: integer mono dimensional arrays.
28 : !!
29 : !! SOURCE
30 :
31 0 : subroutine xmpi_alltoall_int(xval, sendsize, recvbuf, recvsize, comm, ier)
32 :
33 : !Arguments-------------------------
34 : integer, DEV_CONTARRD intent(in) :: xval(:)
35 : integer, DEV_CONTARRD intent(inout) :: recvbuf(:)
36 : integer ,intent(in) :: sendsize, recvsize
37 : integer ,intent(in) :: comm
38 : integer ,intent(out) :: ier
39 :
40 : !Local variables-------------------
41 :
42 : ! *************************************************************************
43 :
44 0 : ier=0
45 : #if defined HAVE_MPI
46 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
47 : ! allgather xval on all proc. in comm
48 : call MPI_ALLTOALL(xval, sendsize, MPI_INTEGER, recvbuf, &
49 0 : & recvsize, MPI_INTEGER, comm, ier)
50 0 : else if (comm == MPI_COMM_SELF) then
51 0 : recvbuf=xval
52 : end if
53 : #else
54 : recvbuf=xval
55 : #endif
56 :
57 0 : end subroutine xmpi_alltoall_int
58 : !!***
59 :
60 : !!****f* ABINIT/xmpi_alltoall_dp2d
61 : !! NAME
62 : !! xmpi_alltoall_dp2d
63 : !!
64 : !! FUNCTION
65 : !! Sends data from all to all processes.
66 : !! Target: double precision two-dimensional arrays.
67 : !!
68 : !! SOURCE
69 :
70 0 : subroutine xmpi_alltoall_dp2d(xval, sendsize, recvbuf, recvsize, comm, ier)
71 :
72 : !Arguments-------------------------
73 : real(dp), DEV_CONTARRD intent(in) :: xval(:,:)
74 : real(dp), DEV_CONTARRD intent(inout) :: recvbuf(:,:)
75 : integer ,intent(in) :: sendsize, recvsize
76 : integer ,intent(in) :: comm
77 : integer ,intent(out) :: ier
78 :
79 : ! *************************************************************************
80 :
81 0 : ier=0
82 : #if defined HAVE_MPI
83 0 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
84 : ! allgather xval on all proc. in comm
85 : call MPI_ALLTOALL(xval, sendsize, MPI_DOUBLE_PRECISION, recvbuf, &
86 0 : & recvsize, MPI_DOUBLE_PRECISION, comm, ier)
87 0 : else if (comm == MPI_COMM_SELF) then
88 0 : recvbuf=xval
89 : end if
90 : #else
91 : recvbuf=xval
92 : #endif
93 :
94 0 : end subroutine xmpi_alltoall_dp2d
95 : !!***
96 :
97 : !!****f* ABINIT/xmpi_alltoall_dp4d
98 : !! NAME
99 : !! xmpi_alltoall_dp4d
100 : !!
101 : !! FUNCTION
102 : !! Sends data from all to all processes.
103 : !! Target: double precision four-dimensional arrays.
104 : !!
105 : !! SOURCE
106 :
107 1409398 : subroutine xmpi_alltoall_dp4d(xval, sendsize, recvbuf, recvsize, comm, ier)
108 :
109 : !Arguments-------------------------
110 : real(dp), DEV_CONTARRD intent(in) :: xval(:,:,:,:)
111 : real(dp), DEV_CONTARRD intent(inout) :: recvbuf(:,:,:,:)
112 : integer ,intent(in) :: sendsize, recvsize
113 : integer ,intent(in) :: comm
114 : integer ,intent(out) :: ier
115 :
116 : ! *************************************************************************
117 :
118 1409398 : ier=0
119 : #if defined HAVE_MPI
120 1409398 : if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
121 : ! allgather xval on all proc. in comm
122 : call MPI_ALLTOALL(xval, sendsize, MPI_DOUBLE_PRECISION, recvbuf, &
123 1409398 : & recvsize, MPI_DOUBLE_PRECISION, comm, ier)
124 0 : else if (comm == MPI_COMM_SELF) then
125 0 : recvbuf=xval
126 : end if
127 : #else
128 : recvbuf=xval
129 : #endif
130 :
131 1409398 : end subroutine xmpi_alltoall_dp4d
132 : !!***
|