SciML / SciML/DiffEqGPU.jl

EnsembleGPUArray() incompatibility with SecondOrderODEProblem()

Open
#271 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
327
Forks
42
Avg merge
14h 13m
Merged PRs (30d)
34

Description

Hi, I attempted to solve a second-order differential equation using a Julia library. However, I encountered an issue with the EnsembleGPUArray function, as the generated ensemble is not working as expected. Below, you can find the code that I used:

using DifferentialEquations, DataFrames, CSV, DelimitedFiles, RecursiveArrayTools, DiffEqGPU, CUDA

function lorenz_ddu(ddu, du, u, p, t)
    ddu[1] = p[1]*(du[2]-u[1])
    ddu[2] = u[1]*(p[2]-u[3]) - u[2]
    ddu[3] = u[1]*u[2] - p[3]*u[3]
end

function ensembleOutputExtracter(simulationResult, numTrajectories)
    for j = 1:min(numTrajectories, length(simulationResult))
        solnew = vcat(j, simulationResult[j].t', simulationResult[:, :, j])
        open("shahab.txt", "a+") do file
            writedlm(file, solnew', ',')
        end
    end
end

CUDA.set_runtime_version!("local")

u0 = [1.0, 1.0, 1.0]
du0 = [1.1, 1.2, 1.3]
tspan = (0.0, 100.0)
p = [10.0, 28.0, 8/3]
prob = SecondOrderODEProblem(lorenz_ddu, du0, u0, tspan, p)
prob_func = (prob, i, repeat) -> remake(prob, u0=rand(3).*u0, p=rand(3).*p)
monteprob = EnsembleProblem(prob, prob_func=prob_func, safetycopy=false)
sol = solve(monteprob, Tsit5(), EnsembleGPUArray(CUDA.CUDABackend(), 0.0), save_everystep=false, trajectories=10, saveat=1.0f0)
ensembleOutputExtracter(sol, 10)

Am I missing something?
Thanks,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided SecondOrderODEProblem and EnsembleGPUArray reproducer with the listed Julia packages and CUDA configuration. Trace the failure from the ensemble solve and compare the behavior with the supported problem types; the issue is done when the incompatibility is resolved or its supported behavior is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.