JuliaGPU / GPUArrays.jl

Reusable array functionality for Julia's various GPU backends.
MIT License
316 stars 77 forks source link

Logical indexing, filter, findall #178

Closed andyferris closed 5 years ago

andyferris commented 5 years ago

I'm sure this is a well-known issue, but I didn't find a ticket.

Now that TypedTables is reaching a certain level of maturity, I've been toying with idea of relational algebra on the GPU.

The first primitives that may be needed are the logical indexing/filter/findall family of functions. We currently get:

julia> t = Table(a=cu(rand(10000)), b=cu(rand(10000)))
Table with 2 columns and 10000 rows:
      a            b
    ┌────────────────────────
 1  │ 0.80206746   0.3335804
 2  │ 0.1742395    0.5159153
...

julia> filter(r->r.a > 0.5, t)
ERROR: Logical indexing not implemented
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] to_index(::CuArray{Float32,1}, ::Base.LogicalIndex{Int64,Array{Bool,1}}) at /home/chris/.julia/packages/GPUArrays/hzyWn/src/indexing.jl:67
...

I note there seems to be literature on this subject, and with a multi-stage algorithm it should be possible to implement these efficiently. I haven't used CUDA in anger in a decade... so not sure that I could be helpful, but it would be a nice feature in any case. I'm not sure if anyone worked on this Summer of Code Idea?

maleadt commented 5 years ago

We now have an initial implementation for CuArrays thanks to @dpsanders: https://github.com/JuliaGPU/CuArrays.jl/pull/290 Since CuArrays is the only working implementation of GPUArrays, I guess we can close this?