Closed lassepe closed 2 years ago
Hi Lasse,
Thanks for trying out LFPSQP and for notifying me of the issue. How peculiar! I'm on version 1.6.1 and did not face any issues...
I just installed version 1.7.0-beta3 and can indeed reproduce the segfault that you observe. After playing around with it a bit, the issue seems to be with the gradient, jacobian, and hessian-vector functions generated via automatic differentiation in autodiff_generators.jl and called by the convenience optimize
function. Specifically, calling
cfg_f = ReverseDiff.GradientConfig(x0)
in the generate_gradient
function causes a segfault, so this appears to be a bug with ReverseDiff!
For now, you can regress to julia 1.6.1 like me, you can specify gradients, jacobians, and hessian-vector functions with another automatic differentiation package in the style of the functions I wrote in autodiff_generators.jl, or you can write the functions manually, such as in the following simple example without constraints:
f = x -> dot(x, x)/2
function grad!(g, x)
g .= x
end
function hess_lag_vec!(dest, src, x, λ)
dest .= src
end
optimize(f, grad!, nothing, nothing, hess_lag_vec!, ones(5), nothing, nothing, 0, LFPSQP.LFPSQPParams())
I may open an issue with ReverseDiff or potentially migrate away from default usage of ReverseDiff in LFPSQP if the problem persists.
Thank you for the swift response! Maybe as a quick fix here you can set the julia compat to 1.6.1
until the problem is fixed upstream.
Thank you for sharing this package and your talk at JuliaCon; I really enjoyed it!
I'll definitely look into adjusting the compat attribute. I also logged the issue in the ReverseDiff repo, so we'll see what happens.
Thanks so much; that's great to hear 🙂! As I continue to write the documentation (and finish the manuscript), please feel free to send me any other feedback you may have!
ReverseDiff seems to be fine in Julia v1.7.1 now
@ksil thank you for the follow up. It may be a good idea to add a compat entry to the Project.toml to reflect the fact that this packages requires Julia 1.7.
The equality constraint example from the README:
Reliably segfaults my Julia installation. Both on Julia 1.6.2 and 1.7.0-beta3.