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 sequential Python backend, that can be used for debugging.

Installation

From PyPI

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

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

unidist can also be used with Dask, MPI or Ray execution backend. If you don't have Dask, MPI 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[dask] # Install unidist with dependencies for Dask backend
pip install unidist[mpi] # Install unidist with dependencies for MPI 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.

From conda-forge

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

conda install unidist-dask unidist-mpi -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-dask unidist-mpi unidist-ray -c conda-forge

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=ray  # unidist will use Ray
export UNIDIST_BACKEND=mpi  # unidist will use MPI
export UNIDIST_BACKEND=dask  # unidist will use Dask

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

from unidist.config import Backend

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

If you have installed all the execution backends and haven't specified any of the execution backends, Ray is used by default.

Since some of the execution backends, particularly, MPI, have some specifics regarding running python programs, please refer to Using Unidist section to get more information on setting the execution backend to run on.

Usage

# script.py

import unidist
unidist.init() # Ray 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:

$ python script.py
[0, 1, 4, 9, 16] # output

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

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

Uploaded Source

Built Distribution

unidist-0.2.1-py3-none-any.whl (102.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unidist-0.2.1.tar.gz
  • Upload date:
  • Size: 79.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.0

File hashes

Hashes for unidist-0.2.1.tar.gz
Algorithm Hash digest
SHA256 21e4996502e1bb7d418552c20fbfcfe7cb8fdd4bc3f2b15dec7543c0391b4f3d
MD5 4777894834634c9dfcb6c3498b37124c
BLAKE2b-256 169a4fc88bcb5f5a02d58bbdc6ed877d1d92922d4a01fb5141b7fed1bb50df3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unidist-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 102.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.0

File hashes

Hashes for unidist-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92d16b5ef006e3e604a0c5afeec08f6567c12acc788b2dbeedd1c2068d8ad6e6
MD5 356094183f0c9dba0595a4b6a746d99e
BLAKE2b-256 3eaca69feaabcfef38900f6c20762715ab72a29efd6174c75afdb8bb277efe8a

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