diff --git a/src/utilities.py b/src/utilities.py index 28dc5a6ba4f50362e4ac8f0732eff321de3247a5..8fe6f9901de6e667285aad70fe48139c901d8a28 100644 --- a/src/utilities.py +++ b/src/utilities.py @@ -18,6 +18,7 @@ import collections from functools import reduce from itertools import product +import pickle import numpy as np @@ -451,12 +452,7 @@ def check_MPI_equality(obj, comm): def _MPI_unique(obj, comm): - from collections.abc import Hashable - import pickle - objects = comm.allgather(obj) - if not isinstance(objects[0], Hashable) or isinstance(objects[0], np.random.SeedSequence): - objects = [pickle.dumps(oo) for oo in objects] - return len(set(objects)) == 1 + return len(set(comm.allgather(pickle.dumps(obj)))) == 1 def check_MPI_synced_random_state(comm):