Skip to content

Commit a6d5556

Browse files
authored
Merge pull request #212 from lamBOOO/main-0.3
Use standard reduce ops for distances also for version 0.3.x
2 parents 25ed3ef + 3b698c3 commit a6d5556

File tree

5 files changed

+42
-19
lines changed

5 files changed

+42
-19
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
version:
13-
- '1.6'
14-
- '1' # Latest 1.X
15-
os:
16-
- ubuntu-latest
17-
arch:
18-
- x64
12+
include:
13+
- {version: '1', os: ubuntu-latest, arch: x64}
14+
- {version: '1.6', os: ubuntu-latest, arch: x64}
15+
- {version: '1', os: macos-14, arch: aarch64}
1916
steps:
2017
- uses: actions/checkout@v2
2118
- uses: julia-actions/setup-julia@v1

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.5] - 2025-07-31
9+
10+
### Fixed
11+
12+
- Bugfix: Use standard operations for reduce to be compatible with aarch64 architecture (see https://github.com/PartitionedArrays/PartitionedArrays.jl/pull/209)
13+
814
## [0.3.4] - 2023-09-06
915

1016
### Added

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PartitionedArrays"
22
uuid = "5a9dfac6-5c52-46f7-8278-5e2210713be9"
33
authors = ["Francesc Verdugo <f.verdugo.rojano@vu.nl> and contributors"]
4-
version = "0.3.4"
4+
version = "0.3.5"
55

66
[deps]
77
CircularArrays = "7a955b69-7140-5f4e-a0ed-f168c5e2e749"

src/p_vector.jl

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11

22
function local_values end
33

4+
function reduce_for_distance(d, partials, init)
5+
reduce((i, j) -> Distances.eval_reduce(d, i, j), partials; init)
6+
end
7+
8+
reduce_for_distance(::Distances.Chebyshev, partials, init) =
9+
reduce(max, partials; init)
10+
11+
for T in (Distances.Euclidean,
12+
Distances.SqEuclidean,
13+
Distances.PeriodicEuclidean,
14+
Distances.Cityblock,
15+
Distances.TotalVariation,
16+
Distances.Minkowski,
17+
Distances.Hamming,
18+
Distances.ChiSqDist,
19+
Distances.KLDivergence,
20+
Distances.GenKLDivergence)
21+
# all Distances.metrics except Jaccard, RogersTanimoto, CosineDist,
22+
# RenyiDivergence, BrayCurtis, SpanNormDist, since these either operate with
23+
# tuples or have a complex reduction logic.
24+
@eval reduce_for_distance(::$(T), partials, init) =
25+
reduce(+, partials; init)
26+
end
27+
428
function own_values end
529

630
function ghost_values end
@@ -834,9 +858,8 @@ for M in Distances.metrics
834858
return s
835859
end
836860
end
837-
s = reduce((i,j)->Distances.eval_reduce(d,i,j),
838-
partials,
839-
init=Distances.eval_start(d, a, b))
861+
init_val = Distances.eval_start(d, a, b)
862+
s = reduce_for_distance(d, partials, init_val)
840863
Distances.eval_end(d,s)
841864
end
842865
end

src/primitives.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -601,14 +601,11 @@ function ExchangeGraph_impl_with_neighbors(snd_ids,neighbors::ExchangeGraph)
601601
is_included_all=map(snd_ids_a, snd_ids_b) do snd_ids_a, snd_ids_b
602602
all(i->i in snd_ids_b,snd_ids_a)
603603
end
604-
result=false
605-
and(a,b)=a && b
606-
is_included_all=reduction(and,is_included_all,destination=:all,init=one(eltype(is_included_all)))
607-
map(is_included_all) do is_included_all
608-
result = is_included_all
609-
end
610-
result
611-
end
604+
# perform a global AND using built-in & operator (static MPI-op)
605+
is_included_all = reduction(&, is_included_all; destination=:all, init=one(eltype(is_included_all)))
606+
# extract the single boolean result
607+
collect(is_included_all)[1]
608+
end
612609
@boundscheck is_included(snd_ids,neighbors.snd) || error("snd_ids must be a subset of neighbors.snd")
613610
rank = linear_indices(snd_ids)
614611
# Tell the neighbors whether I want to send to them

0 commit comments

Comments
 (0)