JeffreySarnoff / RollingFunctions.jl

Roll a window over data; apply a function over the window.
MIT License
114 stars 6 forks source link

Compatibility with CUDA ? #17

Closed HenriDeh closed 1 year ago

HenriDeh commented 3 years ago

Currently rolling functions return an array on the cpu no matter the type of the input array. This means that the result must be moved back to the gpu after using it, which is a slow operation.

I guess this must be possible since the base diff function (equivalent to rolling(-,a,2)) supports CuArrays. But this may require good knowledge of CUDA.jl.

julia> using CUDA, RollingFunctions

julia> rolling(sum, cu(rand(10)), 2)
9-element Array{Float32,1}:
 1.5295954
 0.7749236
 1.0564828
 1.523129
 1.328017
 1.4198613
 1.3945057
 0.8062186
 0.24077797
JeffreySarnoff commented 3 years ago

Fair point. I don't have that knowledge of CUDA.jl yet.

JeffreySarnoff commented 1 year ago

PR is welcome