Skip to main content

Parallel MPIPoolExecutor implementing the concurrent.futures interface

Project description

About

zwembad offers an MPIPoolExecutor class, an implementation of the concurrent.futures.Executor class of the standard library.

Example usage

from zwembad import MPIPoolExecutor
from mpi4py import MPI

pool = MPIPoolExecutor()

def menial_task(x):
    return x ** MPI.COMM_WORLD.Get_rank()

fs = [pool.submit(menial_task, i) for i in range(100)]

print([f.result() for f in fs])

You'll see that some results will have exponentiated either by 1, 2, ..., n depending on which worker they were sent to.

Different from mpi4pys own MPIPoolExecutor zwembad is designed to function without MPI.Spawn() for cases where this approach isn't feasible, like supercomputers where MPI.Spawn is usually deliberatly not implemented (for example CrayMPI).

Therefor the pool can only use MPI processes that are spawned when the MPI world is initialised and must be run from the command line using an MPI helper such as mpirun, mpiexec or SLURM's srun:

$ mpirun -n 4 python example.py

Note: Currently zwembad.MPIPoolExecutor only implements a submit method and lacks a parallel map method.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zwembad-1.0.0b0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file zwembad-1.0.0b0-py3-none-any.whl.

File metadata

  • Download URL: zwembad-1.0.0b0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.6

File hashes

Hashes for zwembad-1.0.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9595464e7004c300ac4c471781e2bfb8f84ba7d2ef5346ddd2da40c51ecac0e
MD5 4c3a29e11285a37921a8ea13e87b0d1e
BLAKE2b-256 b889f3840bc996b1fd6ab14fcb962ef62264ac2451ddb1626d54efb45f3c04b2

See more details on using hashes here.

Supported by

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