Thread number of a callback in a multithreaded parallel MIP run and other queries on thread safety
Hello,
I have a separation routine that takes the current fractional xbar and runs a user/lazy cut separation. Suppose this is called from, say, thread 0 and also parallelly from thread 1, I would like to query this thread number and use that as an index in my separation routine. Additionally, the added cuts could be locally valid or globally valid.
What is the thread-safe way to accomplish this? Are there some guidelines that can be provided about what Gurobi API calls are safe to make from within a multithreaded callback subroutine?
I am curious about the following in the documentation page
https://docs.gurobi.com/projects/optimizer/en/current/reference/c/logging.html#c.GRBsetcallbackfunc :
When solving a model using multiple threads, the user callback is only ever called from a single thread, so you don’t need to worry about the thread-safety of your callback.
I do not understand what the above means. Could it please be clarified what this means exactly in light of my requirement to run parallel separations in the MIP tree?
CPLEX seems to expose the following via an information callback: CPX_CALLBACK_INFO_MY_THREAD_NUM
Is there a Gurobi equivalent?
Thank you.
サインインしてコメントを残してください。
コメント
0件のコメント