How to run cvxpy in parallel

1,889 views
Skip to first unread message

Bill Li

unread,
Sep 18, 2015, 5:19:24 PM9/18/15
to cvxpy
Hi Steven,

I understand that I can choose the SCS solver in cvxpy, and I am wondering if it is possible to utilize OpenMP and run the solver on multiple cores.

I'm sure it is something trivial if the feature exists, but I wasn't able to find it from googling, so I thought I would post here.

Thanks,
Bill

Steven Diamond

unread,
Sep 18, 2015, 6:21:30 PM9/18/15
to cvxpy
Your C compiler needs to support OpenMP (i.e. use gcc, not clang).
To activate OpenMP, clone the SCS repo and edit SCS setup.py to set USE_OPENMP = True 
Then install with "python setup.py install".

You can set the number of threads with 
export OMP_NUM_THREAD=32

Bill Li

unread,
Sep 19, 2015, 9:58:11 PM9/19/15
to cvxpy
It's not working for me, however I found that it's not an issue of SCS, but rather at the numpy level. I tried a few things from stackoverflow but it didn't resolve the problem. Anyways that would be beyond the scope of this thread, and I will post here if I do find a solution.

Thanks for your quick response earlier!

Brendan O'Donoghue

unread,
Sep 20, 2015, 10:11:33 AM9/20/15
to cvxpy
Can you give any more context on the numpy issue you're having? I have been able to use openMP to run the indirect version of SCS in python following the same directions as Steven posted. It's also possible to multi-thread calls to SCS to solve many problems in parallel, I haven't released that capability yet but I can try to get it out sooner if it's something you might be interested in.

Bill Li

unread,
Sep 20, 2015, 1:18:58 PM9/20/15
to cvxpy
The issue I am having is openBLAS integration with numpy. Specifically I followed the instructions of this post:

However I wasn't able to get a speed up as the post showed. I haven't looked into it too much since it's not an urgent issue for me.

Also thanks for offering to release the multi-thread calls capability, but I likely won't need it, at least not urgently.

Brendan O'Donoghue

unread,
Sep 21, 2015, 9:09:07 AM9/21/15
to cvxpy
I see, so you're trying to get multi-threading speedup for solving SDPs? That's the only place where BLAS is used in SCS. In that case you're right, you have to link against the right blas/lapack distro.
Reply all
Reply to author
Forward
0 new messages