Skip to content

Commit 101c22e

Browse files
committed
Parallel reduce which domains should be read
For RAMSES datasets, each MPI rank may have already indexed fully part of the domains, leading to different chunks across MPI ranks. This means that we can do an MPI reduction over which domains should be read to get the most specific subset of domains, but also to ensure that all ranks have the same list of domains when chunking.
1 parent 6897fdd commit 101c22e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

yt/frontends/ramses/data_structures.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
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
2122
from yt.utilities.physical_constants import kb, mp
2223

2324
from .definitions import (
@@ -678,6 +679,15 @@ def _identify_base_chunk(self, dobj):
678679
mylog.info("Identified %s intersecting domains", len(domains))
679680
base_region = getattr(dobj, "base_region", dobj)
680681

682+
# In case of MPI parallelism, we need to keep the intersection
683+
# 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)
687+
688+
# Keep domains that every rank has
689+
domains = [dom for dom in domains if dom.domain_id in idomains]
690+
681691
subsets = [
682692
RAMSESDomainSubset(
683693
base_region,

0 commit comments

Comments
 (0)