[docs]classMPIService:""" Interface for MPI Communication context. This class will also emulate MPI Communication context in single node context. """def__init__(self,comm=None):self._mpi=MPIModule("mpi4py.MPI")self._comm=commorself._mpi.COMM_WORLD
[docs]classMPIModule(MockModule):""" Module provider of the MPI interface. """@property@functools.cachedefCOMM_WORLD(self):if(any("mpi"inkey.lower()forkeyinos.environ)and"BSB_IGNORE_PARALLEL"notinos.environ):raiseDependencyError("MPI runtime detected without parallel support."+" Please install with `pip install bsb[parallel]`."+" Set `BSB_IGNORE_PARALLEL` to ignore this error.")returnNone