Skip to content

Commit dc24db1

Browse files
committed
resolve deprecations
1 parent 8972c87 commit dc24db1

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/distarray.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ mutable struct MPIArray{T,N,A} <: AbstractArray{T,N}
9696
# return new{T,N,A}(sizes, localarray, partitioning, comm, win, rank, local_lengths(partitioning))
9797
return new{T,N,A}(sizes, localarray, partitioning, comm, rank, local_lengths(partitioning))
9898
end
99-
MPIArray{T,N,A}(comm::MPI.Comm, partitions::NTuple{N,<:Integer}, sizes::Vararg{<:Integer,N}) where {T,N,A} = MPIArray{T,N,A}(comm, distribute.(sizes, partitions)...)
100-
MPIArray{T,N,A}(::UndefInitializer, sizes::Vararg{<:Integer,N}) where {T,N,A} = MPIArray{T,N,A}(MPI.COMM_WORLD, (ones(Int, N-1)..., MPI.Comm_size(MPI.COMM_WORLD)), sizes...)
99+
MPIArray{T,N,A}(comm::MPI.Comm, partitions::NTuple{N,<:Integer}, sizes::Vararg{Integer,N}) where {T,N,A} = MPIArray{T,N,A}(comm, distribute.(sizes, partitions)...)
100+
MPIArray{T,N,A}(::UndefInitializer, sizes::Vararg{Integer,N}) where {T,N,A} = MPIArray{T,N,A}(MPI.COMM_WORLD, (ones(Int, N-1)..., MPI.Comm_size(MPI.COMM_WORLD)), sizes...)
101101

102102
end
103103

@@ -120,9 +120,9 @@ end
120120

121121
MPIArray(init::Function, partition_sizes::Vararg{AbstractVector{<:Integer}, N};T=nothing,A=nothing) where N = MPIArray(MPI.COMM_WORLD, init, partition_sizes...;T=T,A=A)
122122

123-
MPIArray(init::Function, partitions::NTuple{N,<:Integer}, sizes::Vararg{<:Integer,N};T=nothing, A=nothing) where N = MPIArray(init, distribute.(sizes, partitions)...; T=T,A=A)
123+
MPIArray(init::Function, partitions::NTuple{N,<:Integer}, sizes::Vararg{Integer,N};T=nothing, A=nothing) where N = MPIArray(init, distribute.(sizes, partitions)...; T=T,A=A)
124124

125-
MPIArray(init::Function, sizes::Vararg{<:Integer,N}; T=nothing, A=nothing) where N = MPIArray(init, (ones(Int, N-1)..., MPI.Comm_size(MPI.COMM_WORLD)), sizes...; T=T, A=A)
125+
MPIArray(init::Function, sizes::Vararg{Integer,N}; T=nothing, A=nothing) where N = MPIArray(init, (ones(Int, N-1)..., MPI.Comm_size(MPI.COMM_WORLD)), sizes...; T=T, A=A)
126126

127127
function MPIArray(comm::MPI.Comm, localarray::AbstractArray)
128128
#TODO, construct from localarrays

src/distdirectives.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Send(arr::AbstractArray, dest::Integer; tag::Integer=0)
1515
end
1616

1717
function Recv!(arr::AbstractArray, src::Integer; tag::Integer=0)
18-
MPI.Recv!(arr, src, tag, COMM_WORLD)
18+
MPI.Recv!(arr, src, tag, COMM_WORLD, nothing)
1919
end
2020

2121
function Isend(arr::AbstractArray, dest::Integer; tag::Integer=0)
@@ -26,8 +26,8 @@ function Irecv!(arr::AbstractArray, src::Integer; tag::Integer=0)
2626
MPI.Irecv!(arr, src, tag, COMM_WORLD)
2727
end
2828

29-
function Reduce!(sendarr::AbstractArray, recvarr::AbstractArray; op=MPI.SUM, root::Integer=0)
30-
MPI.Reduce!(sendarr, recvarr, op, root, COMM_WORLD)
29+
function Reduce!(sendarr::AbstractArray, recvarr::Union{AbstractArray, Nothing}; op=MPI.SUM, root::Integer=0)
30+
MPI.Reduce!(MPI.RBuffer(sendarr, recvarr), op, root, COMM_WORLD)
3131
end
3232

3333
function Allreduce!(arr::AbstractArray; op=MPI.SUM)
@@ -45,8 +45,8 @@ function Allgather!(sendarr::AbstractArray, recvarr::AbstractArray, count::Integ
4545
end
4646

4747
function Allgatherv!(sendarr::AbstractArray, recvarr::AbstractArray, counts::Vector{<:Integer})
48-
#### TODO: auto-detect counts (is it doable?)
49-
MPI.Allgatherv!(sendarr, recvarr, convert(Vector{Cint}, counts), COMM_WORLD)
48+
#### TODO: auto-detect counts (is it simple?)
49+
MPI.Allgatherv!(sendarr, MPI.VBuffer(recvarr, counts), COMM_WORLD)
5050
end
5151

5252
function Scatter!(sendarr::AbstractArray, recvarr::AbstractArray; root::Integer=0)

src/distlinalg.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function LinearAlgebra.mul!(C::MPIMatrix{T,AT}, A::MPIMatrix{T,AT}, B::Transpose
8181
sync()
8282
for i = 0:Size()-1
8383
# NOTE: an array is set to be contiguous only if the first indices are colon.
84-
Reduce!(@view(tmp[:, C.partitioning[i+1][2]]), Rank() == i ? C.localarray : @view(tmp[:, C.partitioning[i+1][2]]); root=i)
84+
Reduce!(@view(tmp[:, C.partitioning[i+1][2]]), Rank() == i ? C.localarray : nothing; root=i)
8585
end
8686
C
8787
end
@@ -352,7 +352,7 @@ function diag!(d::AbstractVector, M::MPIMatrix{T,A}) where {T,A}
352352
counts = reshape(map(x->convert(Cint, length(x[2])), M.partitioning), :)
353353
sync()
354354

355-
MPI.Allgatherv!(MPI.IN_PLACE, d, counts, MPI.COMM_WORLD)
355+
MPI.Allgatherv!(MPI.VBuffer(d, counts), MPI.COMM_WORLD)
356356
end
357357

358358
"""

test/runtests.jl

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ testfiles = sort(filter(istest, readdir(testdir)))
1818
@info "Running DistStat tests" ArrayType nprocs
1919

2020
@testset "$f" for f in testfiles
21-
mpiexec() do cmd
22-
run(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`)
23-
@test true
24-
end
21+
run(`$(mpiexec()) -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`)
22+
@test true
2523
end

0 commit comments

Comments
 (0)