Skip to main content

Unified Distributed Execution

Project description

Unified Distributed Execution

PyPI version

What is unidist?

unidist is a framework that is intended to provide the unified API for distributed execution by supporting various performant execution backends. At the moment the following backends are supported under the hood:

unidist is designed to work in a task-based parallel model.

Also, the framework provides a Python Sequential backend (pyseq), that can be used for debugging.

Installation

Using pip

unidist can be installed with pip on Linux, Windows and MacOS:

pip install unidist # Install unidist with dependencies for Python Multiprocessing and Python Sequential backends

unidist can also be used with MPI, Dask or Ray execution backend. If you don't have MPI, Dask or Ray installed, you will need to install unidist with one of the targets:

pip install unidist[all] # Install unidist with dependencies for all the backends
pip install unidist[mpi] # Install unidist with dependencies for MPI backend
pip install unidist[dask] # Install unidist with dependencies for Dask backend
pip install unidist[ray] # Install unidist with dependencies for Ray backend

unidist automatically detects which execution backends are installed and uses that for scheduling computation.

Note: There are different MPI implementations, each of which can be used as a backend in unidist. By default, mapping unidist[mpi] installs MPICH on Linux and MacOS and MSMPI on Windows. If you want to use a specific version of MPI, you can install the core dependencies of unidist as pip install unidist and then install the specific version of MPI using pip as shown in the installation section of mpi4py documentation.

Using conda

For installing unidist with dependencies for MPI and Dask execution backends into a conda environment the following command should be used:

conda install unidist-mpi unidist-dask -c conda-forge

All set of backends could be available in a conda environment by specifying:

conda install unidist-all -c conda-forge

or explicitly:

conda install unidist-mpi unidist-dask unidist-ray -c conda-forge

Note: There are different MPI implementations, each of which can be used as a backend in unidist. By default, mapping unidist-mpi installs MPICH on Linux and MacOS and MSMPI on Windows. If you want to use a specific version of MPI, you can install the core dependencies of unidist as conda install unidist and then install the specific version of MPI using conda as shown in the installation section of mpi4py documentation. That said, it is highly encouraged to use your own MPI binaries as stated in the Using External MPI Libraries section of the conda-forge documentation in order to get ultimate performance.

For more information refer to Installation section.

Choosing an execution backend

If you want to choose a specific execution backend to run on, you can set the environment variable UNIDIST_BACKEND and unidist will do computation with that backend:

export UNIDIST_BACKEND=mpi  # unidist will use MPI
export UNIDIST_BACKEND=dask  # unidist will use Dask
export UNIDIST_BACKEND=ray  # unidist will use Ray

This can also be done within a notebook/interpreter before you initialize unidist:

from unidist.config import Backend

Backend.put("mpi")  # unidist will use MPI
Backend.put("dask")  # unidist will use Dask
Backend.put("ray")  # unidist will use Ray

If you have installed all the execution backends and haven't specified any of the execution backends, MPI is used by default. Currently, almost all MPI implementations require mpiexec command to be used when running an MPI program. If you use a backend other than MPI, you run a program as a regular python script (see below).

Usage

# script.py

import unidist
unidist.init() # MPI backend is used by default

@unidist.remote
def foo(x):
    return x * x

# This will run `foo` on a pool of workers in parallel;
# `refs` will contain object references to actual data
refs = [foo.remote(i) for i in range(5)]
# To get the data call `unidist.get(...)`
print(unidist.get(refs))

Run the script.py with:

$ mpiexec -n 1 python script.py  # for MPI backend
# $ python script.py  # for any other supported backend
[0, 1, 4, 9, 16]  # output

For more examples refer to Getting Started section in our documentation.

Powered by unidist

unidist is meant to be used not only directly by users to get better performance in their workloads, but also be a core component of other libraries to power those with the performant execution backends. Refer to Libraries powered by unidist section of Using Unidist page to get more information on which libraries have already been using unidist.

Full Documentation

Visit the complete documentation on readthedocs: https://unidist.readthedocs.io.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unidist-0.4.0.tar.gz (85.1 kB view details)

Uploaded Source

Built Distribution

unidist-0.4.0-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

Details for the file unidist-0.4.0.tar.gz.

File metadata

  • Download URL: unidist-0.4.0.tar.gz
  • Upload date:
  • Size: 85.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for unidist-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8ea4bae8911c179131867f3e3b581b72f67e0f68578bed032088388dd1e4b616
MD5 a2755c46825f499b1da16080fadca326
BLAKE2b-256 0a0ef70cac95782b4c393f13ba57d07ebe9a35001a33d0971d3664192c213e24

See more details on using hashes here.

File details

Details for the file unidist-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: unidist-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for unidist-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c0ec40c76a0413c2c27e4b6a995186b82a194c538e6dde8fc85b63ee916e097
MD5 d7d597d83d70b91aa70a11a46741fe86
BLAKE2b-256 9f1ddb15c8da2edcc77e1e7f42cfb33e39ef6f617e95e1e554f59c08a2ac4fb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page