Skip to content

Commit 53a7d96

Browse files
authored
Merge pull request #62 from issp-center-dev/fix.resample
fix resampling in pamc
2 parents 3f5c658 + b36398d commit 53a7d96

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/py2dmat/algorithm/pamc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,23 +422,29 @@ def _resample_fixed(self, weights: np.ndarray) -> None:
422422
ancestors = np.array(
423423
self.mpicomm.allgather(self.walker_ancestors)
424424
).flatten()
425+
fxs = np.array(self.mpicomm.allgather(self.fx)).flatten()
425426
else:
426427
xs = self.x
427428
ancestors = self.walker_ancestors
429+
fxs = self.fx
428430
self.x = xs[new_index, :]
429431
self.walker_ancestors = ancestors[new_index]
432+
self.fx = fxs[new_index]
430433
else:
431434
if self.mpisize > 1:
432435
inodes = np.array(self.mpicomm.allgather(self.inode)).flatten()
433436
ancestors = np.array(
434437
self.mpicomm.allgather(self.walker_ancestors)
435438
).flatten()
439+
fxs = np.array(self.mpicomm.allgather(self.fx)).flatten()
436440
else:
437441
inodes = self.inode
438442
ancestors = self.walker_ancestors
443+
fxs = self.fx
439444
self.inode = inodes[new_index]
440445
self.walker_ancestors = ancestors[new_index]
441446
self.x = self.node_coordinates[self.inode, :]
447+
self.fx = fxs[new_index]
442448

443449
def _prepare(self) -> None:
444450
self.timer["run"]["submit"] = 0.0

tests/pamc/ref.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
nprocs = 2
22
rank = 1
3-
step = 864
4-
walker = 88
5-
fx = 2.408215141110511e-14
6-
x1 = 1.5518424988092416e-07
3+
step = 526
4+
walker = 81
5+
fx = 4.917964222861798e-13
6+
x1 = -7.0128198485786e-07

0 commit comments

Comments
 (0)