Originally posted by: SystemAdmin
In the interactive, you could just try to set the threads parameter to a ridiculously large value. This will give you a message that the setting was not possible and the maximal thread count is n:
CPLEX> set threads 10000000
Value can be no larger than 4.
CPLEX>
If you are working in a scripting environment, you could just launch the interactive with this single command and then parse the output to get the maximal number of threads.
In the C API, you can just query the maximal value of the "threads" parameter with
int maxthreads;
CPXinfointparam (env, CPX_PARAM_THREADS, NULL, NULL, &maxthreads);
In the other APIs there are similar ways to do this, for example
int maxthreads = cplex.getMax (IloCplex::Threads);
Please note that when you explicitly set the threads parameter in CPLEX 11.0, you are implicitly switch to opportunistic parallel mode. If you want to keep deterministic parallel then you also need to explicitly set the parallel mode parameter.
If you just want CPLEX to use the maximal number of available cores, then you do not need to do anything. This is the default behavior.
Tobias
#CPLEXOptimizers#DecisionOptimization