User Tools

Site Tools


solver:multiple_cplex_threads

Multiple CPLEX threads

Q: I use CPLEX as my solver and have heard that it is possible to use multiple threads to decrease the solution time and use the full capacity of the computer. How is this implemented in GAMS?

A GAMS run involves

  • the GAMS language compiler for processing the source code and data of the model and generating the model
  • and a solver for doing the optimization.

Currently the GAMS language compiler is not able to take advantage of parallel processing but a number of the available solvers are. Moreover, the GAMS system does not impose any restrictions on the number of threads used, however, a solver may impose a restcition.

CPLEX uses SMP (symmetric multi processing) to work in parallel. Only some parts of the CPLEX code make use of this: branch-and-bound (for MIPs) and the barrier code (for solving LPs or the root node for MIPs). For details, please check your solver manual.

The parallel option can be specified via the GAMS option threads:

option threads=6;

The underlying solver algorithm must support multiple threads in order for the option to take effect. For example, you can set CPLEX to use the barrier algorithm that supports parallel threads by using a solver solver specific option file, hence, you may add the following to your model:

$onecho > cplex.opt
lpmethod 4
$offecho
<modelname>.optfile=1;

,where <modelname> is replaced with the name of your model. This activates the use of the solver specific option file. In general, it is possible to set the number of threads also via the solver specific option file, as well as, verify the number of threads used from the solver specific part of the GAMS log file, however, ultimately this is determined by the solver developer.

Reading data...
Starting Cplex...
Tried aggregator 1 time.
LP Presolve eliminated 1 rows and 1 columns.
Reduced LP has 5 rows, 6 columns, and 12 nonzeros.
Presolve time = 0.03 sec. (0.00 ticks)
Parallel mode: using up to 6 threads for barrier.
solver/multiple_cplex_threads.txt · Last modified: 2017/09/02 17:38 by support