def __init__(self): self.world = get_comm_world() self.world_ranks = list(range(self.world.size)) # make engine and client comm self.client_rank = 0 self.engine_ranks = [i for i in self.world_ranks if i != self.client_rank] # make engines intracomm (Context._base_comm): Engine.INTERCOMM = initial_comm_setup() assert self.world.rank != self.client_rank while True: msg = Engine.INTERCOMM.recv(source=self.client_rank) val = self.parse_msg(msg) if val == 'kill': break Engine.INTERCOMM.Free()
def __init__(self): self.world = get_comm_world() self.world_ranks = list(range(self.world.size)) # make engine and client comm self.client_rank = 0 self.engine_ranks = [ i for i in self.world_ranks if i != self.client_rank ] # make engines intracomm (Context._base_comm): Engine.INTERCOMM = initial_comm_setup() assert self.world.rank != self.client_rank while True: msg = Engine.INTERCOMM.recv(source=self.client_rank) val = self.parse_msg(msg) if val == 'kill': break Engine.INTERCOMM.Free()
def __init__(self, targets=None): if MPIContext.INTERCOMM is None: MPIContext.INTERCOMM = initial_comm_setup() assert get_world_rank() == 0 self.nengines = MPIContext.INTERCOMM.remote_size self.all_targets = list(range(self.nengines)) self.targets = self.all_targets if targets is None else sorted(targets) # make/get comms # this is the object we want to use with push, pull, etc' self._comm_from_targets = {} self.comm = self.make_subcomm(self.targets) if BaseContext._CLEANUP is None: BaseContext._CLEANUP = atexit.register(_shutdown, mpi, MPIContext.INTERCOMM, tuple(self.all_targets)) # local imports self._execute( "from functools import reduce; " "from importlib import import_module; " "import distarray.localapi; " "import distarray.localapi.mpiutils; " "import distarray.utils; " "from distarray.localapi.proxyize import Proxyize, Proxy; " "import numpy") self.context_key = self._setup_context_key() # setup proxyize which is used by context.apply in the rest of the # setup. cmd = "proxyize = Proxyize()" self._execute(cmd)
def __init__(self, targets=None): if MPIContext.INTERCOMM is None: MPIContext.INTERCOMM = initial_comm_setup() assert get_world_rank() == 0 self.nengines = MPIContext.INTERCOMM.remote_size self.all_targets = list(range(self.nengines)) self.targets = self.all_targets if targets is None else sorted(targets) # make/get comms # this is the object we want to use with push, pull, etc' self._comm_from_targets = {} self.comm = self.make_subcomm(self.targets) if BaseContext._CLEANUP is None: BaseContext._CLEANUP = atexit.register(_shutdown, mpi, MPIContext.INTERCOMM, tuple(self.all_targets)) # local imports self._execute("from functools import reduce; " "from importlib import import_module; " "import distarray.localapi; " "import distarray.localapi.mpiutils; " "import distarray.utils; " "from distarray.localapi.proxyize import Proxyize, Proxy; " "import numpy") self.context_key = self._setup_context_key() # setup proxyize which is used by context.apply in the rest of the # setup. cmd = "proxyize = Proxyize()" self._execute(cmd)