Skip to content

ErrorException with in-place updating with function wrapper specialization in debugger environments #905

@markowkes

Description

@markowkes

Summary - Running the following code through the debugger in VS Code fails with
Error Exception: `llvmcall` must be compiled to be called

MWE -

using DifferentialEquations

function lorenz!(du,u,p,t)
    du[1] = 10.0*(u[2]-u[1])
    du[2] = u[1]*(28.0-u[3]) - u[2]
    du[3] = u[1]*u[2] - (8/3)*u[3]
end

function lorenz(u,p,t)
    du=similar(u)
    du[1] = 10.0*(u[2]-u[1])
    du[2] = u[1]*(28.0-u[3]) - u[2]
    du[3] = u[1]*u[2] - (8/3)*u[3]
    return du
end
   
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)

# Try using lorenz()
prob = ODEProblem(lorenz,u0,tspan)  # Works
sol = solve(prob)
println("Completed problem 1")

# Try using lorenz!()
prob = ODEProblem(lorenz!,u0,tspan) # Exception
sol = solve(prob)
println("Completed problem 2")

Details - This code solves example 2 from the documentation using both an RHS that allocates lorenz() and another that uses in-place updating lorenz!().

The in-place updating version fails when run with the debugger in VS Code with the following error

Exception has occurred: ErrorException
`llvmcall` must be compiled to be called

Stacktrace:
  [1] assume(v::Bool)
    @ FunctionWrappers ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:10
  [2] do_ccall(f::FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, Float64}}, args::Tuple{Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, Float64})
    @ FunctionWrappers ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:128
  [3] (::FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, Float64}})(args::Tuple{Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, Float64})
    @ FunctionWrappers ~/.julia/packages/FunctionWrappers/8xdVB/src/FunctionWrappers.jl:137

[see attached file for full stacktrace]

error.txt
VerisonInfo.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions