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.5.0.tar.gz (235.1 kB view details)

Uploaded Source

Built Distributions

unidist-0.5.0-py3-none-win_amd64.whl (206.2 kB view details)

Uploaded Python 3 Windows x86-64

unidist-0.5.0-py3-none-win32.whl (206.2 kB view details)

Uploaded Python 3 Windows x86

unidist-0.5.0-py3-none-manylinux1_x86_64.whl (206.2 kB view details)

Uploaded Python 3

unidist-0.5.0-py3-none-manylinux1_i686.whl (206.2 kB view details)

Uploaded Python 3

unidist-0.5.0-py3-none-macosx_10_9_x86_64.whl (206.2 kB view details)

Uploaded Python 3 macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for unidist-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d57b0427d1ba0ef50d697d867745cc9d0e258bd545e6c9f680ede30814f3b616
MD5 e4576973adbe453e677781ceb1b5b54e
BLAKE2b-256 e9f6a25c65285a69dbe5b2dc977795ff5e422229ec5b2a2b5f30141e0270d289

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unidist-0.5.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 206.2 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.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 467dbbf7232b91753c2171df1bc1af160dd64b3c2377a080e126af640affb5d7
MD5 d3581b069245d79a5a52e4c008c818e8
BLAKE2b-256 75dfd4400779729dd4f96479d2d57e91a12622312820556b70364ffc20224160

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unidist-0.5.0-py3-none-win32.whl
  • Upload date:
  • Size: 206.2 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.5.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 b9cc2f1d5ad8e513cff35ecfe60a75d2c96b9a12f9a79cceb2513202e7e2ac16
MD5 5177a43946dbe2be2e534b9f918d7212
BLAKE2b-256 6c0c1d3c48b603c4b7b5fb64b08cba1687eb7b00fa733c0f5dee441fac0719f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for unidist-0.5.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a8cfd363b952faafd425e76075f49da14508178a94a4893c0381a73453d0076b
MD5 f8bb7dd7fa6d22f2ac3b1a2ae14ef780
BLAKE2b-256 9b4b1f82488d47d2d6005c653a75b74a00819ee1425f0fff2d02242f0dd64e01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for unidist-0.5.0-py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b6d539fdd094eb49d1b70fbe638eaf046fe3be352ffba685207633c1010b29e4
MD5 2ff352b7bef7efd5a2a254b58c7c5ea6
BLAKE2b-256 ff7109e87d2e22be865bc3fab1b77fb4cfc20d957bf9e6e6c6085bd53cda11a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for unidist-0.5.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cfdcdbd2f11e91269bc1d8a95a6d79bdf14b5ecfa0f059f8f7594193e1f276c8
MD5 bed5c7427120bfb722d0d5899a95e8f8
BLAKE2b-256 14de9fa89fd2e98b50353456fcaa88f89ff9cee109915bf060a3a019576cbecf

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