I have some code using the DNC library where I perform analyses of multiple networks in different threads. This leads to errors in the analyses which do not appear when only one thread is used.
Some debugging lead me to ArrivalBoundDispatch.java and the arrivalbound classes. Singletons are used for doing the computations, and use setServerGraph(server_graph) and setConfiguration(configuration) to configure it, before calling computeArrivalBound. The issue is that if there are multiple threads, you might have the case that setServerGraph is executed by one thread, while another thread is still executing computeArrivalBound. I validated my theory by creating a new arrivalbound instance for each computation, resulting in no errors. ArrivalBoundCache, in its current implementation, is also not thread-safe.
Hence, I suggest to modify DNC library in order to use thread-safe data structures, and thus enable parallelization of (some) computations.
I have some code using the DNC library where I perform analyses of multiple networks in different threads. This leads to errors in the analyses which do not appear when only one thread is used.
Some debugging lead me to
ArrivalBoundDispatch.javaand the arrivalbound classes. Singletons are used for doing the computations, and usesetServerGraph(server_graph)andsetConfiguration(configuration)to configure it, before callingcomputeArrivalBound. The issue is that if there are multiple threads, you might have the case thatsetServerGraphis executed by one thread, while another thread is still executingcomputeArrivalBound. I validated my theory by creating a new arrivalbound instance for each computation, resulting in no errors.ArrivalBoundCache, in its current implementation, is also not thread-safe.Hence, I suggest to modify DNC library in order to use thread-safe data structures, and thus enable parallelization of (some) computations.