Dear Julia Users,
I was using @distributed to run 1000 replicates of simulations across 100 cores. How should I set the random seed across these cores to make simulation results reproducible? We need to make sure different cores start with a different seed and there are no replicates / overlap across different cores.
Thanks a lot!
A simple option is seed based on some function of your replicate index and myid()
:
using Distributed
@everywhere using Random
@everywhere Random.seed!(1000*replicate_idx + myid())
2 Likes
Thanks! It seems
@distributed for replicate_idx=1:1000
Random.seed!(replicate_idx)
...
end
should be fine no matter how many random procedures in each replicate of simulation. 
1 Like
Ah, I think I misunderstood: yes, if you have 1000 replicates that you’re sharding out across various processes, that should be the simplest option.