New to Julia, using it for dynamic systems simulations

Hi all,

I am a new Julia user. I am going to be using it to run some toy simulations of biologically realistic neural networks. If you aren’t familiar with this topic have a peak here.I saw DifferentialEquations.jl and I am going to start using that but a lot of the links on the website are deprecated also the last commit on the github was 2017. I am worried it’s not being maintained as is not worth my time learning. Are there other libraries that are useful for my needs? Would julia code written with poor optimization still be faster than python, as in if I just wrote my code “raw”, without any help from specific packages for differential equations?

That is probably the library you need, it is one major package of Julia, and it is great. The latest release is of Dec/2020:

If you write Julia code taking care of the performance tips it will be much faster than pure python, yes.

Edit: I have scrolled the performance tips now, and the list is becoming too long in my opinion, perhaps scary for a new user. Start avoiding non-constant global variables and you will be fine to start (first tip), and other tips one learns with practice.

3 Likes

Also, if you write your code in a vectorized/numpy style, you will probably get numpy like performance or better. Also, getting from there to full performance will be pretty easy later.

I just tried to load dynamic equations. I’m using vscode and it was taking forever (more than a minute) then I got a very strange error message:

julia> using DifferentialEquations
[ Info: Precompiling DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]
WARNING: Method definition integer2float(Type{Float32}, Int32) in module SLEEFPirates at C:\Users\angus\.julia\packages\SLEEFPirates\tWxX3\src\utils.jl:28 overwritten at C:\Users\angus\.julia\packages\SLEEFPirates\tWxX3\src\utils.jl:30.
  ** incremental compilation may be fatally broken for this module **

What versions do you have? Please display a full list of the installed software and their versions with doing pkg> st.

@Elrod are you familiar with that warning?

You were looking at the documentation from 2017, not the documentation from 2021.

2 Likes

I see that now thank you.

C:\Users\angus\.julia\environments\v1.5\Project.toml
[a93c6f00] DataFrames v0.22.5
[0c46a032] DifferentialEquations v6.16.0
[e30172f5] Documenter v0.26.1
[35a29f4d] DocumenterTools v0.1.9
[61744808] DynamicalSystems v1.7.1
[c91e804a] Gadfly v1.3.1
[438e738f] PyCall v1.92.2
[d330b81b] PyPlot v2.9.0
[c5292f4c] ResumableFunctions v0.5.2
[428bdadb] SimJulia v0.8.0

I am worried there is something wrong with my julia instillation and I am considering uninstalling and reinstalling. I will post the full error message I got when calling DifferentialEquations. it takes my laptop around 4-5 minutes to produce a very complicated and long error message. May be it will be of some insight.

Here, the first using DifferentialEquations took 1 minute (with precompilation) and the second took 20s. I am using Julia 1.5.3 (in 1.6 I suppose that is faster).

So probably there is something broken in your installation, yes.

Edit: Unfortunatelly I was not able to install it on 1.6-rc1, the download gets stuck somewhere. I am not sure if this is a temporary problem on the server (edit: it is a bug fixed in 1.6-rc2, it seems). (on the nightly build the using takes 5 seconds here).

This is the full error message I am getting. The julia REPL gets stuck at the line Info Precompiling… then after ten or more minutes it starts to pump out those warnings before the loading fails altogether. It’s strange because 2 days ago I loaded and used DifferentialEquations just fine. I have school work to do but later today I will try reinstalling julia. It also looks like I am missing some dependencies for some reason.

julia> using DifferentialEquations
[ Info: Precompiling DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]
┌ Warning: Module OrdinaryDiffEq with build ID 48339840974600 is missing from the cache.
│ This may mean OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1017
┌ Warning: Module OrdinaryDiffEq with build ID 48339840974600 is missing from the cache.
│ This may mean OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1017
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b]
│   exception = Required dependency AbstractAlgebra [c3fe647b-3220-5bb0-a1ea-a7954cac585d] failed to load from a cache file.
└ @ Base loading.jl:1042
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for ModelingToolkit [961ee093-0014-501f-94e3-6117800e7a78]
│   exception = Invalid input in module list: expected Unitful.
└ @ Base loading.jl:1042
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for ModelingToolkit [961ee093-0014-501f-94e3-6117800e7a78]
│   exception = Required dependency Unitful [1986cc42-f94f-5a68-af5c-568840ba703d] failed to load from a cache file.
└ @ Base loading.jl:1042
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]
│   exception = Required dependency ModelingToolkit [961ee093-0014-501f-94e3-6117800e7a78] failed to load from a cache file.
└ @ Base loading.jl:1042

That happens sometimes, and it seems random. If you restart Julia it seems to go away.

2 Likes

