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

Make dependency on Clarabel optional #142

Open
barracuda156 opened this issue Jun 28, 2024 · 6 comments
Open

Make dependency on Clarabel optional #142

barracuda156 opened this issue Jun 28, 2024 · 6 comments

Comments

@barracuda156
Copy link

The latest version of CVXR adds a dependency on clarabel, which, unfortunately, uses Rust. This a) pulls in a dependency on Rust, which is a huge thing to build; and b) breaks it for all platforms where Rust is broken.

This is a very undesirable move affecting multiple platforms and downstream distributions.

@barracuda156
Copy link
Author

@bnaras Could you please take a look? I could revert related commits, of course, to fix it for MacPorts locally, but it is better to have it done properly for everyone.

@bnaras
Copy link
Collaborator

bnaras commented Jun 28, 2024

@barracuda156 thanks for letting me know. Certainly not our intent, and perhaps I pulled the trigger a bit too fast. We can make it optional by adding it to the "Enhances" field. Down the line, however, with ECOS not being maintained, we need a good conic solver as a default and so it might become necessary. I will do this as soon as I can.

@barracuda156
Copy link
Author

barracuda156 commented Jun 28, 2024

@bnaras Thank you.

With Rust there are two potential options to have it working on every platform:

  1. mrustc supports bootstrapping new enough Rust and GCC backend for Rust is completed. That will still require non-trivial efforts though, since rustc compiler is designed in a silly fashion and getting to the current version from some version bootstrapped by mrustc from C will require sequential builds of multiple versions of rustc. (Days/weeks of compilation.)
  2. gccrs (GCC compiler for Rust) is production-ready and can be used in place of rustc. This will actually fix it for every platform where GCC works, i.e. more or less everywhere, but we do not know when that happens.

Neither is gonna happen soon, AFAIK.

So it is desirable to have a fallback via a non-default configure option (to keep Rust-less systems with ECOS) or otherwise find some cross-platform replacement for Clarabel.

Down the line, however, with ECOS not being maintained

I am not familiar with the related code, so saying this blindly, but perhaps you could make a fork and maintain it?

Generally speaking, math should not require Rust, C/C++/Fortran work perfectly fine. If not, there are OCaml and Lisp, which are not completely cross-platform, but at least not as bad as Rust. (Both in terms of support for platforms and in terms of bootstrapping their compilers from sources.)

@bnaras
Copy link
Collaborator

bnaras commented Jun 28, 2024

@barracuda156 I already maintain the R package ECOSolveR already and I have seen one example where the underlying ECOS C library leaks memory. I do fix things where I can, but not being an original author makes it time-consuming and difficult. (ECOS is also in the process of being deprecated in CVXPY too.)

Re: math. The authors of Clarabel chose to write the solver in Rust and I am glad to be able to make it available to R users.

But, at least for now, I can make this an enhancement rather than an import.

@barracuda156
Copy link
Author

@bnaras Thank you, this is appreciated.

@bnaras
Copy link
Collaborator

bnaras commented Jun 30, 2024

This fix is in place in the clarabel_interface branch. You can install via:

devtools::install_github("cvxgrp/CVXR", ref="clarabel_interface")

or download the whole tree and checkout the clarabel_interface branch and install as usual.
It will make it to CRAN in due course.

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

No branches or pull requests

2 participants