# sfepy.base.multiproc_mpi module

Multiprocessing functions.

class sfepy.base.multiproc_mpi.MPIFileHandler(filename, mode=4, comm=<mpi4py.MPI.Intracomm object>)

  MPI file class for logging process communication.

  close()

    Tidy up any resources used by the handler.

    This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.

  emit(record)

    Emit a record.

    If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

class sfepy.base.multiproc_mpi.MPILogFile(comm, filename, mode)
  close()
  sync()
  write(msg)

class sfepy.base.multiproc_mpi.RemoteDict(name, mutable=False)

  Remote dictionary class - slave side.

  get(key, default=None)
  keys()
  update(other)

class sfepy.base.multiproc_mpi.RemoteDictMaster(name, mutable=False, soft_set=False, *args)

  Remote dictionary class - master side.

  remote_get(key, slave)
  remote_get_in(key, slave)
  remote_get_keys(slave)
  remote_get_len(slave)
  remote_set(data, slave, mutable=False)

class sfepy.base.multiproc_mpi.RemoteInt(remote_dict, value=None)

  Remote intiger class, data saved in RemoteDict.

  class IntDesc
  value

class sfepy.base.multiproc_mpi.RemoteLock

  Remote lock class - lock and unlock restricted access to the master.

  acquire()
  release()

class sfepy.base.multiproc_mpi.RemoteQueue(name)

  Remote queue class - slave side.

  get()
  put(value)

class sfepy.base.multiproc_mpi.RemoteQueueMaster(name, mode='fifo', *args)

  Remote queue class - master side.

  clean()
  get()
  static get_gdict_key(name)
  put(value)
  remote_get(slave)
  remote_put(value, slave)

sfepy.base.multiproc_mpi.cpu_count()

  Get the number of MPI nodes.

sfepy.base.multiproc_mpi.enum(*sequential)

sfepy.base.multiproc_mpi.get_dict(name, mutable=False, clear=False, soft_set=False)

  Get the remote dictionary.

sfepy.base.multiproc_mpi.get_int_value(name, init_value=0)

  Get the remote integer value.

sfepy.base.multiproc_mpi.get_logger(log_filename='multiproc_mpi.log')

  Get the MPI logger which log information into a shared file.

sfepy.base.multiproc_mpi.get_queue(name)

  Get the queue.

sfepy.base.multiproc_mpi.get_slaves()

  Get the list of slave nodes

sfepy.base.multiproc_mpi.is_remote_dict(d)

  Return True if ‘d’ is RemoteDict or RemoteDictMaster instance.

sfepy.base.multiproc_mpi.master_loop()

  Run the master loop - wait for requests from slaves.

sfepy.base.multiproc_mpi.master_send_continue()

  Send ‘continue’ to all slaves.

sfepy.base.multiproc_mpi.master_send_task(task, data)

  Send task to all slaves.

sfepy.base.multiproc_mpi.set_logging_level(log_level='info')

sfepy.base.multiproc_mpi.slave_get_task(name='')

  Start the slave nodes.

sfepy.base.multiproc_mpi.slave_task_done(task='')

  Stop the slave nodes.

sfepy.base.multiproc_mpi.tags

  alias of `Enum`

sfepy.base.multiproc_mpi.wait_for_tag(wtag, num=1)