Skip to content

Commit

Permalink
Merge branch 'PolyChord:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamOrmondroyd authored Feb 17, 2023
2 parents 2f0c339 + 3084a81 commit b7eaf04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ EXAMPLES = gaussian pyramidal rastrigin twin_gaussian random_gaussian himmelblau
PROGRAMS = polychord_fortran polychord_CC polychord_CC_ini

# Directories
SRC_DIR = $(PWD)/src
SRC_DIR = $(CURDIR)/src
DRIVERS_DIR = $(SRC_DIR)/drivers
POLYCHORD_DIR = $(SRC_DIR)/polychord
LIKELIHOOD_DIR = $(PWD)/likelihoods
LIKELIHOOD_DIR = $(CURDIR)/likelihoods
EXAMPLES_DIR = $(LIKELIHOOD_DIR)/examples
BIN_DIR = $(PWD)/bin
LIB_DIR = $(PWD)/lib
BIN_DIR = $(CURDIR)/bin
LIB_DIR = $(CURDIR)/lib
export DRIVERS_DIR POLYCHORD_DIR PYPOLYCHORD_DIR LIKELIHOOD_DIR EXAMPLES_DIR BIN_DIR LIB_DIR

# Whether to use MPI
Expand Down
7 changes: 4 additions & 3 deletions pypolychord/polychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def make_resume_file(settings, loglikelihood, prior):
rank = comm.Get_rank()
size = comm.Get_size()
except ImportError:
MPI = False
rank = 0
size = 1

Expand All @@ -245,17 +246,17 @@ def make_resume_file(settings, loglikelihood, prior):
nDerived = len(derived)
lives.append(np.concatenate([cube,theta,derived,[logL_birth, logL]]))

try:
if MPI:
sendbuf = np.array(lives).flatten()
sendcounts = np.array(comm.gather(len(sendbuf)))
if rank == 0:
recvbuf = np.empty(sum(sendcounts), dtype=int)
else:
recvbuf = None
comm.Gatherv(sendbuf=sendbuf, recvbuf=(recvbuf, sendcounts), root=root)
comm.Gatherv(sendbuf=sendbuf, recvbuf=(recvbuf, sendcounts), root=0)

lives = np.reshape(sendbuf, (len(settings.cube_samples), len(lives[0])))
except NameError:
else:
lives = np.array(lives)

if rank == 0:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run(self):
env["DEBUG"] = "1"

BASE_PATH = os.path.dirname(os.path.abspath(__file__))
env["PWD"] = BASE_PATH
env["CURDIR"] = BASE_PATH
env.update({k : os.environ[k] for k in ["CC", "CXX", "FC"] if k in os.environ})
subprocess.check_call(["make", "-e", "libchord.so"], env=env, cwd=BASE_PATH)
if not os.path.isdir("pypolychord/lib/"):
Expand Down

0 comments on commit b7eaf04

Please sign in to comment.