-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use "threads" parameter without crashing #186
Comments
I can't reproduce this: julia> using JuMP
julia> using Cbc
julia> function main()
n = 15
m = 5
vecCost = [1115, 1042, 1052, 1059, 1071, 1075, 1089, 1034, 1021, 1027, 1009, 996, 1024, 1011, 907]
storesMatrix = Bool[1 1 0 0 0;
1 0 1 0 0;
1 0 0 1 0;
1 0 0 0 1;
1 0 0 0 0;
0 1 1 0 0;
0 1 0 1 0;
0 1 0 0 1;
0 1 0 0 0;
0 0 1 1 0;
0 0 1 0 1;
0 0 1 0 0;
0 0 0 1 1;
0 0 0 1 0;
0 0 0 0 1]
model = Model(Cbc.Optimizer)
set_optimizer_attribute(model, "seconds", 60)
set_optimizer_attribute(model, "loglevel", 0)
set_optimizer_attribute(model, "ratioGap", 0.0001)
set_optimizer_attribute(model, "threads", 4)
@variable(model, x[1:n], Bin)
@objective(model, Min, sum(vecCost[i] * x[i] for i in 1:n))
@constraint(model, column_con1[j in 1:m], sum(storesMatrix[i, j] * x[i] for i in 1:n) == 1)
JuMP.optimize!(model)
for i in 1:n
println(JuMP.value(x[i]))
end
end
main (generic function with 1 method)
julia> main()
0.0
0.0
1.0
0.0
0.0
1.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.0
julia>
(cbc) pkg> st
Status `/private/tmp/cbc/Project.toml`
[9961bab8] Cbc v0.9.1
[4076af6c] JuMP v0.22.3 How are you starting Julia? What is |
I can reproduce on Windows. Seems it might be Windows specific, see https://discourse.julialang.org/t/cbc-solver-crashes-julia-with-multithreading/73859 |
I don't have a Windows machine to debug. At this point I would encourage you instead to use HiGHS.jl. It's actively developed, and has similar or better performance to Cbc. |
Sure. Thanks! I’m using HiGHS now. |
I've confirmed that this is Windows-specific: #190. But this is unlikely to be resolved. If you are on Windows, don't use the |
Let's print a warning if we see windows users using threads? |
Done here: #192 |
Cbc cannot be used on Windows with multiple threads: <jump-dev/Cbc.jl#186> The `threads` argument is already disabled on Windows since Cbc v1.0.0: <jump-dev/Cbc.jl#192> We cannot use Cbc v1.0.0 at the moment because it requires MathOptInterface v1 and we require MathOptInterface v0.10.9. Removal of MathOptInterface from FlexPlan.jl dependencies is to be done: <#121 (comment)>
Closing because this is unlikely to be fixed and Cbc.jl disables threading on Windows. |
I have been using JuMP and Cbc for a couple of years now. It's fantastic. However, I recently upgraded to the latest version of Julia and latest version of JuMP and Cbc. After upgrading my models would not run. In fact, Julia would just crash every time.
I am using the following packages on Julia 1.7.1 (current stable release). {edit: Hardware is AMD 3900x CPU, mentioning in case it's a problem that isn't seen on Intel processors.}
[9961bab8] Cbc v0.9.1
[60bf3e95] GLPK v0.15.2
[4076af6c] JuMP v0.22.2
I've spent some time troubleshooting the problem. It looks like I cannot use the "threads" parameter. If I comment out that line, then the code runs.
Here is a working example of what I am testing to isolate the problem. As you can see, I have commented out the line that attempts to set the "threads" parameter.
This code does work:
This code does not work:
I have also tried setting it to 1 thread. It just doesn't seem to like the parameter being used at all.
The text was updated successfully, but these errors were encountered: