pybnb icon indicating copy to clipboard operation
pybnb copied to clipboard

Multihreading instead of multiprocessing

Open DarioSimonato opened this issue 2 years ago • 1 comments

Hi there, Will there ever be a multithreading support instead of the already implemented multiprocess version? This may be very useful if multiple nodes share a child, and the bound() function makes use of all parents infos.

DarioSimonato avatar Jul 21 '22 10:07 DarioSimonato

Hi @DarioSimonato, sorry to get back to you so late. No, I haven't put much consideration into multi-threading support as I would expect the objective() and bound() function calls to be inherently CPU bound, which is exactly the type of multi-threaded computation that will not work well with Python (due to the GIL).

With that being said, the TSP examples highlight the use of the NestedSolver to perform additional nested branch-and-bound processing of each node received by a process. There could be some opportunity there to allow an additional level of parallelism at the local CPU-node level (presumably by setting up another MPI communicator heirarchy). However, the NestedSolver only supports serial processing at this time.

ghackebeil avatar Aug 16 '22 19:08 ghackebeil