Thursday, February 18, 2010

Threads question

So I have this new laptop which has a quad-core i7 cpu with hyper-threading enabled. That means programs see 8 cores. E.g. the task manager looks like:


When running MIP’s with Cplex and Gurobi, the question is now, what is the best setting to solve models as quickly as possible:

  1. Keep hyper-threading and run with threads=4
  2. Keep hyper-threading and run with threads=8
  3. Turn off hyper-threading and run with threads=4
Assume the model is small enough so memory limits are not an issue. My guess is that is does not really matter in a significant way. Of course in a single run the performance may be very different because the solver takes a different path. One would need to test a large number of models to make any statements about the best settings.

1 comment:

  1. I have found that there's little difference between case 1 and case 3, so I generally keep hyper threading turned on. As for case 2, I find that it is usually not helpful. So I generally run with hyper threading enabled and threads equal to the number of cores. This gives good solve times while keeping a few cycles available for web & email.

    Note that increasing the number of threads will increase the memory requirements. And you'll get terrible performance if you use virtual memory. In other words, make sure you keep the number of threads low enough that you don't require virtual memory. (Both CPLEX and Gurobi have settings to write the tree to disk, but you still need to ensure that the underlying LPs can be solved in memory).