Skip to main content

better multiprocessing and multithreading in python

Project description

About Multiprocess

multiprocess is a fork of multiprocessing. multiprocess extends multiprocessing to provide enhanced serialization, using dill. multiprocess leverages multiprocessing to support the spawning of processes using the API of the python standard library’s threading module. multiprocessing has been distributed as part of the standard library since python 2.6.

multiprocess is part of pathos, a python framework for heterogeneous computing. multiprocess is in active development, so any user feedback, bug reports, comments, or suggestions are highly appreciated. A list of issues is located at https://github.com/uqfoundation/multiprocess/issues, with a legacy list maintained at https://uqfoundation.github.io/project/pathos/query.

Major Features

multiprocess enables:

  • objects to be transferred between processes using pipes or multi-producer/multi-consumer queues

  • objects to be shared between processes using a server process or (for simple data) shared memory

multiprocess provides:

  • equivalents of all the synchronization primitives in threading

  • a Pool class to facilitate submitting tasks to worker processes

  • enhanced serialization, using dill

Current Release

The latest released version of multiprocess is available from:

https://pypi.org/project/multiprocess

multiprocess is distributed under a 3-clause BSD license, and is a fork of multiprocessing.

Development Version

You can get the latest development version with all the shiny new features at:

https://github.com/uqfoundation

If you have a new contribution, please submit a pull request.

Installation

multiprocess can be installed with pip:

$ pip install multiprocess

For python 2, a C compiler is required to build the included extension module from source. Python 3 and binary installs do not require a C compiler.

Requirements

multiprocess requires:

  • python (or pypy), ==2.7 or >=3.7

  • setuptools, >=42

  • dill, >=0.3.5.1

Basic Usage

The multiprocess.Process class follows the API of threading.Thread. For example

from multiprocess import Process, Queue

def f(q):
    q.put('hello world')

if __name__ == '__main__':
    q = Queue()
    p = Process(target=f, args=[q])
    p.start()
    print (q.get())
    p.join()

Synchronization primitives like locks, semaphores and conditions are available, for example

>>> from multiprocess import Condition
>>> c = Condition()
>>> print (c)
<Condition(<RLock(None, 0)>), 0>
>>> c.acquire()
True
>>> print (c)
<Condition(<RLock(MainProcess, 1)>), 0>

One can also use a manager to create shared objects either in shared memory or in a server process, for example

>>> from multiprocess import Manager
>>> manager = Manager()
>>> l = manager.list(range(10))
>>> l.reverse()
>>> print (l)
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> print (repr(l))
<Proxy[list] object at 0x00E1B3B0>

Tasks can be offloaded to a pool of worker processes in various ways, for example

>>> from multiprocess import Pool
>>> def f(x): return x*x
...
>>> p = Pool(4)
>>> result = p.map_async(f, range(10))
>>> print (result.get(timeout=1))
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

When dill is installed, serialization is extended to most objects, for example

>>> from multiprocess import Pool
>>> p = Pool(4)
>>> print (p.map(lambda x: (lambda y:y**2)(x) + x, xrange(10)))
[0, 2, 6, 12, 20, 30, 42, 56, 72, 90]

More Information

Probably the best way to get started is to look at the documentation at http://multiprocess.rtfd.io. See multiprocess.examples for a set of example scripts. You can also run the test suite with python -m multiprocess.tests. Please feel free to submit a ticket on github, or ask a question on stackoverflow (@Mike McKerns). If you would like to share how you use multiprocess in your work, please send an email (to mmckerns at uqfoundation dot org).

Citation

If you use multiprocess to do research that leads to publication, we ask that you acknowledge use of multiprocess by citing the following in your publication:

M.M. McKerns, L. Strand, T. Sullivan, A. Fang, M.A.G. Aivazis,
"Building a framework for predictive science", Proceedings of
the 10th Python in Science Conference, 2011;
http://arxiv.org/pdf/1202.1056

Michael McKerns and Michael Aivazis,
"pathos: a framework for heterogeneous computing", 2010- ;
https://uqfoundation.github.io/project/pathos

Please see https://uqfoundation.github.io/project/pathos or http://arxiv.org/pdf/1202.1056 for further information.

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

multiprocess-0.70.13.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

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

multiprocess-0.70.13-py310-none-any.whl (133.1 kB view details)

Uploaded Python 3.10

multiprocess-0.70.13-py39-none-any.whl (132.3 kB view details)

Uploaded Python 3.9

multiprocess-0.70.13-py38-none-any.whl (131.4 kB view details)

Uploaded Python 3.8

multiprocess-0.70.13-py37-none-any.whl (115.1 kB view details)

Uploaded Python 3.7

multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl (132.4 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ x86-64

multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_i686.whl (132.4 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ i686

multiprocess-0.70.13-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (132.4 kB view details)

Uploaded PyPymacOS 10.9+ x86-64

multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl (131.6 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ x86-64

multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_i686.whl (131.6 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ i686

multiprocess-0.70.13-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (131.6 kB view details)

Uploaded PyPymacOS 10.9+ x86-64

multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl (115.3 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ x86-64

multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_i686.whl (115.2 kB view details)

Uploaded PyPymanylinux: glibc 2.24+ i686

multiprocess-0.70.13-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (115.3 kB view details)

Uploaded PyPymacOS 10.9+ x86-64

multiprocess-0.70.13-pp27-pypy_73-manylinux2010_x86_64.whl (84.2 kB view details)

Uploaded PyPymanylinux: glibc 2.12+ x86-64

multiprocess-0.70.13-pp27-pypy_73-macosx_10_7_x86_64.whl (84.2 kB view details)

Uploaded PyPymacOS 10.7+ x86-64

multiprocess-0.70.13-cp27-cp27m-win_amd64.whl (95.4 kB view details)

Uploaded CPython 2.7mWindows x86-64

multiprocess-0.70.13-cp27-cp27m-win32.whl (94.4 kB view details)

Uploaded CPython 2.7mWindows x86

multiprocess-0.70.13-cp27-cp27m-manylinux1_x86_64.whl (120.8 kB view details)

Uploaded CPython 2.7m

multiprocess-0.70.13-cp27-cp27m-manylinux1_i686.whl (118.2 kB view details)

Uploaded CPython 2.7m

multiprocess-0.70.13-cp27-cp27m-macosx_10_14_x86_64.whl (92.1 kB view details)

Uploaded CPython 2.7mmacOS 10.14+ x86-64

File details

Details for the file multiprocess-0.70.13.tar.gz.

File metadata

  • Download URL: multiprocess-0.70.13.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for multiprocess-0.70.13.tar.gz
Algorithm Hash digest
SHA256 2e096dd618a84d15aa369a9cf6695815e5539f853dc8fa4f4b9153b11b1d0b32
MD5 ebfdfce3341c5531a028421c0a6a8c1e
BLAKE2b-256 4b7f55f7dacc3127a918110763998dfbabbec8dd693bfde9a7df9c4e44f4da29

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-py310-none-any.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-py310-none-any.whl
Algorithm Hash digest
SHA256 0f4faf4811019efdb2f91db09240f893ee40cbfcb06978f3b8ed8c248e73babe
MD5 1c222ff4299c1c40c70aeda083a92bc3
BLAKE2b-256 fae63b9d10a3700782464eb304b6703224428404bac36d14acdb1b2a0046ade6

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-py39-none-any.whl.

File metadata

  • Download URL: multiprocess-0.70.13-py39-none-any.whl
  • Upload date:
  • Size: 132.3 kB
  • Tags: Python 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for multiprocess-0.70.13-py39-none-any.whl
Algorithm Hash digest
SHA256 00ef48461d43d1e30f8f4b2e1b287ecaaffec325a37053beb5503e0d69e5a3cd
MD5 8e2a35aaec345cec3c601af3627c5e56
BLAKE2b-256 e1a498f97b3aaa84b8be6702bad22ee9893dd506ed7c9dbfdad481793677066b

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-py38-none-any.whl.

File metadata

  • Download URL: multiprocess-0.70.13-py38-none-any.whl
  • Upload date:
  • Size: 131.4 kB
  • Tags: Python 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for multiprocess-0.70.13-py38-none-any.whl
Algorithm Hash digest
SHA256 7be9e320a41d2d0d0eddacfe693cfb07b4cb9c0d3d10007f4304255c15215778
MD5 e762f0593e2e3605c74cdf3ac76e82bf
BLAKE2b-256 1ebc625b7345861101ef708a0d5b4e9fd7694e2f97621a69e9b869100e0be47d

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-py37-none-any.whl.

File metadata

  • Download URL: multiprocess-0.70.13-py37-none-any.whl
  • Upload date:
  • Size: 115.1 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for multiprocess-0.70.13-py37-none-any.whl
Algorithm Hash digest
SHA256 62e556a0c31ec7176e28aa331663ac26c276ee3536b5e9bb5e850681e7a00f11
MD5 c56adfc19f5cd0423f5b2fe790b8f600
BLAKE2b-256 4b28915e6d4943eab538963a4fac7c409aa4a75213f5e6b98d91334e9a284c5c

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 01c1137d2f18d0cd262d0fdb7294b1fe9fc3e8dc8b126e506085434ae8eb3677
MD5 b5237c7e5be253e68b55b1eb3f11787f
BLAKE2b-256 fadfb74da3323f04f595739d36a3c3bbde50b3c1368cf78b299d6c3ed6f2d6f3

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp39-pypy39_pp73-manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5974bdad390ba466cc130288d2ef1048fdafedd01cf4641fc024f6088af70bfe
MD5 16bed90ca96273c49af473f988d61a4a
BLAKE2b-256 01f89cc3411ba3191aa4bc96710fa4859a5f3a35afe3acffa2241d7877ea6f06

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp39-pypy39_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5a6dca5f29f0224c855d0d5cad963476175cfc8de112d3eebe85914cb735f130
MD5 43b1ee86f333d341cb093bcd177cf0bd
BLAKE2b-256 8f0c3131b0bdf6f1df6f14e42044507c26d8c33813d528c5566f4b4c16909f36

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 48315eefe02c35dd7560da3fa8af66d9f4a61b9dc8f7c40801c5f972ab4604b1
MD5 04072ab4d56f589ceb1c1b881e9d2eb3
BLAKE2b-256 362e5a04bfa3bbe4b6f8c479f81df995c6c7f3b481230ca0067eccd40516fc22

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp38-pypy38_pp73-manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 c4a97216e8319039c69a266252cc68a392b96f9e67e3ed02ad88be9e6f2d2969
MD5 f18817dd437b1039fb7161477192ea9a
BLAKE2b-256 f11c40dd84a93f88ca6191234c4968a218d4eaa649f58697d8550268b653adb1

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp38-pypy38_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af0a48440aa8f793d8bb100f20102c12f192de5a608638819a998f2cc59e1fcd
MD5 2b6cf9852ff65e6fdf5dc7135375cb1d
BLAKE2b-256 46018ffbd9aedc795e0bac153ca7ff34403f4654bda64516a027111ddb239bf5

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 34e9703bd5b9fee5455c93a74e44dbabe55481c214d03be1e65f037be9d0c520
MD5 e457ba8a2ba32ba447b95921539b19c7
BLAKE2b-256 640ee222cac7a5be78c4e2912f4bc5315caad9b661db0e82202283de6f422ae1

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_i686.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp37-pypy37_pp73-manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 5436d1cd9f901f7ddc4f20b6fd0b462c87dcc00d941cc13eeb2401fc5bd00e42
MD5 f9687fa0010afb6382dc548658685608
BLAKE2b-256 3147f683d6544369ca017ae92e590b8ddcbf4e112a49cddd994c51dd76c64ced

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp37-pypy37_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7415f61bddfffdade73396904551be8124a4a363322aa9c72d42e349c5fca39
MD5 98a913ddae9fb3ab9189a386de2aa333
BLAKE2b-256 d3e7be7ea01910a2808c1869bb928830ed66802a224b6e45aa655f17328b99e2

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp27-pypy_73-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp27-pypy_73-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3ec1c8015e19182bfa01b5887a9c25805c48df3c71863f48fe83803147cde5d6
MD5 c3dbd71970557cfd3b6dd733b098b4e2
BLAKE2b-256 a495e473055ea7bf887b75e242652f79dd7b8081fabdc748906b31a1ea28ce98

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-pp27-pypy_73-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-pp27-pypy_73-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 92003c247436f8699b7692e95346a238446710f078500eb364bc23bb0503dd4f
MD5 f9af547ff3d9ba9f3b87c5be4b3e1b60
BLAKE2b-256 6991abefd80068dcaa94d0888b90d3d24e28cfa3a42ae69dfb45af6d948b6d77

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 6cdde49defcb933062df382ebc9b5299beebcd157a98b3a65291c1c94a2edc41
MD5 9d58c6faa8cd1918389dd4559356237c
BLAKE2b-256 7ac9894c5c85d11ac69aca7bb5f3127d5317b07dc772377485c6f08a6b61f689

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-cp27-cp27m-win32.whl.

File metadata

  • Download URL: multiprocess-0.70.13-cp27-cp27m-win32.whl
  • Upload date:
  • Size: 94.4 kB
  • Tags: CPython 2.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for multiprocess-0.70.13-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 99bb68dd0d5b3d30fe104721bee26e4637667112d5951b51feb81479fd560876
MD5 3ad62a111cf856f6b414b4d8e0444faf
BLAKE2b-256 a2023fc7e636c453a3161c65f7d6ddc43a992a85f8dbd402c336a06f29875818

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 17cb4229aa43e6973679d67c66a454cbf8b6b0d038425cba3220ea5a06d61b58
MD5 179b2378b4d23a9a3616ecda1c2bf536
BLAKE2b-256 a3cd235471d3a8c17bce1fed180026ab5ecd60a6c7f425303f1d29c4b7d724e1

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7e6a689da3490412caa7b3e27c3385d8aaa49135f3a353ace94ca47e4c926d37
MD5 e91d4585292893a30d14c2d3a5e7ef5b
BLAKE2b-256 dcd4c7f35e12375e98aad20a84297dc8d89533aeb65000c57aa9d98ac6b24948

See more details on using hashes here.

File details

Details for the file multiprocess-0.70.13-cp27-cp27m-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for multiprocess-0.70.13-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 b9a3be43ecee6776a9e7223af96914a0164f306affcf4624b213885172236b77
MD5 18c7b387c4b5cdcbafe1818d4c441283
BLAKE2b-256 c4422e4f8c2dbe890fdc4d7a271254204f523e7c4d6723bfe95f2d7f98105f5c

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