Closed v-adamgrofe closed 1 year ago
Dear @v-adamgrofe thanks for filing the bug report and even providing a helpful solution. We will provide a bugfix ASAP. :)
@v-adamgrofe Sorry for the late reply - I just opened a branch associated with this MR and will fix the problem ASAP. In the end, me and @stknecht decided to just make that part of the code serial, since the MPS initialization will never be an intensive part of the code.
We will keep you posted!
@AlbertoBaiardi No problem. I have already implemented the same solution on my end.
Description of Issue:
Boost's random library is not thread safe, but the random guess loop is multithreaded (here at line 72). Given that the dmrg_random struct has static members for the random number generator means that only one is created, and simultaneously being used by multiple threads.
Symptoms:
The problem here was largely only observed when going to many threads (~44).
Proposed Solutions for Discussion:
The latter solution would likely come with a performance cost since all of the threads are trying to lock the engine at once. The former solution may have a minimal cost in terms of memory because the dmrg_random struct is instantiated for each thread but would likely not experience a hit in terms of performance.