3

How do you specify for CPLEX to use only one thread in pyomo?

CPLEX by default uses up to 32 threads, capped by the number of processors. But how do you specify using pyomo to only use one thread?

Assume my code already has the following:

import pyomo
cplex_solver = pyomo.opt.SolverFactory('cplex')
JoseOrtiz3
  • 1,785
  • 17
  • 28

1 Answers1

4

IBM says its CPLEX thread count parameter is called Threads.

I tried

import pyomo
cplex_solver = pyomo.opt.SolverFactory('cplex')
cplex_solver.options['threads'] = 1

and it has successfully made CPLEX use only one thread.

JoseOrtiz3
  • 1,785
  • 17
  • 28
  • 1
    This is generally what has to be done for all solving parameters of all solvers (Going to solver's documentations and using the `solver.options['option name']` line). So +1 for providing a method to find the parameter that works for *all* solvers and parameters. – V. Brunelle Oct 07 '19 at 17:01