Threads

The ILOG CPLEX parallel optimizers are licensed for a specific maximum number of threads (that is, the number processors applied to a given problem). The number of threads that ILOG CPLEX actually uses during a parallel optimization is the smaller of:

The global thread parameter Threads establishes a default thread count for all parallel optimizers. Thread limits for specific optimizers can be set to values that differ from the global default (for example, by setting IloCplex::MIPThreads).

The notion of the number of threads used when running a parallel CPLEX optimizer is entirely separate from the limit on licensed uses. A typical ILOG CPLEX license permits one licensed use, that is a single concurrent execution on one licensed computer. If the license also contains the parallel option with a thread limit of, say, four (on a machine with at least four processors), that one concurrent execution of ILOG CPLEX can employ any number of parallel threads to increase performance, up to that limit of 4. A license with the parallel option, that additionally has a limit larger than one on the number of licensed uses, can support that many simultaneous executions of ILOG CPLEX, each with the licensed maximum number of parallel threads. In such a case, the operating system will manage any contention for processors.

The number of parallel threads used by an ILOG CPLEX optimizer is usually controlled by ILOG CPLEX parameter settings. For the OpenMP version, the number can also be controlled by environment variable OMP_NUM_THREADS. Set this variable to establish an upper limit on the number of threads used by ILOG CPLEX. This is discussed in more detail in the sections that follow.

Example: Threads and Licensing

For example, let's assume you use ILOG CPLEX to optimize MIP models on an eight processor machine, and you have purchased an ILOG CPLEX license for four parallel threads. Then you can use the Interactive Optimizer command set threads i, substituting values 1 through 4 for i. You will not be able to set the thread count higher than 4 because you are licensed for a maximum of four threads. If you set environment variable OMP_NUM_THREADS to 2 in the OpenMP version, then you can set the thread count to no more than 2. Any MIP optimization you carry out will be limited to two processors.

Threads and Performance Considerations

If you set the number of threads to a value greater than the number of available processors, performance will usually degrade. If you set the number of threads to a value less than the number of processors, the remaining processors will be available for other jobs on your platform. Simultaneously running multiple parallel jobs with a total number of threads exceeding the number of processors may impair the performance of each individual process as its threads compete with one another.

If you are using the OpenMP libraries and set the OMP_NUM_THREADS environment variable to a greater value than the actual thread count used with ILOG CPLEX, your operating system may create idle threads that still consume system resources. If you know in advance how many threads you want to use, we recommend that you set the environment variable to that number before you start ILOG CPLEX.

The benefit of applying more threads to optimizing a specific problem varies depending on the optimizer you use and the characteristics of the problem. You should experiment to assess performance improvements and degradation when you apply more or fewer processors. For example, when you optimize the root relaxation using the dual simplex method, there may be little or no benefit in applying more than four processors to the task. In contrast, if you use 16 processors during the MIP phase of an optimization, you may improve solution speed by a factor of 20. In such a case, you should set the parameters simplex limit threads and mip limit threads to different values in order to use your computing resources efficiently.

Another key consideration in setting optimizer and global thread limits is your management of overall system load.


Previous Page: Using Parallel Optimizers  Return to Top Next Page: Nondeterminism