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

**URL:** https://discourse.julialang.org/t/warn-not-defined-issue-when-using-callbacks-multithreaded-ensemble-simulations-with-differentialequations-jl/41532
**Category:** General Usage
**Tags:** diffeq
**Created:** [June 16, 2020, 4:20pm UTC](https://discourse.julialang.org/t/warn-not-defined-issue-when-using-callbacks-multithreaded-ensemble-simulations-with-differentialequations-jl/41532 "2020-06-16T16:20:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![luis\_munoz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luis_munoz/32/8146_2.png) [@luis\_munoz](https://discourse.julialang.org/u/luis_munoz)
#### Post date: [June 16, 2020, 4:20pm UTC](https://discourse.julialang.org/t/warn-not-defined-issue-when-using-callbacks-multithreaded-ensemble-simulations-with-differentialequations-jl/41532/1 "2020-06-16T16:20:52Z")

</div>

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 `

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [June 16, 2020, 4:58pm UTC](https://discourse.julialang.org/t/warn-not-defined-issue-when-using-callbacks-multithreaded-ensemble-simulations-with-differentialequations-jl/41532/2 "2020-06-16T16:58:03Z")

</div>

What happens on Julia v1.4?

---

<div class="post-metadata">

### Author: ![luis\_munoz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luis_munoz/32/8146_2.png) [@luis\_munoz](https://discourse.julialang.org/u/luis_munoz)
#### Post date: [June 17, 2020, 7:06am UTC](https://discourse.julialang.org/t/warn-not-defined-issue-when-using-callbacks-multithreaded-ensemble-simulations-with-differentialequations-jl/41532/3 "2020-06-17T07:06:03Z")

</div>

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