Skip to content

Commit

Permalink
MultithreadedForm can cause deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Jun 9, 2023
1 parent 962e2b4 commit 616ef52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RecipesBase = "1.1"
Reexport = "0.2, 1"
ReferenceTests = "0.9"
Requires = "1.1"
RuntimeGeneratedFunctions = "=0.5.9"
RuntimeGeneratedFunctions = "0.5.9"
SciMLBase = "1.8"
Setfield = "0.7, 0.8, 1"
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
Expand Down
5 changes: 2 additions & 3 deletions src/build_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,8 @@ function _build_function(target::JuliaTarget, rhss::AbstractArray, args...;
iip_config = (true, true),
parallel=nothing, cse = false, kwargs...)

if parallel == nothing && _nnz(rhss) >= 1000
parallel = ShardedForm() # by default switch for arrays longer than 1000 exprs
end
# We cannot switch to ShardedForm because it deadlocks with
# RuntimeGeneratedFunctions
dargs = map((x) -> destructure_arg(x[2], !checkbounds,
Symbol("ˍ₋arg$(x[1])")), enumerate([args...]))
i = findfirst(x->x isa DestructuredArgs, dargs)
Expand Down

0 comments on commit 616ef52

Please sign in to comment.