-
Notifications
You must be signed in to change notification settings - Fork 558
add cuopt direct solver #3620
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
base: main
Are you sure you want to change the base?
add cuopt direct solver #3620
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3620 +/- ##
==========================================
- Coverage 89.19% 85.24% -3.96%
==========================================
Files 896 896
Lines 103802 103846 +44
==========================================
- Hits 92589 88525 -4064
- Misses 11213 15321 +4108
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are working on making cuopt available in our testing infrastructure; can you please add tests to this PR?
@Iroy30 - We've been able to make cuopt available on our internal testing machines. Can you please add tests to this PR? |
5dbf9dd
to
6f64094
Compare
@mrmundt Thanks! We have added tests by enabling testing cuopt with LP and MILP capabilities in tests/solvers.py. Let us know if:
The following is the testing output I get relevant to cuOpt
|
t0 = time.time() | ||
self.solution = cuopt.linear_programming.solver.Solve(self._solver_model) | ||
t1 = time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but just so you're aware, we have this lovely little utility called TicTocTimer
that you may want to consider using: https://pyomo.readthedocs.io/en/latest/api/pyomo.common.timing.TicTocTimer.html
@mrmundt What do you think about including this solver interface in pyomo.contrib.solvers? Would it make sense to pull-in new solver interfaces there, since that's where the new solver API is evolving? |
@whart222 - I am evenly split. Because we are still messing with what the new solver interfaces are going to actually do / how they will handle input and present output, I don't know if we want to put "new" solvers there or just "well-established" ones that we can robustly test / really know what they are supposed to do and return. |
@Iroy30 - I forgot to post this last week, but all of the failures are of the variety:
|
@Iroy30 - Two more things:
|
Co-authored-by: Miranda Mundt <[email protected]>
@mrmundt I don't think the fail we see is cuOpt related. Can you confirm? |
We are gearing up for launch of cuopt 25.10, it would be great if we could review this PR before the new release so that pyomo & cuopt are in sync |
This is very close to the top of my list. When is the cuopt release? |
Thanks @michaelbynum ! It is October 10th |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Iroy30 , for this PR! I have done an initial review. Some high-level things to consider:
- Logging -
logger
is created but then never used. Consider places it may be helpful - "Magic" numbers - there are quite a few instances of numbers that aren't defined being used. We love documentation!
if not flag: | ||
raise RuntimeError( | ||
"***The cuopt_direct solver plugin cannot extract solution suffix=" | ||
+ suffix | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to log loudly than to raise an error here (no strong feelings either way, just wanted to offer an alternative option).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually pretty close, but there are a number of things that need to be resolved before we can merge.
self.results.problem.upper_bound = solution.get_primal_objective() | ||
self.results.problem.lower_bound = solution.get_primal_objective() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies convergence to a MIP gap of 0... I think this needs to be something like (assuming get_dual_objective()
is a real thing):
self.results.problem.upper_bound = solution.get_primal_objective() | |
self.results.problem.lower_bound = solution.get_primal_objective() | |
if self._solver_model.maximize: | |
self.results.problem.upper_bound = solution.get_dual_objective() | |
self.results.problem.lower_bound = solution.get_primal_objective() | |
else: | |
self.results.problem.upper_bound = solution.get_primal_objective() | |
self.results.problem.lower_bound = solution.get_dual_objective() |
The errors we are seeing on Jenkins are segfaults:
|
@mrmundt Would it be possible to update CI to pull cuopt 25.10 |
@Iroy30 Yes (working on that now - it will take a couple hours to update everything and propagate it to the build machines)- but does that mean that this interface will enforce a minimum cuopt version? |
@jsiirola The segfaults you see in CI with 25.08 is concerning. Was the CI running the 25.08 release or the daily build of cuopt(this could cause the segfault). If 25.08 release was causing segfault then we might have to enforce minimum cuopt 25.10 and meanwhile I will debug 25.08 on my end because we were not seeing this previously |
The CI is running cuopt-cu12/25.8.0 from PyPI. I have added 25.10.0 (also from PyPI), but that won't make it to the build machines for testing until later tonight (it is waiting on finalizing the Pyomo 6.9.5 release) |
Fixes #3626
Summary/Motivation:
Add cuOpt math optimization (includes LP and MILP) solver backend to Pyomo so users can solve pyomo models with cuOpt
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: