Skip to content

Use GPUArrays accumulation implementation #2813

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ steps:
println("--- :julia: Instantiating project")
Pkg.develop([PackageSpec(path=pwd())])
Pkg.add(url="https://github.com/christiangnrd/GPUArrays.jl", rev="accumulatetests")
println("+++ :julia: Benchmarking")
include("perf/runbenchmarks.jl")'
Expand Down
4 changes: 4 additions & 0 deletions perf/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ end

let group = addgroup!(group, "reverse")
group["1d"] = @async_benchmarkable reverse($gpu_vec)
group["1dL"] = @async_benchmarkable reverse($gpu_vec_long)
group["2d"] = @async_benchmarkable reverse($gpu_mat; dims=1)
group["2dL"] = @async_benchmarkable reverse($gpu_mat_long; dims=1)
group["1d_inplace"] = @async_benchmarkable reverse!($gpu_vec)
group["1dL_inplace"] = @async_benchmarkable reverse!($gpu_vec_long)
group["2d_inplace"] = @async_benchmarkable reverse!($gpu_mat; dims=1)
group["2dL_inplace"] = @async_benchmarkable reverse!($gpu_mat_long; dims=2)
end

group["broadcast"] = @async_benchmarkable $gpu_mat .= 0f0
Expand Down
1 change: 0 additions & 1 deletion src/CUDA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ include("texture.jl")
include("indexing.jl")
include("broadcast.jl")
include("mapreduce.jl")
include("accumulate.jl")
include("reverse.jl")
include("iterator.jl")
include("sorting.jl")
Expand Down
234 changes: 0 additions & 234 deletions src/accumulate.jl

This file was deleted.

33 changes: 0 additions & 33 deletions test/base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,39 +413,6 @@ end
@test view(b, :, 1, :) isa StridedCuArray
end

@testset "accumulate" begin
for n in (0, 1, 2, 3, 10, 10_000, 16384, 16384+1) # small, large, odd & even, pow2 and not
@test testf(x->accumulate(+, x), rand(n))
@test testf(x->accumulate(+, x), rand(n,2))
@test testf((x,y)->accumulate(+, x; init=y), rand(n), rand())
end

# multidimensional
for (sizes, dims) in ((2,) => 2,
(3,4,5) => 2,
(1, 70, 50, 20) => 3)
@test testf(x->accumulate(+, x; dims=dims), rand(Int, sizes))
@test testf(x->accumulate(+, x), rand(Int, sizes))
end

# using initializer
for (sizes, dims) in ((2,) => 2,
(3,4,5) => 2,
(1, 70, 50, 20) => 3)
@test testf((x,y)->accumulate(+, x; dims=dims, init=y), rand(Int, sizes), rand(Int))
@test testf((x,y)->accumulate(+, x; init=y), rand(Int, sizes), rand(Int))
end

# in place
@test testf(x->(accumulate!(+, x, copy(x)); x), rand(2))

# specialized
@test testf(cumsum, rand(2))
@test testf(cumprod, rand(2))

@test_throws ArgumentError("accumulate does not support the keyword arguments [:bad_kwarg]") accumulate(+, CUDA.rand(1024); bad_kwarg="bad")
end

@testset "logical indexing" begin
@test CuArray{Int}(undef, 2)[CUDA.ones(Bool, 2)] isa CuArray
@test CuArray{Int}(undef, 2, 2)[CUDA.ones(Bool, 2, 2)] isa CuArray
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import REPL
using Printf: @sprintf
using Base.Filesystem: path_separator

using Pkg
Pkg.add(url="https://github.com/christiangnrd/GPUArrays.jl", rev="accumulatetests")

# parse some command-line arguments
function extract_flag!(args, flag, default=nothing; typ=typeof(default))
for f in args
Expand Down