Skip to content

Commit

Permalink
Change to entropy for generic use between np and randomgen
Browse files Browse the repository at this point in the history
  • Loading branch information
leonfoks committed Sep 25, 2023
1 parent c776943 commit bec3076
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions geobipy/src/base/MPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_prng(timeFunction, seed=None, world=None):
if seed is None:
bit_generator = PCG64DXSM()
with open('seed.pkl', 'wb') as f:
pickle.dump(bit_generator.state['state']['state'], f)
pickle.dump(bit_generator.seed_seq.entropy, f)
else:
if isinstance(seed, str):
with open(seed, 'rb') as f:
Expand All @@ -196,7 +196,7 @@ def get_prng(timeFunction, seed=None, world=None):
if seed is None:
bit_generator = PCG64DXSM()
# Broadcast the seed to all ranks.
seed = world.bcast(bit_generator.state['state']['state'], root=0)
seed = world.bcast(bit_generator.seed_seq.entropy, root=0)
else:
if isinstance(seed, str):
with open(seed, 'rb') as f:
Expand All @@ -206,7 +206,7 @@ def get_prng(timeFunction, seed=None, world=None):

if world.rank == 0:
with open('seed.pkl', 'wb') as f:
pickle.dump(bit_generator.state['state']['state'], f)
pickle.dump(bit_generator.seed_seq.entropy, f)

bit_generator = bit_generator.jumped(world.rank)

Expand Down

0 comments on commit bec3076

Please sign in to comment.