exarl.network.simple_comm

Module Contents

Classes

ExaSimple

This class is built as a simple wrapper around mpi4py.

Attributes

workflow

threads

exarl.network.simple_comm.workflow
exarl.network.simple_comm.threads = False
class exarl.network.simple_comm.ExaSimple(comm=MPI.COMM_WORLD, procs_per_env=1, num_learners=1)

Bases: exarl.base.comm_base.ExaComm

This class is built as a simple wrapper around mpi4py. Instances are a type of ExaComm which is used to send, recieve, and synchronize data across the participating ranks.

Variables
  • MPI (MPI) – MPI class used to access comm, sizes, and rank

  • comm (MPI.comm) – The underlying communicator

  • size (int) – Number of processes in the communicator

  • rank (int) – Rank of the current process

Parameters
  • comm (MPI Comm, optional) – The base MPI comm to split into sub-comms. If set to None will default to MPI.COMM_WORLD

  • procs_per_env (int, optional) – Number of processes per environment (sub-comm)

  • num_learners (int, optional) – Number of learners (multi-learner)

MPI
send(self, data, dest, pack=False)

Point-to-point communication between ranks. Send must have matching recv.

Parameters
  • data (any) – Data to be sent

  • dest (int) – Rank within comm where data will be sent.

  • pack (int, optional) – Not used

recv(self, data, source=MPI.ANY_SOURCE)

Point-to-point communication between ranks. Send must have matching send.

Parameters
  • data (any) – Not used

  • dest (int) – Rank within comm where data will be sent. Must have matching recv.

  • source (int, optional) – Rank to recieve data from. Default allows data from any source.

bcast(self, data, root)

Broadcasts data from the root to all other processes in comm.

Parameters
  • data (any) – Data to be broadcast

  • root (int) – Indicate which process data comes from

barrier(self)

Block synchronization for the comm.

reduce(self, arg, op, root)

Data is joined from all processes in comm by doing op. Result is placed on root.

Parameters
  • arg (any) – Data to reduce

  • op (str) – Supports sum, max, and min reductions

  • root (int) – Rank the result will end on

allreduce(self, arg, op=MPI.LAND)

Data is joined from all processes in comm by doing op. Data is put on all processes in comm.

Parameters
  • arg (any) – Data to reduce

  • op (MPI op, optional) – Operation to perform

time(self)

Returns MPI wall clock time

split(self, procs_per_env, num_learners)

This splits the comm into agent, environment, and learner comms. Returns three simple sub-comms

Parameters
  • procs_per_env (int) – Number of processes per environment comm

  • num_learners (int) – Number of processes per learner comm

raw(self)

Returns raw MPI comm