-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
AbstractArray support metaissue #176
Comments
|
|
using GPUArrays, RecursiveArrayTools
u0 = GPUArray(rand(Float32, 32, 32))
v0 = GPUArray(rand(Float32, 32, 32))
uv0 = ArrayPartition(u0,v0)
function f(t,y,dy)
u,v = y.x
du,dv = dy.x
du .= v
dv .= -u
end
tspan = (Float32(0.0),Float32(1.0))
using OrdinaryDiffEq
prob = ODEProblem(f,uv0,tspan)
sol = solve(prob,BS3()) Almost works in GPUArrays except for JuliaGPU/GPUArrays.jl#41 . But that means that sol = solve(prob,BS3(),dt=0.01,adaptive=false) works! Additionally using OrdinaryDiffEq
u0 = GPUArray(rand(Float32, 32, 32))
v0 = GPUArray(rand(Float32, 32, 32))
f1 = function (t,u,v,du)
du .= v
end
f2 = function (t,u,v,dv)
dv .= -u
end
function (::typeof(f2))(::Type{Val{:analytic}}, x, y0)
u0, v0 = y0
ArrayPartition(u0*cos(x) + v0*sin(x), -u0*sin(x) + v0*cos(x))
end
prob = DynamicalODEProblem(f1,f2,u0,v0,(Float32(0.0),Float32(5.0)))
sol = solve(prob,McAte4(),dt=1/10) works. |
Tracking not broadcasting: SciML/OrdinaryDiffEq.jl#106 |
It's all working. No need for the metaissue and we can tackle individual issues. |
I went through to find out what's required for
GPUArray
s to work well in the*DiffEq
packages. Essentially, other than a few GPUArray bugs:JuliaGPU/GPUArrays.jl#20
JuliaGPU/GPUArrays.jl#21
JuliaGPU/GPUArrays.jl#22
The only issues that come up is that
GPUArray
s are anAbstractArray
type which does not have indexing. Incredibly, in the broadcast branches / masters this mostly works, except for one line. However, that would be fixed by the following tiny new feature in Julia's Base:JuliaLang/julia#22216
Then the
*DiffEq
solvers can automatically compile new versions of themselves for the GPU.(I think this is super cool haha)
The text was updated successfully, but these errors were encountered: