Skip to content

Commit 39777f6

Browse files
committed
Use self communicator to prevent communicating with oneself
Thanks to @AnatoleStorck for the fix!
1 parent 8779485 commit 39777f6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

yt/frontends/ramses/data_structures.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from yt.utilities.cython_fortran_utils import FortranFile as fpu
1919
from yt.utilities.lib.cosmology_time import t_frw, tau_frw
2020
from yt.utilities.on_demand_imports import _f90nml as f90nml
21-
from yt.utilities.parallel_tools.parallel_analysis_interface import communication_system
2221
from yt.utilities.physical_constants import kb, mp
2322

2423
from .definitions import (
@@ -681,12 +680,14 @@ def _identify_base_chunk(self, dobj):
681680

682681
# In case of MPI parallelism, we need to keep the intersection
683682
# of all domains across all ranks
684-
comm = communication_system.communicators[-1]
685-
idomains = {dom.domain_id for dom in domains}
686-
idomains = comm.comm.allreduce(set(idomains), op=lambda a, b: a & b)
683+
if self.comm.size > 1:
684+
idomains = {dom.domain_id for dom in domains}
685+
idomains = self.comm.comm.allreduce(
686+
set(idomains), op=lambda a, b: a & b
687+
)
687688

688-
# Keep domains that every rank has
689-
domains = [dom for dom in domains if dom.domain_id in idomains]
689+
# Keep domains that every rank has
690+
domains = [dom for dom in domains if dom.domain_id in idomains]
690691

691692
subsets = [
692693
RAMSESDomainSubset(

0 commit comments

Comments
 (0)