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))
90 safe_allocate(sendbuf(1:1))
92 recvcounts(1) = sendcnts(
mpi_world%rank+1)
93 safe_allocate(irecvbuf(1:recvcounts(1)))
94 safe_allocate(lrecvbuf(1:recvcounts(1)))
96 call mpi_world%scatterv(sendbuf, sendcnts, isdispls, mpi_double_precision, irecvbuf, recvcounts(1), mpi_double_precision, 0)
97 call mpi_world%scatterv(sendbuf, sendcnts, lsdispls, mpi_double_precision, lrecvbuf, recvcounts(1), mpi_double_precision, 0)
99 equal = all(
is_close(irecvbuf, lrecvbuf))
100 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
103 safe_deallocate_a(sendcnts)
104 safe_deallocate_a(isdispls)
105 safe_deallocate_a(lsdispls)
106 safe_deallocate_a(recvcounts)
107 safe_deallocate_a(sendbuf)
108 safe_deallocate_a(irecvbuf)
109 safe_deallocate_a(lrecvbuf)
113 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
114 integer,
allocatable :: sendcnts(:), recvcounts(:)
115 integer(int32),
allocatable :: irdispls(:)
116 integer(int64),
allocatable :: lrdispls(:)
117 integer,
parameter :: N = 10003
119 logical :: equal, allequal
121 safe_allocate(recvcounts(1:
mpi_world%size))
122 safe_allocate(irdispls(1:
mpi_world%size))
123 safe_allocate(lrdispls(1:
mpi_world%size))
124 safe_allocate(sendcnts(1:1))
126 irdispls(ii) = (ii-1) * n /
mpi_world%size
127 lrdispls(ii) = (ii-1) * n /
mpi_world%size
128 recvcounts(ii) = ii * n /
mpi_world%size - irdispls(ii)
131 safe_allocate(irecvbuf(1:n))
132 safe_allocate(lrecvbuf(1:n))
136 safe_allocate(irecvbuf(1:1))
137 safe_allocate(lrecvbuf(1:1))
139 sendcnts(1) = recvcounts(
mpi_world%rank+1)
140 safe_allocate(sendbuf(1:sendcnts(1)))
141 do ii = 1, sendcnts(1)
145 call mpi_world%gatherv(sendbuf, sendcnts(1), mpi_double_precision, irecvbuf, recvcounts, irdispls, mpi_double_precision, 0)
146 call mpi_world%gatherv(sendbuf, sendcnts(1), mpi_double_precision, lrecvbuf, recvcounts, lrdispls, mpi_double_precision, 0)
150 equal = all(
is_close(irecvbuf, lrecvbuf))
152 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
155 safe_deallocate_a(recvcounts)
156 safe_deallocate_a(irdispls)
157 safe_deallocate_a(lrdispls)
158 safe_deallocate_a(sendcnts)
159 safe_deallocate_a(irecvbuf)
160 safe_deallocate_a(lrecvbuf)
161 safe_deallocate_a(sendbuf)
165 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
166 integer,
allocatable :: sendcnts(:), recvcounts(:)
167 integer(int32),
allocatable :: irdispls(:)
168 integer(int64),
allocatable :: lrdispls(:)
169 integer,
parameter :: n = 10003
171 logical :: equal, allequal
173 safe_allocate(recvcounts(1:
mpi_world%size))
174 safe_allocate(irdispls(1:
mpi_world%size))
175 safe_allocate(lrdispls(1:
mpi_world%size))
176 safe_allocate(sendcnts(1:1))
178 irdispls(ii) = (ii-1) * n /
mpi_world%size
179 lrdispls(ii) = (ii-1) * n /
mpi_world%size
180 recvcounts(ii) = ii * n /
mpi_world%size - irdispls(ii)
182 safe_allocate(irecvbuf(1:n))
183 safe_allocate(lrecvbuf(1:n))
184 sendcnts(1) = recvcounts(
mpi_world%rank+1)
185 safe_allocate(sendbuf(1:sendcnts(1)))
186 do ii = 1, sendcnts(1)
190 call mpi_world%allgatherv(sendbuf, sendcnts(1), mpi_double_precision, irecvbuf, recvcounts, irdispls, mpi_double_precision)
191 call mpi_world%allgatherv(sendbuf, sendcnts(1), mpi_double_precision, lrecvbuf, recvcounts, lrdispls, mpi_double_precision)
193 equal = all(
is_close(irecvbuf, lrecvbuf))
194 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
197 safe_deallocate_a(recvcounts)
198 safe_deallocate_a(irdispls)
199 safe_deallocate_a(lrdispls)
200 safe_deallocate_a(sendcnts)
201 safe_deallocate_a(irecvbuf)
202 safe_deallocate_a(lrecvbuf)
203 safe_deallocate_a(sendbuf)
207 real(real64),
allocatable :: sendbuf(:), irecvbuf(:), lrecvbuf(:)
208 integer,
allocatable :: sendcnts(:), recvcounts(:)
209 integer(int32),
allocatable :: isdispls(:), irdispls(:)
210 integer(int64),
allocatable :: lsdispls(:), lrdispls(:)
211 integer,
parameter :: n = 10003
213 logical :: equal, allequal
215 safe_allocate(sendcnts(1:
mpi_world%size))
216 safe_allocate(isdispls(1:
mpi_world%size))
217 safe_allocate(lsdispls(1:
mpi_world%size))
218 safe_allocate(irdispls(1:
mpi_world%size))
219 safe_allocate(lrdispls(1:
mpi_world%size))
220 safe_allocate(recvcounts(1:
mpi_world%size))
222 isdispls(ii) = (ii-1) * n /
mpi_world%size
223 lsdispls(ii) = (ii-1) * n /
mpi_world%size
224 sendcnts(ii) = ii * n /
mpi_world%size - isdispls(ii)
226 safe_allocate(sendbuf(1:n))
230 call mpi_world%alltoall(sendcnts, 1, mpi_integer, recvcounts, 1, mpi_integer)
231 safe_allocate(irecvbuf(1:sum(recvcounts)))
232 safe_allocate(lrecvbuf(1:sum(recvcounts)))
236 irdispls(ii) = irdispls(ii-1) + recvcounts(ii-1)
237 lrdispls(ii) = lrdispls(ii-1) + recvcounts(ii-1)
240 call mpi_world%alltoallv(sendbuf, sendcnts, isdispls, mpi_double_precision, &
241 irecvbuf, recvcounts, irdispls, mpi_double_precision)
242 call mpi_world%alltoallv(sendbuf, sendcnts, lsdispls, mpi_double_precision, &
243 lrecvbuf, recvcounts, lrdispls, mpi_double_precision)
245 equal = all(
is_close(irecvbuf, lrecvbuf))
246 call mpi_world%allreduce(equal, allequal, 1, mpi_logical, mpi_land)
249 safe_deallocate_a(sendcnts)
250 safe_deallocate_a(isdispls)
251 safe_deallocate_a(lsdispls)
252 safe_deallocate_a(irdispls)
253 safe_deallocate_a(lrdispls)
254 safe_deallocate_a(recvcounts)
255 safe_deallocate_a(sendbuf)
256 safe_deallocate_a(irecvbuf)
257 safe_deallocate_a(lrecvbuf)
This module is intended to contain "only mathematical" functions and procedures.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
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()