Summary
We have a long-time problem for binary operations like DotProduct not satisfying the requirements of the Distances.jl framework (not a proper metric). Additionally, Distances.jl is very incompatible with GPU operations (see JuliaStats/Distances.jl#143 and JuliaStats/Distances.jl#137).
Using Tullio.jl should solve both these problems. Some quick benchmarks shows that Tullio is both faster and more GPU-able than Distances.jl
There is a longer discussion about this PR in #380
This should also close #98 and replace #194
Proposed changes
Tullio is used for computing all pairwise and colwise
The only thing used from Distances.jl are their types (we stop using Distances.pairwise).
Adding special implementations of pairwise for ColVecs and RowVecs when possible to improve speed (and GPU compatibility)
Create a AbstractBinaryOp abstract type for objects like DotProduct and Delta and combine them with Distances using BinaryOp = Union{AbstractBinaryOp,Distances.PreMetric}.
What alternatives have you considered?
Dropping Distances.jl operations anyway but without Tullio but Tullio shows it's faster.
Breaking changes
It's technically not breaking since the API does not change, only the internal computations change
Summary We have a long-time problem for binary operations like
DotProduct
not satisfying the requirements of theDistances.jl
framework (not a proper metric). Additionally,Distances.jl
is very incompatible with GPU operations (see JuliaStats/Distances.jl#143 and JuliaStats/Distances.jl#137). UsingTullio.jl
should solve both these problems. Some quick benchmarks shows that Tullio is both faster and more GPU-able than Distances.jlThere is a longer discussion about this PR in #380 This should also close #98 and replace #194
Proposed changes
pairwise
andcolwise
Distances.jl
are their types (we stop usingDistances.pairwise
).pairwise
forColVecs
andRowVecs
when possible to improve speed (and GPU compatibility)AbstractBinaryOp
abstract type for objects likeDotProduct
andDelta
and combine them with Distances usingBinaryOp = Union{AbstractBinaryOp,Distances.PreMetric}
.What alternatives have you considered? Dropping Distances.jl operations anyway but without Tullio but Tullio shows it's faster.
Breaking changes