JuliaGPU/CUDA.jl

missing kernel for Base.unique

Open

#991 opened on Jun 17, 2021

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Julia (274 forks)batch import
enhancementgood first issue

Repository metrics

Stars
 (1,408 stars)
PR merge metrics
 (Avg merge 5d 5h) (16 merged PRs in 30d)

Description

julia> using CUDA

julia> x=cu([1,2,4,4]);

julia> CUDA.allowscalar(false)

julia> unique(x)
ERROR: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] assertscalar(op::String)
    @ GPUArrays ~/.julia/packages/GPUArrays/ymNij/src/host/indexing.jl:51
  [3] getindex
    @ ~/.julia/packages/GPUArrays/ymNij/src/host/indexing.jl:84 [inlined]
  [4] iterate
    @ ./abstractarray.jl:1096 [inlined]
  [5] iterate
    @ ./abstractarray.jl:1094 [inlined]
  [6] unique(itr::CuArray{Int64, 1})
    @ Base ./set.jl:127
  [7] _unique_dims
    @ ./multidimensional.jl:1587 [inlined]
  [8] #unique#484
    @ ./multidimensional.jl:1585 [inlined]
  [9] unique(A::CuArray{Int64, 1})
    @ Base ./multidimensional.jl:1585
 [10] top-level scope
    @ REPL[13]:1
 [11] top-level scope
    @ ~/.julia/packages/CUDA/mVgLI/src/initialization.jl:52

Contributor guide