global thread count

Sets the default number of parallel threads that will be invoked by any CPLEX parallel optimizer.

Purpose

Global default thread count

API Parameter Name Name prior to V12.6.0
C CPXPARAM_Threads CPX_PARAM_THREADS
C++ IloCplex::Param::Threads Threads (int)
Java IloCplex.Param.Threads Threads (int)
.NET Cplex.Param.Threads Threads (int)
OPL threads threads
Python parameters.threads threads
MATLAB Cplex.Param.threads threads
Interactive threads threads
Identifier 1067 1067

Description

Sets the default maximal number of parallel threads that will be invoked by any CPLEX parallel optimizer.

For a single thread, the parallel algorithms behave deterministically, regardless of thread parameter settings; that is, the algorithm proceeds sequentially in a single thread.

In this context, sequential means that the algorithm proceeds step by step, consecutively, in a predictable and repeatable order within a single thread. Deterministic means that repeated solving of the same model with the same parameter settings on the same computing platform will follow exactly the same solution path, yielding the same level of performance and the same values in the solution. Sequential execution is deterministic. In multithreaded computing, a deterministic setting requires synchronization between threads. Opportunistic entails less synchronization between threads and thus may offer better performance at the sacrifice of repeatable, invariant solution paths and values in repeated runs on multiple threads or multiple processors.

When this parameter is at its default setting 0 (zero), and your application includes no callbacks CPLEX can use all available threads; that is, at most 32 threads or the number of cores of the machine, whichever is smaller. If your machine offers more than 32 threads, you can take advantage of them by increasing the value of this parameter.

In the case where you are using callbacks, you need to distinguish between legacy callbacks (that is informational, query, and control callbacks) and generic callbacks. Generic callbacks have been introduced more recently and offer a better support for a modern parallel MIP optimization.

Generic callbacks and parallel MIP optimization

In contrast with legacy callbacks, the presence of a generic callback in your application will not have any impact on the number of threads used by CPLEX (that is, parallel MIP search will behave the same way as if no callbacks are present). However, as in the case of legacy callbacks, if you use parallel MIP search in conjunction with generic callbacks, you need to be aware of the fact that the callbacks may be invoked concurrently, and the order in which your callbacks are executed from different threads can be non-deterministic even in deterministic parallel mode.

For a description of generic callbacks, see the topic Generic callbacks in the CPLEX User’s Manual.

Legacy callbacks and parallel MIP optimization

When this parameter is at its default setting 0 (zero), some of the legacy callbacks will disable parallel MIP search. To be precise, if your application includes legacy callbacks other than informational callbacks (that is, the application includes a query, diagnostic, or control callback), then CPLEX will disable parallel MIP search and automatically switch to sequential MIP search. Note, however, that this is not entirely equivalent to setting this parameter to 1 (one), as the continuous relaxation of the problem could still be solved in a parallel fashion.

In order to enable parallel MIP optimization in conjunction with legacy callbacks other than informational callbacks, you need to set this parameter to a positive value. However, when you do so, you need to be aware of the fact that the callbacks may be invoked concurrently, and the order in which your callbacks are executed from different threads can be non-deterministic, even in deterministic parallel mode.

For a description of informational, query, diagnostic, and control callbacks, see the topic Using legacy optimization callbacks and the topic Advanced MIP control interface (legacy) in the CPLEX User’s Manual.

Table 1. Values
Value Meaning
0 Automatic: let CPLEX decide; default
1 Sequential; single threaded
N Uses up to N threads; N is limited by available processors and Processor Value Units (PVU).

See also

parallel mode switch