Skip to main content

MPI Pool similar to multiprocessing

Project description

About

mpipool offers a Pool class similar multiprocessing.Pool from the standard library.

mpipool uses MPIPool implementation of schwimmbad library and circumvents some of its limitations:

  • A series of mpipool.Pool.map calls do not crash,
  • In case a worker raises an exception, the MPI tasks are shut down properly so that the full program halts and does not hang.

Example usage

from mpipool import Pool

def add(a, b):
    return a + b

p = Pool()

sums = p.map(add, [(ai, bi) for ai in range(10) for bi in range(10)])

assert len(sums) == 100
assert sums[0] == 0
assert sums[-1] == 18

sums = p.map(add, [(ai, bi) for ai in range(10) for bi in range(10)])

assert len(sums) == 100
assert sums[0] == 0
assert sums[-1] == 18

The program must be run on the commandline like:

$ mpirun -n 4 python example.py

Currently mpipool.Pool only implements a map method.

Contrary to the MPIPool implementation of schwimmbad the statements after from mpipool import Pool are only executed by the task with rank 0.

Credits

mpipool uses of the MPIPool implementation of schwimmbad library.

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

mpipool-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file mpipool-0.2.0.tar.gz.

File metadata

  • Download URL: mpipool-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.16

File hashes

Hashes for mpipool-0.2.0.tar.gz
Algorithm Hash digest
SHA256 56e701e2e626e20b3c312316d60ac6072bc6067548e06ae7b0564d4d3be5378f
MD5 ec6d21d2c6536f0e1c11ad4295adde50
BLAKE2b-256 cb3edc61d6eee641254f6f69c993e4b60be51114d45ae86d4232d62215acd7d6

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