'warn not defined'-issue when using Callbacks & Multithreaded Ensemble Simulations with DifferentialEquations.jl

Hi,

I am trying to use multithreading via EnsembleThreads() within a EnsembleProblem and apply a DiscreteCallback to terminate! the individual simulations under a certain condition. Unfortunately my simulation results in the subsequent error message. I am using julia v1.2.0 and DifferentialEquations.jl v6.8.0. I would appreciate any help with reading the error message and figure out where warn has not been defined appropriately. Thank you.

ERROR: UndefVarError: warn not defined Stacktrace: [1] try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at ./task.jl:517 [2] wait() at ./task.jl:592 [3] wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:104 [4] wait(::Task) at ./task.jl:191 [5] macro expansion at ./threadingconstructs.jl:75 [inlined] [6] solve_batch(::EnsembleProblem{ODEProblem{Array{Float64,3},Tuple{Float64,Float64},true,Tuple{Float64,Int64,Int64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},ODEFunction{true,typeof(f_open!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,SparseMatrixCSC{Float64,Int64},Nothing,Nothing,Nothing,Nothing,Array{Int64,1}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},typeof(prob_func),typeof(output_func),getfield(DiffEqBase, Symbol("##334#340")),Array{Any,1}}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::EnsembleThreads, ::UnitRange{Int64}, ::Int64, ::Pair{Symbol,Any}, ::Vararg{Pair{Symbol,Any},N} where N) at /rds/general/user/lcm16/home/.julia/packages/DiffEqBase/jMOwn/src/ensemble/basic_ensemble_solve.jl:152 [7] macro expansion at /rds/general/user/lcm16/home/.julia/packages/DiffEqBase/jMOwn/src/ensemble/basic_ensemble_solve.jl:91 [inlined] [8] macro expansion at ./util.jl:213 [inlined] [9] #__solve#355(::Int64, ::Int64, ::Int64, ::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:abstol, :reltol, :maxiters, :callback),Tuple{Float64,Float64,Float64,DiscreteCallback{typeof(is_maxTime),typeof(now_terminate!),typeof(DiffEqBase.INITIALIZE_DEFAULT)}}}}, ::typeof(DiffEqBase.__solve), ::EnsembleProblem{ODEProblem{Array{Float64,3},Tuple{Float64,Float64},true,Tuple{Float64,Int64,Int64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},ODEFunction{true,typeof(f_open!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,SparseMatrixCSC{Float64,Int64},Nothing,Nothing,Nothing,Nothing,Array{Int64,1}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},typeof(prob_func),typeof(output_func),getfield(DiffEqBase, Symbol("##334#340")),Array{Any,1}}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::EnsembleThreads) at /rds/general/user/lcm16/home/.julia/packages/DiffEqBase/jMOwn/src/ensemble/basic_ensemble_solve.jl:85 [10] (::getfield(DiffEqBase, Symbol("#kw##__solve")))(::NamedTuple{(:abstol, :reltol, :maxiters, :callback, :trajectories),Tuple{Float64,Float64,Float64,DiscreteCallback{typeof(is_maxTime),typeof(now_terminate!),typeof(DiffEqBase.INITIALIZE_DEFAULT)},Int64}}, ::typeof(DiffEqBase.__solve), ::EnsembleProblem{ODEProblem{Array{Float64,3},Tuple{Float64,Float64},true,Tuple{Float64,Int64,Int64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},ODEFunction{true,typeof(f_open!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,SparseMatrixCSC{Float64,Int64},Nothing,Nothing,Nothing,Nothing,Array{Int64,1}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},typeof(prob_func),typeof(output_func),getfield(DiffEqBase, Symbol("##334#340")),Array{Any,1}}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::EnsembleThreads) at ./none:0 [11] #solve#444 at /rds/general/user/lcm16/home/.julia/packages/DiffEqBase/jMOwn/src/solve.jl:71 [inlined] [12] (::getfield(DiffEqBase, Symbol("#kw##solve")))(::NamedTuple{(:abstol, :reltol, :maxiters, :callback, :trajectories),Tuple{Float64,Float64,Float64,DiscreteCallback{typeof(is_maxTime),typeof(now_terminate!),typeof(DiffEqBase.INITIALIZE_DEFAULT)},Int64}}, ::typeof(solve), ::EnsembleProblem{ODEProblem{Array{Float64,3},Tuple{Float64,Float64},true,Tuple{Float64,Int64,Int64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},ODEFunction{true,typeof(f_open!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,SparseMatrixCSC{Float64,Int64},Nothing,Nothing,Nothing,Nothing,Array{Int64,1}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},typeof(prob_func),typeof(output_func),getfield(DiffEqBase, Symbol("##334#340")),Array{Any,1}}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::EnsembleThreads) at ./none:0 [13] top-level scope at REPL[30]:1

What happens on Julia v1.4?

2 Likes

It works on Julia v1.4. Thanks a lot!