Skip to content

Commit

Permalink
* Fixed several issues related to the Exscan! API and implementation, (
Browse files Browse the repository at this point in the history
…#396)

* Fixed several issues related to the Exscan! API and implementation, (#396) together with the typos described in
  #394

* Added two tests to test_exscan.jl in order to stress two untested
  overloaded variants of Exscan.
  • Loading branch information
amartinhuertas authored Jun 5, 2020
1 parent 76ec31d commit 8899971
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/collective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -844,16 +844,16 @@ end
function Exscan!(sendbuf, recvbuf, count::Integer, opfunc, comm::Comm)
Exscan!(sendbuf, recvbuf, count, Op(opfunc, eltype(recvbuf)), comm)
end
function Exscan!(sendbuf::AbstractArray, recvbuf, op, comm::Comm)
function Exscan!(sendbuf::AbstractArray, recvbuf::AbstractArray, op, comm::Comm)
Exscan!(sendbuf, recvbuf, length(sendbuf), op, comm)
end

# inplace
function Exscan!(buf, count::Integer, opfunc, comm::Comm)
Exscan!(MPI_IN_PLACE, buf, count, Op(opfunc, eltype(sendbuf)), comm)
Exscan!(MPI_IN_PLACE, buf, count, Op(opfunc, eltype(buf)), comm)
end
function Exscan!(buf, opfunc, comm::Comm)
Exscan!(buf, length(buf), Op(opfunc, eltype(sendbuf)), comm)
function Exscan!(buf, op, comm::Comm)
Exscan!(buf, length(buf), op, comm)
end


Expand Down
10 changes: 9 additions & 1 deletion test/test_exscan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ for T in setdiff([Base.uniontypes(MPI.MPIDatatype)...], [Char, Int8, UInt8])

B = MPI.Exscan(A, *, comm)
@test B isa ArrayType{T}

MPI.Exscan!(A, length(A), *, comm)
if rank > 0
@test B == ArrayType{T}(fill(T(prodrank), 4))
@test A == ArrayType{T}(fill(T(prodrank), 4))
end

A = ArrayType{T}(fill(T(rank+1), 4))
MPI.Exscan!(A, *, comm)
if rank > 0
@test A == ArrayType{T}(fill(T(prodrank), 4))
end

B = MPI.Exscan(T(rank+1), *, comm)
Expand Down

0 comments on commit 8899971

Please sign in to comment.