-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
"Unreachable reached" bug during Test.@inferred
on Julia 1.6.7
#53761
Comments
Update: I have uploaded an rr trace (see original post) |
Test.@inferred
on Julia 1.6
Test.@inferred
on Julia 1.6Test.@inferred
on Julia 1.6.7
Can't reproduce? (@v1.6) pkg> add https://github.com/MilesCranmer/SymbolicRegression.jl#bc3d642281e4d99ee3380cea6c21a0abae901790
[...]
julia> include("/home/nsajko/.julia/packages/SymbolicRegression/0Tn2D/test/test_deterministic.jl");
[ Info: Precompiling SymbolicRegression [8254be44-1295-4e6a-a16d-46603ac705cb]
WARNING: using StaticArrays.setindex in module FiniteDiff conflicts with an existing identifier.
julia> versioninfo()
Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen 3 5300U with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, znver2) |
I uploaded the rr trace above. You can see and reproduce the error in that, no? According to https://discourse.julialang.org/t/unreachable-reached-at-0x13929e935/38528/6?u=milescranmer I am supposed to submit a bug report. |
I can reproduce this:
full test codeusing SymbolicRegression
using Test
using Random
X = 2 .* randn(MersenneTwister(0), Float32, 2, 1000);
y = 3 * cos.(X[2, :]) + X[1, :] .^ 2 .- 2;
options = SymbolicRegression.Options(;
binary_operators=(+, *, /, -),
unary_operators=(cos,),
crossover_probability=0.0, # required for recording, as not set up to track crossovers.
max_evals=10000,
deterministic=true,
seed=0,
verbosity=0,
progress=false,
);
all_outputs = []
for i in 1:2
# vvvvv crash here
hall_of_fame = @inferred equation_search(
X,
y;
niterations=5,
options=options,
parallelism=:serial,
v_dim_out=Val(1),
return_state=Val(false),
)
dominating = calculate_pareto_frontier(hall_of_fame)
push!(all_outputs, dominating[end].tree)
end
@test string(all_outputs[1]) == string(all_outputs[2])
And simplified test code: using SymbolicRegression
X = zeros(2, 1);
Y = zeros(1);
# equation_search(X, Y)
equation_search(X, Y; parallelism=:serial) Crash log
Full Call stack (obtained by inserting
Julia v1.6 + SymbolicRegression v0.24.2 just gives
|
I'm getting the bug
According to discourse, this deserved a bug report.
I get this when running Julia 1.6.7 SymbolicRegression.jl unittests on one of my branches. You can see the log here: https://github.com/MilesCranmer/SymbolicRegression.jl/actions/runs/8309436354/job/22740784019. I can reproduce it on my other Linux machines as well.
It specifically comes from this line: https://github.com/MilesCranmer/SymbolicRegression.jl/blob/bc3d642281e4d99ee3380cea6c21a0abae901790/test/test_deterministic.jl#L22-L30. This is not a new test; it's never had issues before. It seems like something in the type inference is breaking.
I have uploaded an rr trace here, of just running this test (which gets the error): https://s3.amazonaws.com/julialang-dumps/reports/2024-03-16T21-43-57-MilesCranmer.tar.zst so you can walk through it.
You can also reproduce this by checking out commit bc3d642281e4d99ee3380cea6c21a0abae901790 of SymbolicRegression.jl and running the file
test/test_deterministic.jl
for Julia 1.6.7.My guess is that it is related to type inference through
Optim.optimize
when theDynamicExpressions.OperatorEnum
is underspecified (i.e., aUnionAll
). I can get around this bug with this commit: MilesCranmer/SymbolicRegression.jl@d19f15b, which specifies the fullOperatorEnum
. I'm not sure if that helps or not.The text was updated successfully, but these errors were encountered: