I am trying to solve a mixed integer linear program by branch-and-cut using JuMP and CPLEX.
I am having some trouble setting the number of threads for CPLEX.
I am trying to set the parameter CPXPARAM_Threads using set_optimizer_attribute in the following way:
model = Model(CPLEX.Optimizer)
set_optimizer_attribute(model, "CPXPARAM_Threads", 4)
However, in the log I get the following:
Version identifier: 126.96.36.199 | 2020-11-10 | 9bedb6d68
Parallel mode: none, using 1 thread.
I don’t understand why the value of 4 that I provided turns into 1.
I would like to run CPLEX in parallel mode with more than one thread.
Thanks in advance.
Obs: I have CPLEX Optimization Studio v20.1 installed which I got through an academic license.
I am running Julia on version 1.7.3, JuMP on version 0.21.10 and CPLEX on version 0.7.8.
Not sure what is going on here, but maybe you could try setting this CPLEX parameter too?
Did you launch Julia with a single thread or several?
Yes, I did try to set the CPXPARAM_Parallel parameters as well, but it didn’t work either.
I think the answer is here.
I am passing a custom callback function to CPLEX for handling both lazy constraints and cuts.
According to the link, apparently CPLEX automatically turns off multi-threading when given callbacks.
Did this warning trigger?
Perhaps CPLEX started automatically turning off multithreading with callbacks.
But yes, you cannot use threading if you have a callback. The underlying problem is that callbacks from Julia into C are not thread safe, so there is no way to implement this.
First of all, thank you, Guillaume and Oscar.
No, the warning is not triggered. I guess MOI gets the number of threads already forced to one and hence no warning.
Indeed when I run the model with no callback I am able to set the number of threads as I please.
callbacks from Julia into C are not thread safe
Is this specific to Julia? Is it the same for other programming languages?