From 99ab2267556a761d41991fd44c7401601b246497 Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 14:54:24 +0200 Subject: [PATCH 1/7] add macos arm64 to ci --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 503857b5..e65d9c99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,10 @@ jobs: - '1' os: - ubuntu-latest + - macos-14 arch: - x64 + - arm64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 From cc573b7e87c76d3498ca970800d9741d6b749500 Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:06:01 +0200 Subject: [PATCH 2/7] update CI to avoid ubuntu+arm64 and macos+x64 --- .github/workflows/ci.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e65d9c99..79217e3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,12 +19,11 @@ jobs: matrix: version: - '1' - os: - - ubuntu-latest - - macos-14 - arch: - - x64 - - arm64 + include: + - os: ubuntu-latest + arch: x64 + - os: macos-14 + arch: arm64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 @@ -46,10 +45,11 @@ jobs: matrix: version: - '1' - os: - - ubuntu-latest - arch: - - x64 + include: + - os: ubuntu-latest + arch: x64 + - os: macos-14 + arch: arm64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 @@ -71,10 +71,11 @@ jobs: matrix: version: - '1' - os: - - ubuntu-latest - arch: - - x64 + include: + - os: ubuntu-latest + arch: x64 + - os: macos-14 + arch: arm64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 From 41aa1c75d045371e8fc58dc62a24c63a3347d544 Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:11:51 +0200 Subject: [PATCH 3/7] try to fix ci (ubuntu didn't run) --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79217e3a..2b8545a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - os: ubuntu-latest arch: x64 - os: macos-14 - arch: arm64 + arch: aarch64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 @@ -49,7 +49,7 @@ jobs: - os: ubuntu-latest arch: x64 - os: macos-14 - arch: arm64 + arch: aarch64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 @@ -75,7 +75,7 @@ jobs: - os: ubuntu-latest arch: x64 - os: macos-14 - arch: arm64 + arch: aarch64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 From ba709a93e78ba6ea93dfd648995103c68a61f85e Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:14:05 +0200 Subject: [PATCH 4/7] try to fix ci again --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b8545a1..e5760f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,8 @@ jobs: version: - '1' include: - - os: ubuntu-latest - arch: x64 - - os: macos-14 - arch: aarch64 + - {os: ubuntu-latest, arch: x64} + - {os: macos-14, arch: aarch64} steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v2 From 38a2fd87102eaf0d33f0d492156443b0c85c995c Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:20:02 +0200 Subject: [PATCH 5/7] try to finally fix ci --- .github/workflows/ci.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5760f59..e9efa075 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,8 @@ jobs: version: - '1' include: - - {os: ubuntu-latest, arch: x64} - - {os: macos-14, arch: aarch64} + - {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 @@ -41,13 +41,9 @@ jobs: strategy: fail-fast: false matrix: - version: - - '1' include: - - os: ubuntu-latest - arch: x64 - - os: macos-14 - arch: aarch64 + - {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 @@ -67,13 +63,9 @@ jobs: strategy: fail-fast: false matrix: - version: - - '1' include: - - os: ubuntu-latest - arch: x64 - - os: macos-14 - arch: aarch64 + - {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 From 195317985afc00478c5700c96ee6f6ecc5930272 Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:21:01 +0200 Subject: [PATCH 6/7] fixes CI finally --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9efa075..3ad880eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,6 @@ jobs: strategy: fail-fast: false matrix: - version: - - '1' include: - {version: '1', os: ubuntu-latest, arch: x64} - {version: '1', os: macos-14, arch: aarch64} From 00f52f1dcea980879042fe4f070ad26d2f681ded Mon Sep 17 00:00:00 2001 From: Lambert Theisen Date: Wed, 2 Jul 2025 15:46:37 +0200 Subject: [PATCH 7/7] add macos fix (not as performant) --- src/mpi_array.jl | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/mpi_array.jl b/src/mpi_array.jl index 7b3d0d32..9479ac79 100644 --- a/src/mpi_array.jl +++ b/src/mpi_array.jl @@ -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[] @@ -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