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
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 or only an informational callback, 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.

When this parameter is at its default setting 0 (zero), and your application includes callbacks other than informational callbacks (that is, the application includes a query, diagnostic, or control callback), then CPLEX uses one thread. In other words, the presence of a callback turns off parallel processing when the value of this parameter is at its default.

In order to use parallel optimization in conjunction with 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.

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

Tip: This parameter interacts with CPU mask to bind threads to cores. In particular, when this threads parameter is left at its default value 0 (that is, zero), then the value of CPU mask to bind threads to cores determines how many threads are used.

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).