using AcceleratedArrays
using BenchmarkTools
n = 1_000_000
xs = rand(1:big(n)^4, n)
a = accelerate(xs, UniqueHashIndex)
b = accelerate(xs, UniqueSortIndex)
ab = accelerate(a, UniqueSortIndex)
ba = accelerate(b, UniqueHashIndex)
@btime 1 in $a;
@btime 1 in $b;
@btime 1 in $ab;
@btime 1 in $ba;
julia> @btime 1 in $a;
129.609 ns (2 allocations: 40 bytes)
julia> @btime 1 in $b;
79.384 ns (0 allocations: 0 bytes)
julia> @btime 1 in $ab;
203.664 ns (0 allocations: 0 bytes)
julia> @btime 1 in $ba;
119.543 ns (2 allocations: 40 bytes)
For an array with multiple accelerators, how does it decide which is the best method for a function?
For an array with multiple accelerators, how does it decide which is the best method for a function?