Is coneqp using random seed anywhere?

46 views
Skip to first unread message

Matteo Lacki

unread,
Apr 27, 2017, 12:57:31 PM4/27/17
to CVXOPT
Hi,

Does coneqp is randomized ? I run it several times on the same computational problem and I sometimes get convergence, sometimes not (status = unknown). So, in my project I started calling it several times on this subproblem, until obtaining convergence. Each time, I run setseed(randint(0,100000)), where randint is from python's random module. It seems to help, but I am not sure I get the full picture. Please, enlight me :) 

BTW. CVXOPT is just great!

Best wishes, 
Matteo

Joachim Dahl

unread,
Apr 27, 2017, 2:27:01 PM4/27/17
to cvx...@googlegroups.com
This is probably a result of multithreaded BLAS.  If you force BLAS to run on a single thread, then CVXOPT ought to be run-to-run deterministic.   Search google for OMP_NUM_THREADS or something similar.

--
You received this message because you are subscribed to the Google Groups "CVXOPT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cvxopt+unsubscribe@googlegroups.com.
To post to this group, send email to cvx...@googlegroups.com.
Visit this group at https://groups.google.com/group/cvxopt.
For more options, visit https://groups.google.com/d/optout.

Matteo Lacki

unread,
Jun 22, 2017, 11:19:50 AM6/22/17
to CVXOPT
Hi!

This solution works but only if I have to run a script that changes the env variables at the beginning and then switches the values back to the original values.
This will not work if the user wants to use my module in his workflow and if he wants independently to use CVXOPT and loads it before I set the variable (CVXOPT won't get reimported). Is there any other way to make CVXOPT's function qp change to one thread on a per call basis?

Best, 

Martin

unread,
Jun 22, 2017, 3:10:39 PM6/22/17
to CVXOPT
As far as I know, this is the only way if you are using a threaded BLAS library. 

Of course you could prepend OMP_NUM_THREADS=1 when you start python:

OMP_NUM_THREADS=1 python

This way you don't have to worry about restoring the value of OMP_NUM_THREADS.
Reply all
Reply to author
Forward
0 new messages