Skip to content

Commit

Permalink
update comment in post for exchange and pamc -- why we use allgather
Browse files Browse the repository at this point in the history
  • Loading branch information
yomichi committed Jun 5, 2023
1 parent 5e80013 commit 76a1319
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/py2dmat/algorithm/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def _prepare(self) -> None:
self.timer["run"]["exchange"] = 0.0

def _post(self) -> None:
Ts = self.betas if self.input_as_beta else 1.0/self.betas
if self.mpirank==0:
Ts = self.betas if self.input_as_beta else 1.0 / self.betas
if self.mpirank == 0:
print(f"start separateT {self.mpirank}")
sys.stdout.flush()
py2dmat.util.separateT.separateT(
Expand All @@ -261,7 +261,10 @@ def _post(self) -> None:
buffer_size=10000,
)
if self.mpisize > 1:
# NOTE: Some MPI environments (e.g., Intel 2021.8) has a bug in gather while allgather works
# NOTE:
# ``gather`` seems not to work with many processes (say, 32) in some MPI implementation.
# ``Gather`` and ``allgather`` seem to work fine.
# Since the performance is not so important here, we use ``allgather`` for simplicity.
best_fx = self.mpicomm.allgather(self.best_fx)
best_x = self.mpicomm.allgather(self.best_x)
best_istep = self.mpicomm.allgather(self.best_istep)
Expand Down
5 changes: 4 additions & 1 deletion src/py2dmat/algorithm/pamc.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ def _post(self) -> None:
continue
fout.write(line)
if self.mpisize > 1:
# NOTE: Some MPI environment (e.g., Intel 2021.8) has a bug in gather while allgather works
# NOTE:
# ``gather`` seems not to work with many processes (say, 32) in some MPI implementation.
# ``Gather`` and ``allgather`` seem to work fine.
# Since the performance is not so important here, we use ``allgather`` for simplicity.
best_fx = self.mpicomm.allgather(self.best_fx)
best_x = self.mpicomm.allgather(self.best_x)
best_istep = self.mpicomm.allgather(self.best_istep)
Expand Down

0 comments on commit 76a1319

Please sign in to comment.