Environments and Thread Safety
AnsweredI know that Gurobi environments are not thread safe. But is it safe to create and solve models from a thread other than the thread where the environment was created, as long as only one thread at a time is working with the environment and its data? I'm hoping to be able to create multiple environments in the main thread, then create and solve models on worker threads, one worker thread per environment. Each environment and its models would be associated with exactly one worker thread at a time. Is this safe?
My simple tests all succeeded, but we all know simple tests often don't tell the whole story. This is in .NET.
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Although your setup sounds like it should work, it is indeed possible that the simple test all succeeded because they are too simple.
It would be safer to create an environment on each thread and then just feed it with data from the main thread.
0
Post is closed for comments.
Comments
2 comments