SciML / DiffEqProblemLibrary.jl

A library of premade problems for examples and testing differential equation solvers and other SciML scientific machine learning tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incremental compilation may be fatally broken for this module

devmotion opened this issue · comments

I don't know how the current version of DiffEqProblemLibrary should be used in my package. If I run

using TestImports

for the following MWE

module TestImports

using DiffEqProblemLibrary.DDEProblemLibrary

DDEProblemLibrary.importddeproblems()

@show DDEProblemLibrary.prob_dde_constant_1delay_ip

end # module

with DiffEqProblemLibrary as only dependency, I get a lot of

  ** incremental compilation may be fatally broken for this module ** 

warnings, finally resulting in a segfault:

signal (11): Segmentation fault
in expression starting at REPL[3]:1
unknown function (ip: 0x7f6bafeb964f)
jl_deserialize_datatype at /buildworker/worker/package_linux64/build/src/dump.c:1343 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2160
jl_deserialize_value_svec at /buildworker/worker/package_linux64/build/src/dump.c:1479 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2008
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1456
jl_deserialize_value_svec at /buildworker/worker/package_linux64/build/src/dump.c:1479 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2008
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1456
jl_deserialize_value_any at /buildworker/worker/package_linux64/build/src/dump.c:1932 [inlined]
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2163
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:1784
jl_deserialize_value_array at /buildworker/worker/package_linux64/build/src/dump.c:1544
jl_deserialize_value at /buildworker/worker/package_linux64/build/src/dump.c:2029
_jl_restore_incremental at /buildworker/worker/package_linux64/build/src/dump.c:3159
jl_restore_incremental at /buildworker/worker/package_linux64/build/src/dump.c:3218
_include_from_serialized at ./loading.jl:669
_require_from_serialized at ./loading.jl:736
_require at ./loading.jl:1023
require at ./loading.jl:911
require at ./loading.jl:906
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1614 [inlined]
call_require at /buildworker/worker/package_linux64/build/src/toplevel.c:399 [inlined]
eval_import_path at /buildworker/worker/package_linux64/build/src/toplevel.c:436
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:656
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:844
eval at ./boot.jl:330
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2191
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:86
run_backend at /home/david/.julia/packages/Revise/JCJHO/src/Revise.jl:953
#77 at ./task.jl:268
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1614 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:596
unknown function (ip: 0xffffffffffffffff)
Allocations: 12720233 (Pool: 12717515; Big: 2718); GC: 26
zsh: segmentation fault (core dumped)  $HOME/opt/julia-1.2.0/bin/julia

After replacing module DDEProblemLibrary... end with

export importddeproblems
function importddeproblems()
  include(joinpath(@__DIR__, "dde/dde_premade_problems.jl"))
  nothing
end

and wrapping everything in dde_premade_problems.jl inside of a module DDEProblemLibrary + removing the deprecations in that file, and using

module TestImports

using DiffEqProblemLibrary

importddeproblems()

using DiffEqProblemLibrary.DDEProblemLibrary

@show DDEProblemLibrary.prob_dde_constant_1delay_ip

end # module

I can successfully run

julia> using TestImports                                                       
DDEProblemLibrary.prob_dde_constant_1delay_ip = DDEProblem with uType Array{Float64,1} and tType Float64. In-place: true
timespan: (0.0, 10.0)           
u0: [1.0]                                                                                                                           

However, unfortunately that's not a general solution since the same changes do not work for ODEProblemLibrary due to some evaluations of ModelingToolkit.

So I started to believe that the cleanest solution might actually be to break this package up into different packages such as (DiffEq)ODEProblemLibrary, (DiffEq)DDEProblemLibrary, and so on. Then there's no need for any optional evaluations anymore and (hopefully) everything should work as intended. Also, it would probably reduce the amount and interactions of dependencies which might sometimes be an issue, as we saw in the case of HomotopyContinuation in DiffEqBase.