-
Notifications
You must be signed in to change notification settings - Fork 15
Thread Safety #62
Copy link
Copy link
Closed
Description
When I call the PATH solver from multiple threads at the same time, I reliably run into a segfault. Is there a workaround to avoid this?
Here is an MWE (make sure to start the Julia REPL with multiple threads):
using PATHSolver: PATHSolver
using SparseArrays: SparseArrays
PATHSolver.c_api_License_SetString("2830898829&Courtesy&&&USR&45321&5_1_2021&1000&PATH&GEN&31_12_2025&0_0_0&6000&0_0")
function solve_example()
M = convert(
SparseArrays.SparseMatrixCSC{Cdouble,Cint},
SparseArrays.sparse([
0 0 -1 -1
0 0 1 -2
1 -1 2 -2
1 2 -2 4
]),
)
status, z, info = PATHSolver.solve_mcp(
M,
Float64[2, 2, -2, -6],
fill(0.0, 4),
fill(10.0, 4),
[0.0, 0.0, 0.0, 0.0];
output = "yes"
)
end
Threads.@threads for _ in 1:10
solve_example()
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels