Skip to content
Merged
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
16 changes: 16 additions & 0 deletions ext/RecursiveArrayToolsKernelAbstractions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module RecursiveArrayToolsKernelAbstractions

import RecursiveArrayTools: VectorOfArray
import KernelAbstractions


function KernelAbstractions.get_backend(x::VectorOfArray)
u = parent(x)
if length(u) == 0
error("VectorOfArray is empty, cannot determine backend.")
end
# Use the backend of the first element in the parent array
return KernelAbstractions.get_backend(u[1])
end

end
1 change: 1 addition & 0 deletions test/gpu/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"

[compat]
CUDA = "3.12, 4, 5"
6 changes: 5 additions & 1 deletion test/gpu/vectorofarray_gpu.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
using RecursiveArrayTools, CUDA, Test, Zygote, Adapt
using RecursiveArrayTools, CUDA, Test, Zygote, Adapt, KernelAbstractions
CUDA.allowscalar(false)

# Test indexing with colon
x = zeros(5)
y = VectorOfArray([x, x, x])
y[:, :]

KernelAbstractions.get_backend(y) isa KernelAbstractions.CPU

x = CUDA.zeros(5)
y = VectorOfArray([x, x, x])
y[:, :]

KernelAbstractions.get_backend(y) isa CUDA.CUDABackend

# Test indexing with boolean masks and colon
nx, ny, nt = 3, 4, 5
x = CUDA.rand(nx, ny, nt)
Expand Down
Loading