SciML / DiffEqGPU.jl

GPU-acceleration routines for DifferentialEquations.jl and the broader SciML scientific machine learning ecosystem
https://docs.sciml.ai/DiffEqGPU/stable/
MIT License
279 stars 29 forks source link

Complete saveat for GPUTsit5 #179

Closed utkarsh530 closed 1 year ago

utkarsh530 commented 1 year ago

MWE:

using DiffEqGPU, SimpleDiffEq, StaticArrays, CUDA, OrdinaryDiffEq
using Plots

CUDA.allowscalar(false)

function f(u, p, t)
    du1 = -u[1]
    return SVector{1}(du1)
end

u0 = @SVector [10.0f0]
prob = ODEProblem{false}(f, u0, (0.0f0, 10.0f0))
prob_func = (prob, i, repeat) -> remake(prob, p = prob.p)
monteprob = EnsembleProblem(prob, safetycopy = false)

sol = solve(monteprob, GPUTsit5(), EnsembleGPUKernel(), trajectories = 2,
                    adaptive = false, dt = 0.1f-1, abstol = 1.0f-8, reltol = 1.0f-5,saveat = [0.0f0,4.0f0])
julia> sol[1].u
2-element view(::Matrix{SVector{1, Float32}}, :, 1) with eltype SVector{1, Float32}:
 [10.0]
 [0.1831558]

@ChrisRackauckas see the claim that I was talking about.

ChrisRackauckas commented 1 year ago

Looks like there's real test failures?

utkarsh530 commented 1 year ago

Isn't it in the LinearSolve.jl: https://buildkite.com/julialang/diffeqgpu-dot-jl/builds/235#01833d7b-971a-4899-b9a6-89c11ac55f9d/519-860 ?

I can have a look what's going wrong if you want, but the error is not the GPU solvers.

ChrisRackauckas commented 1 year ago

Why is p nothing?

https://github.com/SciML/DiffEqGPU.jl/blob/master/src/DiffEqGPU.jl#L765

Master was passing so this should get figured out.

ChrisRackauckas commented 1 year ago

Seems like a test failure in GPUTsit5 https://buildkite.com/julialang/diffeqgpu-dot-jl/builds/243#018340b0-cd62-4c93-9b7b-3c9ce9e69526/357-861

ChrisRackauckas commented 1 year ago

Run the formatter and this should be good to go.

utkarsh530 commented 1 year ago

Thanks for the help! I see what was the issue. Can you merge it? I'll rebase the master then with #174.