jump-dev / Gurobi.jl

A Julia interface to the Gurobi Optimizer
http://www.gurobi.com/
MIT License
221 stars 80 forks source link

Gruboi.jl does not handle out-of-memory error #542

Closed etiennedeg closed 7 months ago

etiennedeg commented 7 months ago

I'm solving a very huge linear program.

I'm having the same error message than in this post, due to a lack of memory. Gruobi.jl does not fail nicely as it does not seem to handle this case.


Academic license - for non-commercial use only - expires 2024-08-24
Gurobi Optimizer version 9.1.1 build v9.1.1rc0 (linux64)
Thread count: 4 physical cores, 4 logical processors, using up to 4 threads
Optimize a model with 196980 rows, 1509352 columns and 6419632 nonzeros
Model fingerprint: 0xd381c003
Coefficient statistics:
  Matrix range     [1e+00, 1e+00]
  Objective range  [0e+00, 0e+00]
  Bounds range     [1e+00, 1e+00]
  RHS range        [1e+00, 1e+00]

Concurrent LP optimizer: dual simplex and barrier
Showing barrier log only...

Presolve removed 0 rows and 0 columns (presolve time = 6s) ...
Presolve removed 583 rows and 0 columns
Presolve time: 10.09s
Presolved: 196397 rows, 1509352 columns, 6392226 nonzeros

Elapsed ordering time = 5s
Elapsed ordering time = 10s
Elapsed ordering time = 15s
Elapsed ordering time = 20s
...
Elapsed ordering time = 755s
Elapsed ordering time = 760s
Elapsed ordering time = 765s
Elapsed ordering time = 770s
Elapsed ordering time = 775s
Elapsed ordering time = 780s
Elapsed ordering time = 785s
Elapsed ordering time = 790s
Elapsed ordering time = 795s
Ordering time: 800.76s

Barrier statistics:
 AA' NZ     : 2.752e+07
 Factor NZ  : 9.466e+09 (roughly 80.0 GBytes of memory)
 Factor Ops : 7.679e+14 (roughly 50000 seconds per iteration)
 Threads    : 3

Barrier performed 0 iterations in 890.32 seconds
Error termination

Stopped in 0 iterations and 1000.06 seconds
Out of memory

User-callback calls 281800, time in user-callback 1.00 sec
1 <= valueP[] <= 17

Stacktrace:
  [1] _raw_status(model::Gurobi.Optimizer)
  @ Gurobi ~/.julia/packages/Gurobi/yvF0V/src/MOI_wrapper/MOI_wrapper.jl:2789
  [2] get
    @ ~/.julia/packages/Gurobi/yvF0V/src/MOI_wrapper/MOI_wrapper.jl:2800 [inlined]
  [3] get(model::Gurobi.Optimizer, attr::MathOptInterface.DualStatus)
    @ Gurobi ~/.julia/packages/Gurobi/yvF0V/src/MOI_wrapper/MOI_wrapper.jl:2852
  [4] optimize!(model::Gurobi.Optimizer)
    @ Gurobi ~/.julia/packages/Gurobi/yvF0V/src/MOI_wrapper/MOI_wrapper.jl:2694
  [5] optimize!
    @ ~/.julia/packages/MathOptInterface/3JqTJ/src/Bridges/bridge_optimizer.jl:380 [inlined]
  [6] optimize!
    @ ~/.julia/packages/MathOptInterface/3JqTJ/src/MathOptInterface.jl:85 [inlined]
  [7] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/3JqTJ/src/Utilities/cachingoptimizer.jl:316
  [8] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
    @ JuMP ~/.julia/packages/JuMP/027Gt/src/optimizer_interface.jl:448
  [9] optimize!
    @ ~/.julia/packages/JuMP/027Gt/src/optimizer_interface.jl:409 [inlined]
 [10] mainXY(g::SimpleGraph{Int64}, h::SimpleGraph{Int64}, doTwo::Bool, timeout::Int64; relaxation::Bool)
    @ Main ~/Bureau/julia/MCES/GraphMatching/SI_XY.jl:49
 [11] mainXY
    @ ~/Bureau/julia/MCES/GraphMatching/SI_XY.jl:17 [inlined]
 [12] main()
    @ Main ~/Bureau/julia/MCES/GraphMatching/benchmarkPLNE copy 2.jl:88
 [13] top-level scope
    @ ~/Bureau/julia/MCES/GraphMatching/benchmarkPLNE copy 2.jl:189
Some type information was truncated. Use `show(err)` to see complete types.
odow commented 7 months ago

Can you provide a reproducible example? What is the full error?

From what I can tell, the error codes should be between 1 and 17: https://www.gurobi.com/documentation/11.0/refman/optimization_status_codes.html#sec:StatusCodes

odow commented 7 months ago

Ah. This might be because you're using an old version of Gurobi: Gurobi Optimizer version 9.1.1. Please update to a more recent version of Gurobi.

We should be able to detect and support out of memory return codes: https://github.com/jump-dev/Gurobi.jl/pull/398

odow commented 7 months ago

Any update?

etiennedeg commented 7 months ago

Sorry for the lack of reply, I did not have the time to test upgrading Gurobi, but this is probably the reason, I will close, and reopen if I ever get the same behavior after updating.