Change to improve JuMP compatibility with PackageCompiler

Hi, JuMP community -

I have a suggestion for improving the compatibility of JuMP with PackageCompiler. I hope I’m using the right means to convey it; I haven’t contributed to the community before and am trying to follow contribution guidelines. If I’m off base, please redirect me.

Anyway, I’ve found that PackageCompiler doesn’t like the order in which regular and @generated functions are declared in JuMPArray.jl. But I can get it to work and compile a JuMP program I’ve written if the @generated functions are simply moved to the end of JuMPArray.jl. (By the way, I’m using JuMP v0.18.3.)

What do you think about this change? I’m happy to create a pull request for it if people support the idea.

4 Likes

@miles.lubin, fyi, our team has at least one use case that would significantly benefit from PackageCompiler.

1 Like

Sounds like an innocent enough change. Developer time is mostly focused on the 0.19 release but I’ll accept a PR for the release-0.18 branch. Is there a way to test that JuMP is compatible with PackageCompiler under CI? A one-time fix without tests is likely to break later.

1 Like

It would be really cool to see JuMP working with package compiler. I sort of assumed that would be difficult since in general JuMP is a big complicated thing that involves C++ dependencies of solvers and all that good stuff. @jwveysey do you actually have a complete working example?

Thanks for the feedback, everyone. Yes, I do have a complete working example, and the performance benefits for the first invocation in a Julia session are pretty substantial. I’ll prepare a pull request next week and see if I can include a reduced form of my example as a test case.

2 Likes

Pinging @joaquimg since he has this working as well.

1 Like

I have been using JuMP in a compiled code for almost an year. I have started trying packegecompiler recently, I use my modified version of the static-compile script.
The only thing I had problems was indeed JuMPArrays. I changed my code not to use them, because it made no difference to use a plain array in my case.
I am glad you found the problems!
Compiling JuMP code makes wonders if you are solving a small number of LPs.
I also had good experience using the nonlinear interface.
The solvers C++ libraries are not a problem, I compiled com using Xpress, SCS, GLPK, CBC, Mosek and Gurobi.

1 Like

One problem of testing this compiled stuff is travis giving up due to slowness of the compilation process…

Thanks, Joaquim - I’m glad to hear about others working in the area. I’m going to put together a pull request for my proposed change this week.

2 Likes