Skip to content

Commit

Permalink
Add note on thread-safety to README (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Oct 29, 2023
1 parent fa6247b commit a17bcfd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,20 @@ for a full list of the available options.

The C API can be accessed via `HiGHS.Highs_xxx` functions, where the names and
arguments are identical to the C API.

## Threads

HiGHS uses a global scheduler that is shared between threads.

Before changing the number of theads using `MOI.Threads()`, you must call
`Highs_resetGlobalScheduler(1)`:
```julia
using JuMP, HiGHS
model = Model(HiGHS.Optimizer)
Highs_resetGlobalScheduler(1)
set_attribute(model, MOI.NumberOfThreads(), 1)
```

If modifying the number of HiGHS threads across different Julia threads, be sure
to read the docstring of `Highs_resetGlobalScheduler`. In particular, resetting
the scheduler is not thread-safe.

0 comments on commit a17bcfd

Please sign in to comment.