-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModelingToolkit extension completely freezing Julia #360
Comments
Many thanks for reporting ! I am looking into this |
I just tried with Julia 1.10.0 and was not able to reproduce the problem: both versions ( Environment:
|
Two observations so far:
|
It seems like it is hanging due to some kind of type inference. Cutting the compiler shows that the compiler is hanging in
The timings before I cut it are here:
|
Many thanks ! I will look closer into this function |
Could be related : #362 |
We are now seeing it crashing / hanging CI when just loading the extension on 1.11: https://github.com/SciML/Catalyst.jl/actions/runs/11239742228/job/31248152175?pr=1053#step:6:1197 |
CI crash on 1.11 seems to be a bug in Julia from JuliaLang/julia#56040. The freeze from the current issue seems to be of different nature: it manifests in 1.10.5 and the offending commit from JuliaLang/julia#56040 is not present in 1.10.5. @pogudingleb How do we debug the freeze in the current issue? The functions |
Very elusive behaviour. Even if I take out the original code from the function: using ModelingToolkit
using StructuralIdentifiability
const SI = StructuralIdentifiability
t = ModelingToolkit.t_nounits
D = ModelingToolkit.D_nounits
@variables X(t)
@parameters p d
eqs = [
D(X) ~ p - d*X
]
@mtkbuild osys = ODESystem(eqs, t)
measured_quantities = [X]
funcs_to_check = [osys.p]
SI.assess_identifiability(osys; measured_quantities, funcs_to_check) It also works fine ! But being enclosed in a function, it hangs... |
Hi, is there any update on this? Is it fixed on 1.10.6 and 1.11.2 (I know the latter isn't released yet, but given it should be soon that would close this issue I think)? |
(I'm just trying to figure out if we can reenable the Catalyst SI extension for our next release or will have to keep it disabled.) |
Sorry, I was busy recently and the bug is tricky so the several hours I could spend were not enough to understand the problem. I will double check that it works on 1.10.6 and 1.11.2 and, if yes, close the issue. It seems that the SI code is completely legal and was not precompiling correctly for some extraterrestrial reason. |
Nope, it hangs as well on 1.10.6. |
Ah, darn. Thanks for checking! |
FWIW, I just checked and we are still seeing this issue on 1.11.2 also, so it isn't just a 1.10 issue. |
@isaacsas Thanks for checking! |
That is really great to hear, and yes, hopefully it is backported! Even if it just gets into 11.3 we could add the SI extension back into Catalyst. We just need the ability to run our CI tests on the latest Julia version so we know there aren't any bugs on our end. |
I have just checked the pre-release version of 1.10.8 and 1.11.3. On 1.11.3 everything works but still freezes in 1.10.8. I have created an issue |
Awesome to hear! Would be great to have the extension back and working for when we release Catalyst v15 |
Confirming: everything works on the (just released) 1.11.3 |
Amazing to hear this is completed. |
The Catalyst tests are still stalling, but given that this works now hopefully it is something I can figure out soon! |
Are you testing on 1.10.8 or 1.11.3? In the former, the problem persists. |
Ok, the test here works on v1.11.3. However, loading Catalyst causes it to fail. Very weird. Example: This works: julia> VERSION
v"1.11.3"
(Environment - Temporary) pkg> st
Status `~/Desktop/Julia Playground/Environment - Temporary/Project.toml`
[479239e8] Catalyst v14.4.1 `~/.julia/dev/Catalyst`
⌃ [961ee093] ModelingToolkit v9.59.0
[220ca800] StructuralIdentifiability v0.5.12
[56ddb016] Logging v1.11.0
Info Packages marked with ⌃ have new versions available and may be upgradable.
julia> using ModelingToolkit
julia> using StructuralIdentifiability
julia> const SI = StructuralIdentifiability
StructuralIdentifiability
julia> function testSI_MTK()
t = ModelingToolkit.t_nounits
D = ModelingToolkit.D_nounits
@variables X(t)
@parameters p d
eqs = [
D(X) ~ p - d*X
]
@mtkbuild osys = ODESystem(eqs, t)
measured_quantities = [X]
funcs_to_check = [osys.p]
SI.assess_identifiability(osys; measured_quantities, funcs_to_check)
end
testSI_MTK (generic function with 1 method)
julia> testSI_MTK()
┌ Info: System parsed into X' = -X*d + p
└ y1 = X
[ Info: Assessing local identifiability
[ Info: Assessing global identifiability
[ Info: Computing IO-equations
[ Info: Computed IO-equations in 4.007655171 seconds
[ Info: Computing Wronskians
[ Info: Computed Wronskians in 1.668636723 seconds
[ Info: Dimensions of the Wronskians [3]
[ Info: Ranks of the Wronskians computed in 0.018164206 seconds
[ Info: Global identifiability assessed in 10.423182398 seconds
OrderedCollections.OrderedDict{Num, Symbol} with 1 entry:
p => :globally
julia> testSI_MTK()
┌ Info: System parsed into X' = -X*d + p
└ y1 = X
[ Info: Assessing local identifiability
[ Info: Assessing global identifiability
[ Info: Computing IO-equations
[ Info: Computed IO-equations in 0.000720843 seconds
[ Info: Computing Wronskians
[ Info: Computed Wronskians in 0.000506108 seconds
[ Info: Dimensions of the Wronskians [3]
[ Info: Ranks of the Wronskians computed in 8.602e-6 seconds
[ Info: Global identifiability assessed in 0.007127755 seconds
OrderedCollections.OrderedDict{Num, Symbol} with 1 entry:
p => :globally However, inserting a julia> VERSION
v"1.11.3"
(Environment - Temporary) pkg> st
Status `~/Desktop/Julia Playground/Environment - Temporary/Project.toml`
[479239e8] Catalyst v14.4.1 `~/.julia/dev/Catalyst`
⌃ [961ee093] ModelingToolkit v9.59.0
[220ca800] StructuralIdentifiability v0.5.12
[56ddb016] Logging v1.11.0
Info Packages marked with ⌃ have new versions available and may be upgradable.
julia> using ModelingToolkit
julia> using StructuralIdentifiability
julia> const SI = StructuralIdentifiability
StructuralIdentifiability
julia> function testSI_MTK()
t = ModelingToolkit.t_nounits
D = ModelingToolkit.D_nounits
@variables X(t)
@parameters p d
eqs = [
D(X) ~ p - d*X
]
@mtkbuild osys = ODESystem(eqs, t)
measured_quantities = [X]
funcs_to_check = [osys.p]
SI.assess_identifiability(osys; measured_quantities, funcs_to_check)
end
testSI_MTK (generic function with 1 method)
julia> testSI_MTK()
┌ Info: System parsed into X' = -X*d + p
└ y1 = X
[ Info: Assessing local identifiability
[ Info: Assessing global identifiability
[ Info: Computing IO-equations
[ Info: Computed IO-equations in 5.023534383 seconds
[ Info: Computing Wronskians
[ Info: Computed Wronskians in 1.786881821 seconds
[ Info: Dimensions of the Wronskians [3]
[ Info: Ranks of the Wronskians computed in 0.021605133 seconds
[ Info: Global identifiability assessed in 12.305836099 seconds
OrderedCollections.OrderedDict{Num, Symbol} with 1 entry:
p => :globally
julia> using Catalyst
julia> testSI_MTK() Here it just stalls. Finally, if I comment out the Catalyst Structural Identifiability extension it starts working fine again. Looking further into it. Just removing the CatalystStructuralIdentifiabilityExtension's overload to |
Some further comment, just on how odd everything is. This is the current CatalystStructuralIdentifiabilityExtension's function SI.assess_identifiability(rs::ReactionSystem, args...;
measured_quantities = [], known_p = [], funcs_to_check = Vector(),
remove_conserved = true, ignore_no_measured_warn = false, kwargs...)
# Creates a ODESystem, list of measured quantities, and functions to check, of SI's preferred form.
osys, conseqs, consconsts, vars = make_osys(rs; remove_conserved)
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p,
conseqs; ignore_no_measured_warn)
funcs_to_check = make_ftc(funcs_to_check, conseqs, vars)
# Computes identifiability and converts it to a easy to read form.
out = SI.assess_identifiability(osys, args...; measured_quantities,
funcs_to_check, kwargs...)
return make_output(out, funcs_to_check, consconsts)
end using It, everything stalls. Removing the last bit where we call function SI.assess_identifiability(rs::ReactionSystem, args...;
measured_quantities = [], known_p = [], funcs_to_check = Vector(),
remove_conserved = true, ignore_no_measured_warn = false, kwargs...)
# Creates a ODESystem, list of measured quantities, and functions to check, of SI's preferred form.
osys, conseqs, consconsts, vars = make_osys(rs; remove_conserved)
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p,
conseqs; ignore_no_measured_warn)
funcs_to_check = make_ftc(funcs_to_check, conseqs, vars)
# Computes identifiability and converts it to a easy to read form.
#out = SI.assess_identifiability(osys, args...; measured_quantities,
# funcs_to_check, kwargs...)
return 1
end |
Actually, adding these errors messages prevents the stalling (but no errors are thrown): function SI.assess_identifiability(rs::ReactionSystem, args...;
measured_quantities = [], known_p = [], funcs_to_check = Vector(),
remove_conserved = true, ignore_no_measured_warn = false, kwargs...)
# Creates a ODESystem, list of measured quantities, and functions to check, of SI's preferred form.
osys, conseqs, consconsts, vars = make_osys(rs; remove_conserved)
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p,
conseqs; ignore_no_measured_warn)
funcs_to_check = make_ftc(funcs_to_check, conseqs, vars)
# Computes identifiability and converts it to a easy to read form.
error("We should not be here")
out = SI.assess_identifiability(osys, args...; measured_quantities,
funcs_to_check, kwargs...)
error("Nor should we be should not be here")
return make_output(out, funcs_to_check, consconsts)
end Sorry for the mess, will continue looking through this, and get back here if I have something useful. |
What still seems to be happening is that the code seems to run until the end, but refuses to actually return anything. Running the above workflow, but adding some code into the SI println("Here 1")
out = OrderedDict(nemo2mtk[param] => result[param] for param in funcs_to_check_)
println("Here 2")
return out
println("Here 3") Here, we reach the second print statement and then returns the output. In the second case there is not any printed output until I forde an exit through ctrl+c, at which point int time we actually get everything printed out as normal: julia> using ModelingToolkit
julia> using StructuralIdentifiability
Precompiling ModelingToolkitSIExt...
1 dependency successfully precompiled in 30 seconds. 319 already precompiled.
julia> const SI = StructuralIdentifiability
StructuralIdentifiability
julia> function testSI_MTK()
t = ModelingToolkit.t_nounits
D = ModelingToolkit.D_nounits
@variables X(t)
@parameters p d
eqs = [
D(X) ~ p - d*X
]
@mtkbuild osys = ODESystem(eqs, t)
measured_quantities = [X]
funcs_to_check = [osys.p]
SI.assess_identifiability(osys; measured_quantities, funcs_to_check)
end
testSI_MTK (generic function with 1 method)
julia> testSI_MTK()
┌ Info: System parsed into X' = -X*d + p
└ y1 = X
[ Info: Assessing local identifiability
[ Info: Assessing global identifiability
[ Info: Computing IO-equations
[ Info: Computed IO-equations in 4.795254909 seconds
[ Info: Computing Wronskians
[ Info: Computed Wronskians in 1.724396875 seconds
[ Info: Dimensions of the Wronskians [3]
[ Info: Ranks of the Wronskians computed in 0.016648773 seconds
[ Info: Global identifiability assessed in 11.739331163 seconds
Here 1
Here 2
OrderedCollections.OrderedDict{Num, Symbol} with 1 entry:
p => :globally
julia> using Catalyst
julia> testSI_MTK()
^C^C^C^C^C^C^C^CWARNING: Force throwing a SIGINT
Internal error: during type inference of
testSI_MTK()
Encountered unexpected error in runtime:
InterruptException()
segv_handler at /cache/build/builder-demeter6-3/julialang/julia-release-1-dot-11/src/signals-unix.c:356
┌ Info: System parsed into X' = -X*d + p
└ y1 = X
[ Info: Assessing local identifiability
[ Info: Assessing global identifiability
[ Info: Computing IO-equations
[ Info: Computed IO-equations in 0.002162717 seconds
[ Info: Computing Wronskians
[ Info: Computed Wronskians in 0.001311264 seconds
[ Info: Dimensions of the Wronskians [3]
[ Info: Ranks of the Wronskians computed in 1.9153e-5 seconds
[ Info: Global identifiability assessed in 0.00601437 seconds
Here 1
Here 2
OrderedCollections.OrderedDict{Num, Symbol} with 1 entry:
p => :globally
julia> |
causes Julia to completely hang (as reported on Slack by @TorkelE).
Note that changing to
funcs_to_check = [p]
fixes the problem.Environment:
on Julia 1.10.5.
The text was updated successfully, but these errors were encountered: