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
6 changes: 5 additions & 1 deletion src/vector_of_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ end
Base.convert(::Type{AbstractArray}, VA::AbstractVectorOfArray) = stack(VA.u)

function Adapt.adapt_structure(to, VA::AbstractVectorOfArray)
Adapt.adapt(to, Array(VA))
VectorOfArray(Adapt.adapt.(to, VA.u))
end

function Adapt.adapt_structure(to, VA::AbstractDiffEqArray)
DiffEqArray(Adapt.adapt.(to, VA.u), Adapt.adapt(to, VA.t))
end

function VectorOfArray(vec::AbstractVector{T}, ::NTuple{N}) where {T, N}
Expand Down
4 changes: 0 additions & 4 deletions test/gpu.jl

This file was deleted.

4 changes: 4 additions & 0 deletions test/gpu/arraypartition_gpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ RecursiveArrayTools.recursivefill!(pA, true)
# Test that regular filling is done using GPU kernels and not scalar indexing
fill!(pA, false)
@test all(pA .== false)

a = ArrayPartition(([1.0f0] |> cu, [2.0f0] |> cu, [3.0f0] |> cu))
b = ArrayPartition(([0.0f0] |> cu, [0.0f0] |> cu, [0.0f0] |> cu))
@. a + b
13 changes: 12 additions & 1 deletion test/gpu/vectorofarray_gpu.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using RecursiveArrayTools, CUDA, Test, Zygote
using RecursiveArrayTools, CUDA, Test, Zygote, Adapt
CUDA.allowscalar(false)

# Test indexing with colon
Expand Down Expand Up @@ -37,3 +37,14 @@ va_cu = convert(AbstractArray, va)

@test va_cu isa CuArray
@test size(va_cu) == size(x)

a = VectorOfArray([ones(2) for i in 1:3])
_a = Adapt.adapt(CuArray,a)
@test _a isa VectorOfArray
@test _a.u isa Vector{<:CuArray}

b = DiffEqArray([ones(2) for i in 1:3],ones(2))
_b = Adapt.adapt(CuArray,b)
@test _b isa DiffEqArray
@test _b.u isa Vector{<:CuArray}
@test _b.t isa CuArray
Loading