Results of SecondOrderODEProblem give ERROR: This object is not a GPU array

This is a sample code I found on DiffEqGPU.
I can easily get results using Array(sol) for 1st order ODE, but for 2nd order, it returns “ERROR: This object is not a GPU array”

Thanks for the help!!

# -------------------------------

u0 = cu(rand(100))

A = cu(randn(100,100))

f(du,u,p,t) = mul!(du,A,u)

prob = ODEProblem(f,u0,(0.0f0,1.0f0))

sol = solve(prob,Tsit5())

Array(sol)

# -------------------------------

u0 = cu(rand(100))

du0 = cu(rand(100))

A = cu(randn(100,100))

f(ddu,du,u,p,t) = mul!(ddu,A,u)

prob = SecondOrderODEProblem(f,du0,u0,(0.0f0,1.0f0))

sol = solve(prob,Tsit5())

Array(sol)

Seems like there was a missing conversion function. Solved in Fix ArrayPartition CuArray transformation by ChrisRackauckas · Pull Request #209 · SciML/RecursiveArrayTools.jl · GitHub

1 Like

Thank you Chris!!