Announcement: CVX for Apple Silicon

An unofficial native CVX 2.2 package for Apple Sillicon (M1, M2, etc., Matlab architecture MACA64) is available. With this package it is possible to use CVX directly in the Matlab releases for Apple Sillicon (starting R2023b), without having to use the Intel version through the Rosetta emulator.

The package can be downloaded from:

cvx-maca64.zip cvx-maca64.tar.gz

The package is the work of @mikewong (Dr. Wenyuan (Mike) Wang, who was the main driving force behind this project) and myself, and we publish it with the kind permission of @mcg. It contains only the smallest amount of formal modifications of the publicly available CVX 2.2 needed to get it to work; all algorithms and internals of CVX are unchanged. Installation and usage are the same as always.

Some remarks: it worked for us but testing was scarce; there are no guarantees of any kind; we do not have the capacity to provide support; SeDuMi and SDPT3 are included, MOSEK has to be installed separately the way one normally uses an external MOSEK; to our best knowledge recent versions of GUROBI were incompatible with CVX already for a while and this does not change here; all usage is at your own risk.

@mikewong reports a considerable speedup compared to running the Intel version via Rosetta on his problems. Again, we can make no general promises.

We hope this can be useful for CVX users on MAC.

Michal, Mike

2 Likes

Thanks for the effort in making this available. I’ve downloaded and installed the package. It took about 10 attempts running cvx_setup to set the individual security authorisations for each of the mex files. And a couple more running some code with found some mex code not exercised in the cvx_setup procedure.

But after doing this it works very well. My experience is also that it is significantly faster. I’ve also simultaneously upgraded to R2023b from R2020b and that may have also had an effect. I haven’t run any comprehensive timing tests though.

Cheers, Roy

Some installation instructions:

  1. Download cvx from the link and extract it
  2. Go to the cvx folder from MATLAB directory (do cd ~/Downloads/cvx if you extracted into the Downloads folder)
  3. Run cvx_setup command in MATLAB terminal => you will most likely get an error
  4. Go to mac system settings → privacy and click on ‘Allow anyway’ under the security section
  5. Repeat step 3 and 4 around 10 times until no error is thrown
  6. Type cvx_solver into the MATLAB terminal to check if everything is working correctly

I used to have the following tricks to quickly bypass the security issues:

  • either download the package in the command line with curl instead of through a browser,
  • or if already downloaded remove the quarantine attribute from the whole folder at once:
    xattr -d com.apple.quarantine cvx,
  • or try both to be sure.

But that was back in the days when the security hocus pocus just started; I am unable to say if any of this works just as well today.

If you do not plan to use Sedumi and/or SDPT3 you can also remove their folders in advance. That should save cvx_setup.m a lot of mex files to load.