-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random exception in python when using multiprocessing due to rdseed failure #26
Comments
The fix you're suggesting is
instead of just |
Urgh, looking over some of the threads on this around the internet. what a gigantic mess. There's something deeply wrong when you have to workaround standard library functionality not doing what it's supposed to do. |
Yeah, basically, for the immediate fix. And don't I know it. This really should be handled by the standard library, why it isn't is super annoying. |
I mean technically it is allowed to except in the standard, but the failure mode really should be more graceful here. |
@alexisshaw Could you try pip installing this file into the relevant environment, and confirming that it makes the problem go away? |
I'm going to move forward with publishing a release with this fix to avoid holding up other bug fixes. |
When I am running a large number of samples simulations simultaneously using stim in a massively multi-process environment (python not supporting multi-threading, I use multi-process computation using python multithreading starmap), this happens semi-randomly when I run a multi-threaded simulation, see the stack trace below:
This seems to be related to a multi-threading bug in libstdc++, so perhaps using the approach used by the google cloud c++ api would be a good approach. See:
googleapis/google-cloud-cpp-common#208
googleapis/google-cloud-cpp-common#272
seeing as the call to random_device is only done once per process in PYBIND_SHARED_RNG(), it is probably safe performance-wise to use the second fix, as the performance regression should be very minor.
This seems to be related to the shared rdseed buffer in certain Intel cpus.
The text was updated successfully, but these errors were encountered: