diff --git a/pypolychord/polychord.py b/pypolychord/polychord.py index d93e02e9..e8720137 100644 --- a/pypolychord/polychord.py +++ b/pypolychord/polychord.py @@ -258,16 +258,16 @@ def make_resume_file(settings, loglikelihood, prior): sendbuf = np.array(lives).flatten() sendcounts = np.array(comm.gather(len(sendbuf))) if rank == 0: - recvbuf = np.empty(sum(sendcounts), dtype=int) + recvbuf = np.empty(sum(sendcounts)) else: recvbuf = None comm.Gatherv(sendbuf=sendbuf, recvbuf=(recvbuf, sendcounts), root=0) - lives = np.reshape(sendbuf, (len(settings.cube_samples), len(lives[0]))) - else: - lives = np.array(lives) - if rank == 0: + if MPI: + lives = np.reshape(recvbuf, (len(settings.cube_samples), len(lives[0]))) + else: + lives = np.array(lives) with open(resume_filename,"w") as f: def write(var): var = np.atleast_1d(var)