-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Issue in serializing RandomDevice objects #16451
Comments
The "not working" part is expected. On the current master, while it does not error out or segfault, the return value is wrong (it returns a 0). Changing issue description to reflect the correct issue. |
@amitmurthy thanks. That's largely what I expected. However, I am a bit confused: if # this works fine
a = 1
@assert 10000 == @parallel (+) for _ in 1:10000 a end |
In my local testing, sometimes I see a silent failure, i.e., no exceptions but the returned value is wrong, an sometimes an error due to a faulty deserialization of |
The issue here is that Serializing a RandomDevice() throws an exception as expected:
However one that has been used to generate a random number just returns a 0 after deserialization.
Will submit a PR. |
Fix serialization for RandomDevice. Closes #16451.
The following incantation may produce segmentation faults:
I've reproduced this so far on three systems:
Main development laptop
Output
Crusty old laptop
Raspberry Pi 2
Other notes
If you omit the initial call to
rand(rng)
, the following error is produced instead of the segmentation fault:Also, if
@everywhere rng = RandomDevice()
is used instead, everything happens as expected.I realize that omitting the
@everywhere
is probably bad form, although it hasn't caused trouble for me until now (I previously thought it only applied to functions).I understand that this is most likely an issue of telling the user where they've messed up, not making the broken code run.
Also I apologies for the long post. Do I need to shorten it?
The text was updated successfully, but these errors were encountered: