quimb.linalg.mpi_launcher#

Manages the spawning of mpi processes to send to the various solvers.

Functions

bcast(result, comm, result_rank)

Broadcast a result to all workers, dispatching to proper MPI (rather than pickled) communication if the result is a numpy array.

can_use_mpi_pool()

Function to determine whether we are allowed to call get_mpi_pool.

Classes

CachedPoolWithShutdown(pool_fn)

Decorator for caching the mpi pool when called with the equivalent args, and shutting down previous ones when not needed.

GetMPIBeforeCall(fn)

Wrap a function to automatically get the correct communicator before its called, and to set the comm_self kwarg to allow forced self mode.

SpawnMPIProcessesFunc(fn)

Automatically wrap a function to be executed in parallel by a pool of mpi workers.

SynchroMPIPool()

An object that looks like a concurrent.futures executor but actually distributes tasks in a round-robin fashion based to MPI workers, before broadcasting the results to each other.

SyncroFuture(result, result_rank, comm)

class quimb.linalg.mpi_launcher.CachedPoolWithShutdown(pool_fn)[source]#

Decorator for caching the mpi pool when called with the equivalent args, and shutting down previous ones when not needed.

class quimb.linalg.mpi_launcher.GetMPIBeforeCall(fn)[source]#

Wrap a function to automatically get the correct communicator before its called, and to set the comm_self kwarg to allow forced self mode.

This is called by every mpi process before the function evaluation.

class quimb.linalg.mpi_launcher.SpawnMPIProcessesFunc(fn)[source]#

Automatically wrap a function to be executed in parallel by a pool of mpi workers.

This is only called by the master mpi process in manual mode, only by the (non-mpi) spawning process in automatic mode, or by all processes in syncro mode.

class quimb.linalg.mpi_launcher.SynchroMPIPool[source]#

An object that looks like a concurrent.futures executor but actually distributes tasks in a round-robin fashion based to MPI workers, before broadcasting the results to each other.

quimb.linalg.mpi_launcher.bcast(result, comm, result_rank)[source]#

Broadcast a result to all workers, dispatching to proper MPI (rather than pickled) communication if the result is a numpy array.

quimb.linalg.mpi_launcher.can_use_mpi_pool()[source]#

Function to determine whether we are allowed to call get_mpi_pool.