We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the code below, the seed should be set to 10 no matter what order these threads are executed.
Code:
import threading import random import cupy SEED = 10 def func_seed(): cupy.random.seed(SEED) def func_get_random_state(): cupy.random.get_random_state() def test(): procs = [ threading.Thread(target=func_seed), threading.Thread(target=func_get_random_state), threading.Thread(target=func_get_random_state), threading.Thread(target=func_get_random_state), threading.Thread(target=func_get_random_state), threading.Thread(target=func_get_random_state), threading.Thread(target=func_get_random_state), ] random.shuffle(procs) for p in procs: p.start() #p.join() # this hides the problem for p in procs: p.join() actual = cupy.random.uniform() cupy.random.seed(SEED) expected = cupy.random.uniform() print("Expected: {}".format(expected)) print("Actual : {}".format(actual)) test()
Result:
Expected: 0.6320792449063122 Actual : 0.41662013290707867
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the code below, the seed should be set to 10 no matter what order these threads are executed.
Code:
Result:
The text was updated successfully, but these errors were encountered: