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. Mapping unidist[mpi] installs mpi4py package, which is just a Python wrapper for MPI. To enable unidist on MPI execution you need to have a working MPI implementation and certain software installed beforehand. Refer to Installation page of the mpi4py documentation for details. Also, you can find some instructions on MPI backend page.

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 a default MPI implementation, which comes with mpi4py package and is ready to use. The conda dependency solver decides on which MPI implementation is to be installed. If you want to use a specific version of MPI, you can install the core dependencies for MPI backend and the specific version of MPI as conda install unidist-mpi <mpi> as shown in the Installation page 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.6.0.tar.gz (236.3 kB view details)

Uploaded Source

Built Distributions

unidist-0.6.0-py3-none-win_amd64.whl (207.9 kB view details)

Uploaded Python 3 Windows x86-64

unidist-0.6.0-py3-none-win32.whl (207.9 kB view details)

Uploaded Python 3 Windows x86

unidist-0.6.0-py3-none-manylinux1_x86_64.whl (207.9 kB view details)

Uploaded Python 3

unidist-0.6.0-py3-none-manylinux1_i686.whl (207.9 kB view details)

Uploaded Python 3

unidist-0.6.0-py3-none-macosx_10_9_x86_64.whl (207.9 kB view details)

Uploaded Python 3 macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for unidist-0.6.0.tar.gz
Algorithm Hash digest
SHA256 70d3a40c208f6219717aa47cfc962e4e5f6dc18c0799d5a8bc684484f1152fba
MD5 305d35311d4975e78ea7e9ca00c9d286
BLAKE2b-256 912ce0138656e83db69c0fbf71b9e29a5ecb98dd22bf56cb6838204ac1a1ede8

See more details on using hashes here.

File details

Details for the file unidist-0.6.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: unidist-0.6.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 207.9 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for unidist-0.6.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 fe577dfe0fea5d872c505c00371ee669e739289bfb111f889769d7173350ebc0
MD5 c71f177bb22d6c5f99e0bd051935c183
BLAKE2b-256 a48ba9be89d2f518555db5df32d794350655380d41c4d13d93952bf216c97df5

See more details on using hashes here.

File details

Details for the file unidist-0.6.0-py3-none-win32.whl.

File metadata

  • Download URL: unidist-0.6.0-py3-none-win32.whl
  • Upload date:
  • Size: 207.9 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for unidist-0.6.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 8a6f9c9a0b482a69ba4a5a92ef3a9c491ef6ac562898aede5f775a2264a2f115
MD5 bed7b478831e2b5356a83682a10edbd0
BLAKE2b-256 9d9c906cac409398d202df19b23538c43b1f3381ccff83af09c7f9052fb4d812

See more details on using hashes here.

File details

Details for the file unidist-0.6.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for unidist-0.6.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 77611996240ce45c27cdeda7fcff7f8c8c3d49cb924d6df2da0823c05b6c1648
MD5 27031c1abb2559f2bf69f54bf831b9a7
BLAKE2b-256 2a133da05d61c2a7ac5d0bb5dfb3f2fcfce5fc95567af20d0abc9ab6acb0f149

See more details on using hashes here.

File details

Details for the file unidist-0.6.0-py3-none-manylinux1_i686.whl.

File metadata

File hashes

Hashes for unidist-0.6.0-py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 0d5619b855cbb1d414430147a52bf5bc53a6b4032d79669a4c9d1f1a5d301a8a
MD5 2ddb37740e6213965f0ca13e24fd9d1f
BLAKE2b-256 8b24c0abd302405d488718f0b43fade2d821dd010efa5945bb3d656c2f6ba3e5

See more details on using hashes here.

File details

Details for the file unidist-0.6.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for unidist-0.6.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f2ba412d2ebdb0e512da0bea9e158ef7cdb31bc94bce7eb89df2ff758e2c4e49
MD5 aca899c851fbc30fe7fa6157c0f8fbf6
BLAKE2b-256 3cfe472cbb18447e7f5ca86342c891c839784d2f9c8f309deeba7834a584270e

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