SciML / DataDrivenDiffEq.jl

Data driven modeling and automated discovery of dynamical systems for the SciML Scientific Machine Learning organization
https://docs.sciml.ai/DataDrivenDiffEq/stable/
MIT License
407 stars 57 forks source link

Certain large problems cause segfaults #228

Closed GlenHenshaw closed 3 years ago

GlenHenshaw commented 3 years ago

Using Julia 1.6.1 on an M1 MacBook Air, macOS 11.3.1. This seems to crash only from a fresh Julia REPL, e.g. if I have already invoked solve() on a smaller problem, then this doesn't crash. But if I haven't then I get the following:

julia> using DataDrivenDiffEq;
julia> X = rand([0, 1], 128, 936);
julia> T = collect(LinRange(0, 4.367058580858928, 936));
julia> problem = DiscreteDataDrivenProblem(X, T);
julia> res = solve(problem, DMDSVD())

signal (11): Segmentation fault: 11
in expression starting at REPL[5]:1
unknown function (ip: 0x0)
Allocations: 683789624 (Pool: 683746676; Big: 42948); GC: 426
zsh: segmentation fault  Julia

I can also sometimes get the following error:

rosetta error: unexpectedly need to EmulateForward on a synchronous exception x86_rip=0x108e6ff20 arm_pc=0x10955cfd0 num_insts=4 inst_index=2 x86 instruction bytes: 0x56415741e5894855 0xfe8949d789415053
zsh: trace trap  julia

but not yet repeatedly with a minimal code.

AlCap23 commented 3 years ago

Can you try a script as well ? I'll check if I can reproduce this on Ubuntu.

GlenHenshaw commented 3 years ago

When run as a script, the above code throws the following error:

rosetta error: unexpectedly need to EmulateForward on a synchronous exception x86_rip=0x10aa272e0 arm_pc=0x10b10b73c num_insts=6 inst_index=3 x86 instruction bytes: 0x56415741e5894855 0xec83485354415541
zsh: trace trap  julia error.jl

Not sure you will be able to replicate this on Ubuntu, as rosetta is the translation layer that M1 Macs use to run x86 code.

AlCap23 commented 3 years ago

Could you use the operator_only = true kwarg? I run into a problem within building the solution, which might be related to the size of the problem.

GlenHenshaw commented 3 years ago

running:

res = solve(problem, DMDSVD(); operator_only = true)

does indeed clear the error, both from the REPL and from the script.

AlCap23 commented 3 years ago

I'll add the kwargs for the solution within the next days. I think this might be due to the function building, but have to dig deeper :)

Yes. Definitely this.

AlCap23 commented 3 years ago

Closed via #233