Problem with concurrent calls to HiGHS solver (via JuMP) on Windows

Hi,

I wanted to report some crashes observed when solving concurrently (multi-thread) different LP problems via JuMP with HiGHS solver:

EXCEPTION_ACCESS_VIOLATION dans HighsTaskExecutor…

No crashes observed on Linux
No crashes observed with HiGHS.jl 1.19.0 (only observed with HiGHS.jl 1.20.1)
No crashes observed for sequential/successive JuMP solve calls.
No crashes observed if we specify a single threaded execution of HiGHS:

    model = direct_model(HiGHS.Optimizer())
    Highs_resetGlobalScheduler(1)
    set_attribute(model, MOI.NumberOfThreads(), 1)

I do not have a MWE at the moment and only report this for information. We now do specify a single threaded execution of the HiGHS solver.

This is going to be very hard to debug without a reproducible example.

  • How were you multithreading in Julia?
  • Did you set any parameters for HiGHS?
  • Is this consistently repeatable on Windows?
  • Do you call Highs_resetGlobalScheduler at any point?

I do not really think that it is possible without a proper MWE.

Nevertheless, I though that it could be interesting to report this if some other user encounters the same kind of problem : the explicit single execution of HiGHS did solve our problem.
It may also ring a bell for the HiGHS or HiGHS.jl developper because it seems that it could be related to nested parallelism issues on Windows.

I use the OhMyThread.jl tmap function and the JuMP model are created for each TransitionProblems instances

function parallel_solve_one_pdt(ep::EtudeParameters, pdt::Int, future_bf::BellmanFunction1D,)::Vector{BellmanFunction1D}
    n_scenario = scenario_number(ep)
    scenario_chunks = chunks(1:n_scenario; n=Threads.nthreads())

    function process_chunk(scenario_chunk)
        tps = TransitionProblems(ep, pdt, future_bf) #contains a JuMP model
        return [solve_one_pdt_one_scenario!(tps, ep, pdt, scenario) for scenario ∈ scenario_chunk]
    end

    scenario_chunks_bfs::Vector{Vector{BellmanFunction1D}} = OhMyThreads.tmap(process_chunk, scenario_chunks, scheduler=:static) #(one Vector{BellmanFunction1D} per task)
    scenario_bfs::Vector{BellmanFunction1D} = vcat(scenario_chunks_bfs...)    # -> gather to a single Vector{BellmanFunction1D}
    return scenario_bfs
end

Nothing fancy:

  model = direct_model(HiGHS.Optimizer())
  JuMP.set_silent(model)
  JuMP.set_string_names_on_creation(model, true)

Like I wrote above, adding

Highs_resetGlobalScheduler(1)
set_attribute(model, MOI.NumberOfThreads(), 1)

Seems to solve the pb.

The crash occurs at different time steps of the execution : it varies from one exec to the other (heisenbug)

No (not in the crashing configuration).

P.S. It is also tedious for me to assess because it only occurs on Windows laptops (coworkers) and I do not have a direct access to a Windows machine.