"no method matching" error when running DiffEqGPU example from docs

When I run the following example code from the DiffEqGPU documentation,

using DiffEqGPU, OrdinaryDiffEq, StaticArrays, CUDA

function lorenz(u, p, t)
    σ = p[1]
    ρ = p[2]
    β = p[3]
    du1 = σ * (u[2] - u[1])
    du2 = u[1] * (ρ - u[3]) - u[2]
    du3 = u[1] * u[2] - β * u[3]
    return SVector{3}(du1, du2, du3)
end

u0 = @SVector [1.0f0; 0.0f0; 0.0f0]
tspan = (0.0f0, 10.0f0)
p = @SVector [10.0f0, 28.0f0, 8 / 3.0f0]
prob = ODEProblem{false}(lorenz, u0, tspan, p)
prob_func = (prob, i, repeat) -> remake(prob, p = (@SVector rand(Float32, 3)) .* p)
monteprob = EnsembleProblem(prob, prob_func = prob_func, safetycopy = false)

sol = solve(monteprob, GPUTsit5(), EnsembleGPUKernel(CUDA.CUDABackend()),
    trajectories = 10_000)

I get the following error:

ERROR: MethodError: no method matching (::var"#497#498")(::ODEProblem{…}, ::EnsembleContext{…})
The function `#497` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  (::var"#497#498")(::Any, ::Any, ::Any)

I’ve run the code several times, and the numbers in the “no method matching” error seem to increase incrementally each time (so when I ran it again, it read no method matching (::var"#499#500")(::ODEProblem{…}, ::EnsembleContext{…}) instead of no method matching (::var"#497#498")(::ODEProblem{…}, ::EnsembleContext{…}).)

The other example on the “getting started” page runs just fine. (For context, I’ve included it below)

using OrdinaryDiffEq, CUDA, LinearAlgebra
u0 = cu(rand(1000))
A = cu(randn(1000, 1000))
f(du, u, p, t) = mul!(du, A, u)
prob = ODEProblem(f, u0, (0.0f0, 1.0f0)) # Float32 is better on GPUs!
sol = solve(prob, Tsit5())

I’m running Julia 1.11.1 on a Windows 11 laptop. Here’s the CUDA information:

CUDA toolchain: 
- runtime 13.3.0, artifact installation
- driver 610.62.0 for 13.3
- compiler 13.3.33, artifact installation

CUDA libraries: 
- cuBLAS: 13.6.0
- cuSPARSE: 12.8.2
- cuSOLVER: 12.2.6
- cuFFT: 12.3.0
- cuRAND: 10.4.3
- CUPTI: 2026.2.1 (API 13.3.1)
- NVML: 13.0.0+610.62

Julia packages: 
- CUDACore: 6.2.1
- GPUArrays: 11.5.8
- GPUCompiler: 1.23.0
- KernelAbstractions: 0.9.42
- CUDA_Driver_jll: 13.3.0+1
- CUDA_Compiler_jll: 0.4.4+1
- CUDA_Runtime_jll: 0.23.0+1
- NVPTX_LLVM_Backend_jll: 22.1.7+1

Toolchain:
- Julia: 1.11.1
- LLVM: 16.0.6

1 device:
  0: NVIDIA GeForce RTX 3070 Ti Laptop GPU (sm_86, 7.379 GiB / 8.000 GiB available)
     compiles to sm_86 / PTX 9.3 (LLVM: sm_86 / PTX 9.0)

What’s causing this error?

A small update: this doesn’t seem to be originating with DiffEqGPU, but rather from how DifferentialEquations package handles multi-threading. I get the same error if I tell the code to solve on the CPU instead of the GPU, i.e. if I change the last line to

sol = solve(monteprob, Tsit5(), EnsembleThreads(), trajectories = 10_000);

Here’s the full error with the stacktrace included:

ERROR: MethodError: no method matching (::var"#11#12")(::ODEProblem{…}, ::SciMLBase.EnsembleContext{…})
The function `#11` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  (::var"#11#12")(::Any, ::Any, ::Any)
   @ Main c:\Users\court\OneDrive - University of New Brunswick\Documents\Post-Doc\Models\AdvectionDiffusionPatterns\src\testGPUArray.jl:17

Stacktrace:
  [1] batch_func(i::Int64, prob::EnsembleProblem{…}, alg::Tsit5{…}, ensemble_rng_state::@NamedTuple{…}, thread_prob::Nothing; worker_id::Int64, kwargs::@Kwargs{…})
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:449
  [2] (::SciMLBase.var"#769#770"{Int64, @Kwargs{…}, EnsembleProblem{…}, Tsit5{…}, @NamedTuple{…}})(i::Int64)
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:546
  [3] responsible_map
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:536 [inlined]
  [4] #solve_batch#768
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:545 [inlined]
  [5] solve_batch
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:541 [inlined]
  [6] #solve_batch#771
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:560 [inlined]
  [7] solve_batch
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:554 [inlined]
  [8] macro expansion
    @ .\timing.jl:421 [inlined]
  [9] (::SciMLBase.var"#755#756"{…})()
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:366
 [10] with_logstate(f::SciMLBase.var"#755#756"{…}, logstate::Base.CoreLogging.LogState)
    @ Base.CoreLogging .\logging\logging.jl:522
 [11] with_logger(f::Function, logger::SciMLBase.AggregateLogger{VSCodeServer.VSCodeLogger})
    @ Base.CoreLogging .\logging\logging.jl:632
 [12] #_solve_ensemble_impl#754
    @ C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:348 [inlined]
 [13] _dispatch_ensemble_solve(_is_rng_solver::Bool, _is_jump_prob::Bool, prob::EnsembleProblem{…}, alg::Tsit5{…}, ensemblealg::EnsembleThreads, sim_seeds::Nothing, rng_func::typeof(SciMLBase.default_rng_func), rng::Nothing, logger::SciMLBase.AggregateLogger{…}; kwargs::@Kwargs{…})
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:329
 [14] __solve(prob::EnsembleProblem{…}, alg::Tsit5{…}, ensemblealg::EnsembleThreads; trajectories::Int64, batch_size::Int64, progress_aggregate::Bool, pmap_batch_size::Int64, seed::Nothing, rng::Nothing, rng_func::Function, kwargs::@Kwargs{…})
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:314
 [15] solve(::EnsembleProblem{…}, ::Tsit5{…}, ::Vararg{…}; kwargs::@Kwargs{…})
    @ SciMLBase C:\Users\court\.julia\packages\SciMLBase\jqoB3\src\ensemble\basic_ensemble_solve.jl:642
 [16] top-level scope
    @ c:\Users\court\OneDrive - University of New Brunswick\Documents\Post-Doc\Models\AdvectionDiffusionPatterns\src\testGPUArray.jl:18
Some type information was truncated. Use `show(err)` to see complete types.

All of my packages are up to date, so that’s not the issue. If anyone has any idea what’s going on, please let me know!

prob_func = (prob, ctx) -> remake(prob, p = (*@SVector* rand(Float32, 3)) .\* p)

on SciMLBase v3. The docs rebuild needs to happen sorry.

Solved! Thanks