36 write(
message(1), *)
"scatterv: PASS"
38 write(
message(1), *)
"scatterv: FAIL"
43 write(
message(1), *)
"gatherv: PASS"
45 write(
message(1), *)
"gatherv: FAIL"
50 write(
message(1), *)
"allgatherv: PASS"
52 write(
message(1), *)
"allgatherv: FAIL"
57 write(
message(1), *)
"alltoallv: PASS"
59 write(
message(1), *)
"alltoallv: FAIL"
65 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
66 integer,
allocatable :: sendcnts(:), recvcounts(:)
67 integer(int32),
allocatable :: isdispls(:)
68 integer(int64),
allocatable :: lsdispls(:)
69 integer,
parameter :: N = 10003
71 logical :: equal, allequal
76 safe_allocate(recvcounts(1:1))
78 isdispls(ii) = (ii-1) * n /
mpi_world%size
79 lsdispls(ii) = (ii-1) * n /
mpi_world%size
80 sendcnts(ii) = ii * n /
mpi_world%size - isdispls(ii)
83 safe_allocate(sendbuf(1:n))
88 recvcounts(1) = sendcnts(
mpi_world%rank+1)
89 safe_allocate(irecvbuf(1:recvcounts(1)))
90 safe_allocate(lrecvbuf(1:recvcounts(1)))
92 call mpi_world%scatterv(sendbuf, sendcnts, isdispls, mpi_double_precision, irecvbuf, recvcounts(1), mpi_double_precision, 0)
93 call mpi_world%scatterv(sendbuf, sendcnts, lsdispls, mpi_double_precision, lrecvbuf, recvcounts(1), mpi_double_precision, 0)
95 equal = all(
is_close(irecvbuf, lrecvbuf))
96 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
99 safe_deallocate_a(sendcnts)
100 safe_deallocate_a(isdispls)
101 safe_deallocate_a(lsdispls)
102 safe_deallocate_a(recvcounts)
104 safe_deallocate_a(sendbuf)
106 safe_deallocate_a(irecvbuf)
107 safe_deallocate_a(lrecvbuf)
111 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
112 integer,
allocatable :: sendcnts(:), recvcounts(:)
113 integer(int32),
allocatable :: irdispls(:)
114 integer(int64),
allocatable :: lrdispls(:)
115 integer,
parameter :: N = 10003
119 safe_allocate(recvcounts(1:
mpi_world%size))
120 safe_allocate(irdispls(1:
mpi_world%size))
121 safe_allocate(lrdispls(1:
mpi_world%size))
122 safe_allocate(sendcnts(1:1))
124 irdispls(ii) = (ii-1) * n /
mpi_world%size
125 lrdispls(ii) = (ii-1) * n /
mpi_world%size
126 recvcounts(ii) = ii * n /
mpi_world%size - irdispls(ii)
129 safe_allocate(irecvbuf(1:n))
130 safe_allocate(lrecvbuf(1:n))
132 sendcnts(1) = recvcounts(
mpi_world%rank+1)
133 safe_allocate(sendbuf(1:sendcnts(1)))
134 do ii = 1, sendcnts(1)
138 call mpi_world%gatherv(sendbuf, sendcnts(1), mpi_double_precision, irecvbuf, recvcounts, irdispls, mpi_double_precision, 0)
139 call mpi_world%gatherv(sendbuf, sendcnts(1), mpi_double_precision, lrecvbuf, recvcounts, lrdispls, mpi_double_precision, 0)
142 equal = all(
is_close(irecvbuf, lrecvbuf))
146 safe_deallocate_a(recvcounts)
147 safe_deallocate_a(irdispls)
148 safe_deallocate_a(lrdispls)
149 safe_deallocate_a(sendcnts)
151 safe_deallocate_a(irecvbuf)
152 safe_deallocate_a(lrecvbuf)
154 safe_deallocate_a(sendbuf)
158 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
159 integer,
allocatable :: sendcnts(:), recvcounts(:)
160 integer(int32),
allocatable :: irdispls(:)
161 integer(int64),
allocatable :: lrdispls(:)
162 integer,
parameter :: n = 10003
164 logical :: equal, allequal
166 safe_allocate(recvcounts(1:
mpi_world%size))
167 safe_allocate(irdispls(1:
mpi_world%size))
168 safe_allocate(lrdispls(1:
mpi_world%size))
169 safe_allocate(sendcnts(1:1))
171 irdispls(ii) = (ii-1) * n /
mpi_world%size
172 lrdispls(ii) = (ii-1) * n /
mpi_world%size
173 recvcounts(ii) = ii * n /
mpi_world%size - irdispls(ii)
175 safe_allocate(irecvbuf(1:n))
176 safe_allocate(lrecvbuf(1:n))
177 sendcnts(1) = recvcounts(
mpi_world%rank+1)
178 safe_allocate(sendbuf(1:sendcnts(1)))
179 do ii = 1, sendcnts(1)
183 call mpi_world%allgatherv(sendbuf, sendcnts(1), mpi_double_precision, irecvbuf, recvcounts, irdispls, mpi_double_precision)
184 call mpi_world%allgatherv(sendbuf, sendcnts(1), mpi_double_precision, lrecvbuf, recvcounts, lrdispls, mpi_double_precision)
186 equal = all(
is_close(irecvbuf, lrecvbuf))
187 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
190 safe_deallocate_a(recvcounts)
191 safe_deallocate_a(irdispls)
192 safe_deallocate_a(lrdispls)
193 safe_deallocate_a(sendcnts)
194 safe_deallocate_a(irecvbuf)
195 safe_deallocate_a(lrecvbuf)
196 safe_deallocate_a(sendbuf)
200 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
201 integer,
allocatable :: sendcnts(:), recvcounts(:)
202 integer(int32),
allocatable :: isdispls(:), irdispls(:)
203 integer(int64),
allocatable :: lsdispls(:), lrdispls(:)
204 integer,
parameter :: n = 10003
206 logical :: equal, allequal
208 safe_allocate(sendcnts(1:
mpi_world%size))
209 safe_allocate(isdispls(1:
mpi_world%size))
210 safe_allocate(lsdispls(1:
mpi_world%size))
211 safe_allocate(irdispls(1:
mpi_world%size))
212 safe_allocate(lrdispls(1:
mpi_world%size))
213 safe_allocate(recvcounts(1:
mpi_world%size))
215 isdispls(ii) = (ii-1) * n /
mpi_world%size
216 lsdispls(ii) = (ii-1) * n /
mpi_world%size
217 sendcnts(ii) = ii * n /
mpi_world%size - isdispls(ii)
219 safe_allocate(sendbuf(1:n))
223 call mpi_world%alltoall(sendcnts, 1, mpi_integer, recvcounts, 1, mpi_integer)
224 safe_allocate(irecvbuf(1:sum(recvcounts)))
225 safe_allocate(lrecvbuf(1:sum(recvcounts)))
229 irdispls(ii) = irdispls(ii-1) + recvcounts(ii-1)
230 lrdispls(ii) = lrdispls(ii-1) + recvcounts(ii-1)
233 call mpi_world%alltoallv(sendbuf, sendcnts, isdispls, mpi_double_precision, &
234 irecvbuf, recvcounts, irdispls, mpi_double_precision)
235 call mpi_world%alltoallv(sendbuf, sendcnts, lsdispls, mpi_double_precision, &
236 lrecvbuf, recvcounts, lrdispls, mpi_double_precision)
238 equal = all(
is_close(irecvbuf, lrecvbuf))
239 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
242 safe_deallocate_a(sendcnts)
243 safe_deallocate_a(isdispls)
244 safe_deallocate_a(lsdispls)
245 safe_deallocate_a(irdispls)
246 safe_deallocate_a(lrdispls)
247 safe_deallocate_a(recvcounts)
248 safe_deallocate_a(sendbuf)
249 safe_deallocate_a(irecvbuf)
250 safe_deallocate_a(lrecvbuf)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
type(mpi_grp_t), public mpi_world
subroutine, public test_mpiwrappers
logical function test_allgatherv()
logical function test_gatherv()
logical function test_scatterv()
logical function test_alltoallv()