format ( task, worker, i )) # Send out the tasks asynchronously. is_master (): raise RuntimeError ( "Master node told to await jobs." ) status = MPI. rank = 0 def wait ( self ): """ If this isn't the master process, wait for instructions. " "Need at least two." ) def is_master ( self ): """ Is the current process the master? """ return self. ![]() size = 0 : raise ValueError ( "Tried to create an MPI pool, but there " "was only one MPI process available. COMM_WORLD if comm is None else comm self. """ def _init_ ( self, comm = None, debug = False, loadbalance = False ): if MPI is None : raise ImportError ( "Please install mpi4py" ) self. :param loadbalance: (optional) if ``True`` and ntask > Ncpus, tries to loadbalance by sending out one task to each cpu first and then sending out the rest as the cpus get done. ![]() :param debug: (optional) If ``True``, print out a lot of status updates at each step. :param comm: (optional) The ``mpi4py`` communicator. That being said, this pool is fairly general and it could be used for other purposes. The pool only support the :func:`map` method at the moment because this is the only functionality that emcee needs. This pool will let you run emcee without shared memory, letting you use much larger machines with emcee. MPI is an API for distributed memory parallelism. ![]() function = function def _error_function ( task ): raise RuntimeError ( "Pool was sent tasks before being told what " "function to apply." ) class MPIPool ( object ): """ A pool that distributes tasks over a set of MPI processes. try : from mpi4py import MPI MPI = MPI except ImportError : MPI = None class _close_pool_message ( object ): def _repr_ ( self ): return "" class _function_wrapper ( object ): def _init_ ( self, function ): self. #!/usr/bin/env python # -*- coding: utf-8 -*- from _future_ import ( division, print_function, absolute_import, unicode_literals ) _all_ = # If mpi4py is installed, import it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |