How to reduce the CPU usage of CVX Mosek without affecting problem solving ?
When I use parfor for parallel computing, the Mosek solver consumes a lot of CPU and the CPU temperature is too high.
Will setting parameter ‘MSK_IPAR_NUM_THREADS’ affect problem solving?
By default MOSEK will automatically select the number of threads.
However, the maximum number of threads allowed can be changed by setting the parameter ‘MSK_IPAR_NUM_THREADS’ and related parameters. This should never exceed the number of cores.
(link: 9 Technical guidelines — MOSEK Rmosek package 10.2.6)
Since you are solving multiple problems in parallel, then I would force Mosek to solve each problem using 1 thread. Hence, I would use
MSK_IPAR_NUM_THREADS = 1
If you are extremely performance-sensitive, then MATLAB+cvx may not be the best tool for solving many problems in parallel.
Thank you! I have tried it. This method reduces CPU utilization to a certain extent.
The CPU utilization is too high, and the CPU temperature will also be very high. I am worried that it may damage the CPU.
Each Mosek needs at least 1 thread. Maybe the parfor use too many threads.
I have never used parfor though.
Based on your suggestion, I also learned about the method of setting the number of MOSEK threads from the link ( 9 Technical guidelines — MOSEK Rmosek package 10.2.6).
Due to the need for a large number of for-loops in my code, I used parfor for acceleration. In order to prevent CPU utilization and high CPU temperature, I only used a small number of CPU computing cores.
Btw the natural Mosek reference given you use MATLAB is
https://docs.mosek.com/latest/toolbox/index.html
When I use MSK_IPAR_NUM_THREADS = 1, the following prompt ‘NOTE: custom settings have been set for this solver.’ appears in the command line window. Can this prompt be canceled?