# CPU time on Linux with Gurobi

I am solving a MILP model in C++ using Gurobi 10.1. I retrieve the CPU time of my C++ program under Linux via the following commands:

clock_t start_time;
double elapsed_time;
start_time= clock();
model.optimize();
elapsed_time = (double) (clock() - start_time)/CLOCKS_PER_SEC;


Each time I solve the same problem instance with the same gurobi options and using only ONE thread, I get different CPU times; sometimes drastically different; for example 6500 sec vs. 3800 sec.

I do not understand why, in particular, since I use only one thread. CPU time is also significantly larger than the wall-clock time.

On the other hand, the wall-clock time remains stable.

Can somebody help me understand this and fix this issue?

• Might the Gurobi ver. be 9.1 instead of 10.1? Are you sure to solve the same problems by checking those fingerprints? – A.Omidi Jan 15 at 7:11
• Yes, I use gurobi 10.1 for both. – Pratim Jan 15 at 17:11