About elapsed time and cvx_cputime

Hello,

I am running one MILP optimization program using Gurobi with CVX.
When the CVX performs the optimization, typing cvx_cputime gives 25 seconds.

However when use:

tic

cvx_begin
 -----
 ----

cvx_end

toc

I get the elapsed time as only 9 seconds.

Also, CVX outputs:

  Explored 9454 nodes (501188 simplex iterations) in 7.12 seconds

Can someone explain me these?

cvx_cputime, not surprisingly, depends on MATLAB’s cputime command. It’s called once at cvx_begin and again at the end of cvx_end, and subtracted. Given that it’s pretty simple I can’t say for sure what’s going on. Perhaps cputime counts multiple cores twice—so for instance, perhaps it is saying that Gurobi consumed a total of 25 seconds spread across 4 CPU cores (6.25 seconds each).

As far as I remember on Windows cpu time is the sum of time for each thread. That is why at MOSEK switched to use wall clock time.