Hi all, having similar issues with DifferentialEquations in my new Julia installation (3 days ago?) in a mounted docker container in Visual Studio Code. Have tried restarting Julia and VSC, as well as pkg>up. Here is the error produced after (frustratingly) 6 minutes,

[ Info: Precompiling DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]
ERROR: LoadError: Failed to precompile Sundials [c3572dad-4567-51f8-b174-8c6c989267f4] to /root/.julia/compiled/v1.5/Sundials/j8Ppj_nrrZo.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
[3] _require(::Base.PkgId) at ./loading.jl:1030
[4] require(::Base.PkgId) at ./loading.jl:928
[5] require(::Module, ::Symbol) at ./loading.jl:923
[6] include(::Function, ::Module, ::String) at ./Base.jl:380
[7] include(::Module, ::String) at ./Base.jl:368
[8] top-level scope at none:2
[9] eval at ./boot.jl:347 [inlined]
[10] eval(::Expr) at ./client.jl:467
[11] top-level scope at ./none:3
in expression starting at /root/.julia/packages/DifferentialEquations/HSWeG/src/DifferentialEquations.jl:13
ERROR: LoadError: Failed to precompile DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa] to /root/.julia/compiled/v1.5/DifferentialEquations/UQdwS_nrrZo.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
[3] _require(::Base.PkgId) at ./loading.jl:1030
[4] require(::Base.PkgId) at ./loading.jl:928
[5] require(::Module, ::Symbol) at ./loading.jl:923
[6] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
[7] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./essentials.jl:710
[8] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:709
[9] inlineeval(::Module, ::String, ::Int64, ::Int64, ::String; softscope::Bool) at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:193
[10] (::VSCodeServer.var"#65#69"{String,Int64,Int64,String,Module,Bool,VSCodeServer.ReplRunCodeRequestParams})() at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:151
[11] withpath(::VSCodeServer.var"#65#69"{String,Int64,Int64,String,Module,Bool,VSCodeServer.ReplRunCodeRequestParams}, ::String) at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/repl.jl:142
[12] (::VSCodeServer.var"#64#68"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams})() at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:149
[13] hideprompt(::VSCodeServer.var"#64#68"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams}) at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/repl.jl:36
[14] (::VSCodeServer.var"#63#67"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams})() at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:117
[15] with_logstate(::Function, ::Any) at ./logging.jl:408
[16] with_logger at ./logging.jl:514 [inlined]
[17] (::VSCodeServer.var"#62#66"{VSCodeServer.ReplRunCodeRequestParams})() at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:183
[18] #invokelatest#1 at ./essentials.jl:710 [inlined]
[19] invokelatest(::Any) at ./essentials.jl:709
[20] macro expansion at /root/.vscode-server/extensions/julialang.language-julia-1.1.37/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
[21] (::VSCodeServer.var"#60#61")() at ./task.jl:356
in expression starting at /home/julia/project/PostBin_Analysis_v1.jl:19

What’s bizarre is that I have seen 2 or 3 different errors that are all pretty similar to this but with different .jl files in /DifferentialEquations each time I reload Julia… Here is my pkg>st information:

(@v1.5) pkg> st
Status ~/.julia/environments/v1.5/Project.toml
[49dc2e85] Calculus v0.5.1
[479239e8] Catalyst v6.9.1
[a93c6f00] DataFrames v0.22.5
[0c46a032] DifferentialEquations v6.16.0
[31c24e10] Distributions v0.24.15
[91a5bcdd] Plots v1.11.0
[276daf66] SpecialFunctions v1.3.0
[2913bbd2] StatsBase v0.33.4
[f3b207a7] StatsPlots v0.14.19
[24249f21] SymPy v1.0.41
[fce5fe82] Turing v0.15.12

Very new to Julia but I followed the docker installation and mounting instructions to a tee. While other precompiles are slow, DifferentialEquations is the only package giving me these issues.

Here is also a run of pkg>up for more information, and my Julia version info
(@v1.5) pkg> up
Updating registry at ~/.julia/registries/General
######################################################################## 100.0%
No Changes to ~/.julia/environments/v1.5/Project.toml
No Changes to ~/.julia/environments/v1.5/Manifest.toml

julia> versioninfo()
Julia Version 1.5.4
Commit 69fcb5745b (2021-03-11 19:13 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core™ i5-7360U CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_GPG = 3673DF529D9049477F76B37566E3C7DC03D6E495
JULIA_PATH = /usr/local/julia
JULIA_VERSION = 1.5.4
JULIA_EDITOR = “/root/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f04587c8/bin/code”
JULIA_NUM_THREADS =

Does it have internet access? It seems like it couldn’t download the Sundials binary.