Support Gurobi 13 dynamic loading - #5272
Open
jaxor24 wants to merge 3 commits into
Open
Conversation
Collaborator
|
our dev branch is |
jaxor24
force-pushed
the
fix-mathopt-gurobi-13
branch
from
July 26, 2026 21:49
ebcf79e to
ff8eee7
Compare
Author
No problem - just rebased. |
jaxor24
force-pushed
the
fix-mathopt-gurobi-13
branch
from
July 30, 2026 00:30
ff8eee7 to
cf1319e
Compare
7FM
added a commit
to esa-tu-darmstadt/Nailgun
that referenced
this pull request
Jul 30, 2026
Highest Gurobi usable with or-tools 9.15 (Gurobi 13 dropped the GRBcopyparams export that or-tools' loader CHECK-fails on; unmerged fix google/or-tools#5272 — bump to 13.x once it ships in a release). 12.0.3 verified against the token server. Matches the longnail flake's pin. nixpkgs deliberately NOT bumped: the eval env is not ready for what a 2026-07 snapshot drags in (cocotb 2.0, git >= 2.48 breaking init.sh). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7FM
added a commit
to esa-tu-darmstadt/Shortnail
that referenced
this pull request
Aug 3, 2026
`-schedule-lil solver=GUROBI` aborts every longnail-opt invocation that reaches the MathOpt Gurobi backend: terminate called after throwing an instance of 'std::bad_function_call' #12 math_opt::GurobiNewPrimaryEnv(...) #24 schedulePARAMS(...) ResourceSharing.cpp #29 ScheduleLIL::runOnOperation() or-tools' MathOpt path never calls LoadGurobiDynamicLibrary (google/or-tools#5079), so the GRB* std::function globals stay empty and the first call throws — fatal, since CIRCT/longnail build -fno-exceptions. This is independent of whether Gurobi is installed: the loader is not invoked either way, so the `.ok()` fallback to HiGHS never gets a chance. It bit the whole simulation suite plus the GUROBI-requesting tests under test/ once scheduling moved from MPSolver (which probed availability with MPSolver::SupportsProblemType, and degraded gracefully) to MathOpt. nix/ortools_gurobi_loader.patch adds the missing load call and, as the same load path needs it, makes DynamicLibrary non-copyable with a move constructor — its implicit copy plus a dlclose'ing destructor unloads libgurobi whenever the NoDestructor init lambda's return value is not elided, which is every unoptimized build (we build Debug). Wired into both build paths so they produce the same or-tools: * nix/ortools.nix gains a `patches` attribute * build_deps.sh injects a `patch -p1` ahead of the cmake line in circt/utils/get-or-tools.sh, which offers no hook of its own between unpacking the tarball and configuring it Verified: the patch applies cleanly to a pristine v9.15 checkout of the two files, RETURN_IF_ERROR is already in scope there, and LoadGurobiDynamicLibrary is declared via the included third_party_solvers/gurobi_environment.h. Not version-guarded on purpose: an OR_TOOLS_VER bump fails loudly rather than silently dropping the fix. The patch header records why upstream PR google/or-tools#5272 cannot be used on 9.15. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
7FM
added a commit
to esa-tu-darmstadt/Nailgun
that referenced
this pull request
Aug 3, 2026
Highest Gurobi usable with or-tools 9.15 (Gurobi 13 dropped the GRBcopyparams export that or-tools' loader CHECK-fails on; unmerged fix google/or-tools#5272 — bump to 13.x once it ships in a release). 12.0.3 verified against the token server. Matches the longnail flake's pin. nixpkgs deliberately NOT bumped: the eval env is not ready for what a 2026-07 snapshot drags in (cocotb 2.0, git >= 2.48 breaking init.sh). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for dynamically loading Gurobi 13.
Gurobi 13 no longer exports
GRBcopyparams, which caused OR-Tools dynamic loading to fail before the solver could be used. This PR makes that symbol optional and adds a fallback implementation that copies non-default parameters explicitly.Also included:
DynamicLibrarynon-copyable and adds optional symbol lookup support.gurobi_parse_header.pyso optional symbols are generated withTryGetFunction.Testing