Skip to content

Commit

Permalink
make_resume_file() incompatible with MPI (#101)
Browse files Browse the repository at this point in the history
* no idea why recvbuf.dtype was int, and is only not empty for rank 0

* add optional dependency fortranformat for cube_samples

* minimal changed to pyproject toml to get optional dependencies to work

* toml typo

* version bump

* revert changes to pyproject.toml

---------

Co-authored-by: Will Handley <wh260@cam.ac.uk>
  • Loading branch information
AdamOrmondroyd and williamjameshandley committed Jan 9, 2024
1 parent 9751432 commit bd24bc7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pypolychord/polychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bd24bc7

Please sign in to comment.