-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Use Tullio for pairwise distances #385
Conversation
I was checking the docstrings and the one for the `spectral_mixture_kernel` is particularly wrong I think. I double checked with the first reference paper as well as the implementation and changed the formula/description of the arguments
… into tg/correct_doc_spectral_mixture
…ssianProcesses/KernelFunctions.jl into tg/correct_doc_spectral_mixture
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Widmann <[email protected]>
Ah... Ups I think I did not branch from master.... |
|
||
function colwise(::DotProduct, x::ColVecs, y::ColVecs=x) | ||
return @tullio out[i] := x.X[k, i] * y.X[k, i] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
end | |
end |
return map(d, x, y) | ||
end | ||
return @tullio out[i] := d(x[i], y[i]) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
end | |
end |
Blessed be |
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).Using
Tullio.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