Skip to content

Commit b83b50f

Browse files
committed
Fix SMP bug
1 parent c3c2df5 commit b83b50f

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

cosmosis/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ def run_cosmosis(ini, pool=None, pipeline=None, values=None, priors=None, overri
430430
run_count_total = pipeline.run_count
431431
run_count_ok_total = pipeline.run_count_ok
432432
else:
433-
run_count_total = pool.comm.allreduce(pipeline.run_count)
434-
run_count_ok_total = pool.comm.allreduce(pipeline.run_count_ok)
433+
run_count_total = pool.allreduce(pipeline.run_count)
434+
run_count_ok_total = pool.allreduce(pipeline.run_count_ok)
435435

436436
if is_root and sampler_name != 'test':
437437
logs.overview(f"Total posterior evaluations = {run_count_total} across all processes")

cosmosis/runtime/mpi_pool.py

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def send(self, data, dest=0, tag=0):
114114
def recv(self, source=0, tag=0):
115115
return self.comm.recv(source, tag)
116116

117+
def allreduce(self, data):
118+
return self.comm.allreduce(data)
119+
117120
def close(self):
118121
if self.is_master():
119122
for i in range(1, self.size):

cosmosis/runtime/pipeline.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1307,11 +1307,11 @@ def _set_likelihood_names_from_block(self, data):
13071307
self.likelihood_names = likelihood_names
13081308

13091309
# Tell the user what we found.
1310-
logs.overview("Using likelihooods from first run:")
1310+
logs.noisy("Using likelihooods from first run:")
13111311
for name in self.likelihood_names:
1312-
logs.overview(f" - {name}")
1312+
logs.noisy(f" - {name}")
13131313
if not self.likelihood_names:
1314-
logs.overview(" - (None found)")
1314+
logs.noisy(" - (None found)")
13151315

13161316
def _extract_likelihoods(self, data):
13171317
"Extract the likelihoods from the block"

cosmosis/runtime/process_pool.py

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def bcast(self, data):
2525
def gather(self, data):
2626
return self.data
2727

28+
def allreduce(self, data):
29+
return self.data
2830

2931
def __enter__(self):
3032
return self

0 commit comments

Comments
 (0)