Skip to content

Commit bd8bfdc

Browse files
committed
low level Waitall
1 parent 4cd7118 commit bd8bfdc

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/nonblocking.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ end
244244

245245

246246
"""
247-
Waitall(reqs::AbstractVector{Request}[, statuses::Vector{Status}])
247+
Waitall([count::Integer,] reqs::AbstractVector{Request}[, statuses::Vector{Status}])
248248
statuses = Waitall(reqs::AbstractVector{Request}, Status)
249249
250250
Block until all active requests in the array `reqs` are complete.
@@ -255,15 +255,20 @@ each request.
255255
# External links
256256
$(_doc_external("MPI_Waitall"))
257257
"""
258-
function Waitall(reqs::RequestSet, statuses::Union{AbstractVector{Status},Nothing}=nothing)
259-
n = length(reqs)
260-
n == 0 && return nothing
261-
@assert isnothing(statuses) || length(statuses) >= n
258+
function Waitall(count::Integer, reqs::AbstractVector{MPI_Request}, statuses::Union{AbstractVector{Status},Nothing}=nothing)
262259
# int MPI_Waitall(int count, MPI_Request array_of_requests[],
263260
# MPI_Status array_of_statuses[])
264261
@mpichk ccall((:MPI_Waitall, libmpi), Cint,
265262
(Cint, Ptr{MPI_Request}, Ptr{Status}),
266-
n, reqs.vals, something(statuses, Consts.MPI_STATUSES_IGNORE[]))
263+
count, reqs, something(statuses, Consts.MPI_STATUSES_IGNORE[]))
264+
265+
return nothing
266+
end
267+
function Waitall(reqs::RequestSet, statuses::Union{AbstractVector{Status},Nothing}=nothing)
268+
n = length(reqs)
269+
n == 0 && return nothing
270+
@assert isnothing(statuses) || length(statuses) >= n
271+
Waitall(n, reqs.vals, statuses)
267272
update!(reqs)
268273
return nothing
269274
end
@@ -272,6 +277,7 @@ function Waitall(reqs::RequestSet, ::Type{Status})
272277
Waitall(reqs, statuses)
273278
return statuses
274279
end
280+
275281
Waitall(reqs::AbstractVector{Request}, args...) = Waitall(RequestSet(reqs), args...)
276282

277283

0 commit comments

Comments
 (0)