Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
arch:
- x64
include:
- {version: '1', os: ubuntu-latest, arch: x64}
- {version: '1', os: macos-14, arch: aarch64}
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v2
Expand All @@ -42,12 +39,9 @@ jobs:
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
arch:
- x64
include:
- {version: '1', os: ubuntu-latest, arch: x64}
- {version: '1', os: macos-14, arch: aarch64}
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v2
Expand All @@ -67,12 +61,9 @@ jobs:
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
arch:
- x64
include:
- {version: '1', os: ubuntu-latest, arch: x64}
- {version: '1', os: macos-14, arch: aarch64}
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v2
Expand Down
48 changes: 41 additions & 7 deletions src/mpi_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,32 @@ end
function reduction_impl(op,a::MPIArray,destination;init=nothing)
T = eltype(a)
comm = a.comm
opr = MPI.Op(op,T)
# Attempt to create a user-defined MPI operator; fallback if unsupported
# User-defined reduction operators are currently not supported on non-Intel
# architectures.
│ # See https://github.com/JuliaParallel/MPI.jl/issues/404 and
# https://juliaparallel.org/MPI.jl/stable/knownissues/ for more details.
opr = nothing
try
opr = MPI.Op(op, T)
catch
# Fallback: gather all elements and perform local reduction
arr = collect(a)
if init !== nothing
b_item = reduce(op, arr; init=init)
else
b_item = reduce(op, arr)
end
return MPIArray(b_item, comm, size(a))
end
item_ref = Ref{T}()
if destination !== :all
root = destination-1
MPI.Reduce!(Ref(a.item),item_ref,opr,root,comm) # TODO Ref needed?
b_item = item_ref[]
if MPI.Comm_rank(comm) == root
if init !== nothing
b_item = op(b_item,init)
end
if MPI.Comm_rank(comm) == root && init !== nothing
b_item = op(b_item,init)
end
b_item
else
MPI.Allreduce!(Ref(a.item),item_ref,opr,comm) # TODO Ref needed?
b_item = item_ref[]
Expand All @@ -510,7 +524,27 @@ function non_blocking_reduction_impl(op, a::MPIArray, setup, destination=:all; i
@assert destination === :all
T = eltype(a)
comm = a.comm
opr = MPI.Op(op, T)
# Attempt to create a user-defined MPI operator; fallback if unsupported
# User-defined reduction operators are currently not supported on non-Intel
# architectures.
│ # See https://github.com/JuliaParallel/MPI.jl/issues/404 and
# https://juliaparallel.org/MPI.jl/stable/knownissues/ for more details.
opr = nothing
try
opr = MPI.Op(op, T)
catch
# Fallback: asynchronous gather and local reduction
@fake_async begin
arr = collect(a)
if init !== nothing
b_item = reduce(op, arr; init=init)
else
b_item = reduce(op, arr)
end
MPIArray(b_item, comm, size(a))
end
return
end

sendbuf = Ref(a.item)
recvbuf = setup.recvbuf
Expand Down