Skip to content

openstb.simulator.cluster.dask_mpi

Classes:

Name Description
DaskMPICluster

A cluster of Dask nodes communicating via MPI.

DaskMPICluster

DaskMPICluster(interface=None, dashboard_address=None, separate_workers=True, local_directory=None)

Bases: DaskCluster

A cluster of Dask nodes communicating via MPI.

This requires the dask_mpi package to be installed. This uses the mpi4py library to communicate via MPI. The process running with MPI rank 0 is used for the Dask scheduler, and the process running with MPI rank 1 is used for the main simulation controller. All other processes are used as computation workers.

Parameters:

Name Type Description Default
interface str

The network interface to use for communication, e.g., "eth0" or "ib0". If not specified, the scheduler will attempt to determine the appropriate interface.

None
dashboard_address str

Address the Dask diagnostic dashboard server will listen on, e.g., "localhost:8787" or "0.0.0.0:8787". If not given, the server will be disabled.

None
separate_workers boolean

If True, the worker processes (all processes with a rank other than 1) will use the initialise_workers() method. If False, all processes will read the configuration and proceed as normal. Setting this to True is recommended so that only the main controller process will have to read and parse the configuration.

True
local_directory str

The path to a local scratch directory for Dask to use. This should be local to each node, not on a network drive. If not given, Dask will fall back to an internal default path.

None
Source code in openstb/simulator/cluster/dask_mpi.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def __init__(
    self,
    interface: str | None = None,
    dashboard_address: str | None = None,
    separate_workers: bool = True,
    local_directory: str | None = None,
):
    """
    Parameters
    ----------
    interface : str
        The network interface to use for communication, e.g., "eth0" or "ib0". If
        not specified, the scheduler will attempt to determine the appropriate
        interface.
    dashboard_address : str, optional
        Address the Dask diagnostic dashboard server will listen on, e.g.,
        "localhost:8787" or "0.0.0.0:8787". If not given, the server will be
        disabled.
    separate_workers : boolean, default True
        If True, the worker processes (all processes with a rank other than 1) will
        use the initialise_workers() method. If False, all processes will read the
        configuration and proceed as normal. Setting this to True is recommended so
        that only the main controller process will have to read and parse the
        configuration.
    local_directory : str, optional
        The path to a local scratch directory for Dask to use. This should be local
        to each node, not on a network drive. If not given, Dask will fall back to
        an internal default path.

    """
    self.interface = interface
    self.dashboard_address = dashboard_address
    self._initialised = False
    self._client: distributed.Client | None = None
    self.separate_workers = separate_workers
    self.local_directory = local_directory