Skip to content
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

Failure in callback under Julia-1.5.0-DEV #144

Closed
dmbates opened this issue May 12, 2020 · 5 comments
Closed

Failure in callback under Julia-1.5.0-DEV #144

dmbates opened this issue May 12, 2020 · 5 comments

Comments

@dmbates
Copy link

dmbates commented May 12, 2020

NLopt is the optimizer used in the MixedModels package. Our tests have started failing under Julia-1.5.0-DEV and under
julia-nightly in a callback to evaluate the objective function.

A simple example is transcript2.txt
I am using the MixedModels#master there but I think the same will occur under the latest release.

@palday
Copy link
Contributor

palday commented May 12, 2020

I suspect the problem originates from this change in 1.5:

Immutable structs (including tuples) that contain references can now be allocated on the stack, and allocated inline within arrays and other structs (#33886). This significantly reduces the number of heap allocations in some workloads. Code that requires assumptions about object layout and addresses (usually for interoperability with C or other languages) might need to be updated; for example any object that needs a stable address should be a mutable struct.

NEWS page for 1.5
JuliaLang/julia#33886

If we change the algorithm MixedModels uses, we can sometimes avoid the problem:

using MixedModels, NLopt
using MixedModels: dataset

m1 = LinearMixedModel( @formula(yield ~ 1 + (1|batch)), dataset(:dyestuff))
m1.optsum.optimizer = :LN_NELDERMEAD
fit!(m1)

Nelder-Mead mostly works, as does COBYLA, but BOBYQA never does. I suspect that small differences in the way the memory is being allocated leads to being a small amount off in the relevant pointer and so you get the adjacent Core.Compiler.UseRef instead of the relevant NLopt.Callback_Data.

@palday
Copy link
Contributor

palday commented May 12, 2020

See also #142.

Using NLopt#master solves this issue. Perhaps a release would be in order so that compatibility is maintained for Julia 1.5? I see the last one was in August 2018.....

@dmbates
Copy link
Author

dmbates commented May 12, 2020

Thanks for looking into this @palday

@stevengj
Copy link
Collaborator

stevengj commented May 13, 2020

Yes, a new release would be a good idea. I also want to switch over to the JLL artifacts system for building the library (JuliaPackaging/Yggdrasil#1028 and JuliaRegistries/General#14686)…

@stevengj
Copy link
Collaborator

Should be fixed by JuliaRegistries/General#14712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants