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
Performance issues with DPP problems #1332
Comments
I should add that removing constraints loop here https://github.com/kmonson/cvxpy-performance/blob/master/solver_dpp.py#L136 is not all of the problem and while I can refactor it some I can't really eliminate it. Besides, it compiles quickly if the problem is not DPP. |
This is a know issue. DPP compilation will likely never be as fast as non-DPP compilation -- the first compilation of a parametrized program performs significantly more work, to dramatically speed up subsequent compilations. That said the overhead is much larger than we would like. We would like to fix this, but it is a substantial engineering effort and not currently on our near-term roadmap. For now, DPP may help for some problems with a few parameters (say hundreds or a few thousand), for which you can pay the overhead of the first compilation and for which you really need subsequent solves to be fast. In cases where the overhead is prohibitive, you can replace parameters with constants. |
OK, that is what I was afraid of. I'm writing up a feature request to hopefully help with this problem. |
Is there a way I can easily tell cvxpy to not treat the problem as DPP even if it is? My program runs one large problem (8760 hours long) or 365 24 hour long problems or something in between depending on the user needs. From my benchmarking there is a pretty clear line at which it's beneficial to purposefully switch off DPP. It would nice if I could do this without modifying how the problem is built based on user parameters. |
I am also encountering issues with overhead and DPP compilation. There are many circumstances where I want to use Parameters, but not pay the overhead associated with DPP compilation. Rewriting code to replace the parameters with constants would be troublesome and I think the logic should exist within cvxpy to disable DPP, perhaps converting parameters to constants during problem formation. What would it take to add a flag for this? |
@kmonson , @sjschneider : this is a reasonable request. We have plans to decrease the overhead of DPP compilation, but these plans are not on our near-term roadmap. Having a flag that disables parametrized compilation in the meantime is, I think, perfectly reasonable. We will look into adding something like this, and will give an update on this thread once we have a design. |
@kmonson @sjschneider, for the time being you can do something like
If you make that change then the problem is no longer DPP (no longer affine in Parameter objects) so parameters will be evaluated before canonicalization. This is just a quick hack though and might not help as much as a proper fix. |
Thanks @akshayka @rileyjmurray. I opened a ticket for this: #1340 I ended up with this solution. I don't know if it's any better or worse.
|
Describe the bug
When I replace parameters with constants to make the problem DPP the solver takes dramatically longer for larger problems the moment the problem becomes DPP.
To Reproduce
Data files and code to reproduce this can be found here https://github.com/kmonson/cvxpy-performance.
This will run the non-dpp then dpp versions of the same problem at multiple problem sizes.
Expected behavior
Problem compilation and solving should take roughly the same amount of time for both DPP and non-DPP problems for the first solve.
Version
The text was updated successfully, but these errors were encountered: