MPIBackend

The class is specific implementation of Backend interface using MPI.

API

class unidist.core.backends.mpi.backend.MPIBackend

The class that implements the interface in Backend using MPI.

static cluster_resources()

Get resources of MPI cluster.

Returns:

Dictionary with cluster nodes info in the form {“node_ip0”: {“CPU”: x0}, “node_ip1”: {“CPU”: x1}, …}.

Return type:

dict

static get(data_ids)

Get a remote object or a list of remote objects from distributed memory.

Parameters:

data_ids (unidist.core.backends.common.data_id.DataID or list) – DataID or a list of DataID objects to get data from.

Returns:

A Python object or a list of Python objects.

Return type:

object

static get_ip()

Get node IP address.

Returns:

Node IP address.

Return type:

str

static is_initialized()

Check if MPI backend has already been initialized.

Returns:

True or False.

Return type:

bool

static make_actor(cls, num_cpus, resources)

Define an actor class.

clsobject

Class to be an actor class.

num_cpusint

The number of CPUs to reserve for the lifetime of the actor.

resourcesdict

Custom resources to reserve for the lifetime of the actor.

Returns:

  • MPIActor – The actor class type to create.

  • list – The list of arguments for MPIActor constructor.

static make_remote_function(function, num_cpus, num_returns, resources)

Define a remote function.

functioncallable

Function to be a remote function.

num_cpusint

The number of CPUs to reserve for the remote function.

num_returnsint

The number of ObjectRef-s returned by the remote function invocation.

resourcesdict

Custom resources to reserve for the remote function.

Return type:

MPIRemoteFunction

static num_cpus()

Get the number of CPUs used by the execution backend.

Return type:

int

static put(data)

Put data into distributed memory.

Parameters:

data (object) – Data to be put.

Returns:

DataID matching to data.

Return type:

unidist.core.backends.common.data_id.DataID

static shutdown()

Shutdown MPI execution backend.

static wait(data_ids, num_returns=1)

Wait until data_ids are finished.

This method returns two lists. The first list consists of data IDs that correspond to objects that completed computations. The second list corresponds to the rest of the data IDs (which may or may not be ready).

Parameters:
Returns:

List of data IDs that are ready and list of the remaining data IDs.

Return type:

tuple