Lightweight parallelisation library for Python
Project description
OpenGRIS Parfun is a lightweight library making it easy to write and run Python in parallel and distributed systems.
The main feature of the library is its @parallel decorator that transparently executes standard Python functions in parallel
following the map-reduce pattern:
from typing import List
import parfun as pf
@pf.parallel(
# parallelize by chunking the argument list (map)
split=pf.per_argument(
values=pf.py_list.by_chunk
),
# merge the output by concatenating the results (reduce)
combine_with=pf.py_list.concat,
)
def list_pow(values: List[float], factor: float) -> List[float]:
"""compute powers of a list of numbers"""
return [v**factor for v in values]
if __name__ == "__main__":
with pf.set_parallel_backend_context("local_multiprocessing"): # use a local pool of processes
print(list_pow([1, 2, 3], 2)) # runs in parallel, prints [1, 4, 9]
Features
- Provides significant speedups to existing Python functions.
- Only requires basic understanding of parallel and distributed computing systems.
- Automatically estimates the optimal sub-task splitting strategy (the partition size).
- Transparently handles data transmission, caching, and synchronization.
- Supports various distributed computing backends:
- Python's built-in multiprocessing module.
- Scaler.
- Dask.
Quick Start
Install Parfun directly from PyPI:
pip install opengris-parfun
pip install "opengris-parfun[pandas,scaler,dask]" # with optional dependencies
The official documentation is available at citi.github.io/parfun/.
Take a look at our documentation's quickstart tutorial to get more examples and a deeper overview of the library.
Alternatively, you can build the documentation from source:
cd docs
pip install -r requirements.txt
make html
The documentation's main page can then be found at docs/build/html/index.html.
Benchmarks
Parfun effectively parallelizes even short-duration functions.
For example, when running a short 0.28-second machine learning function on an AMD Epyc 7313 16-Core Processor, we found that Parfun provided an impressive 7.4x speedup. Source code for this experiment here.
Contributing
Your contributions are at the core of making this a true open source project. Any contributions you make are greatly appreciated.
We welcome you to:
- Fix typos or touch up documentation
- Share your opinions on existing issues
- Help expand and improve our library by opening a new issue
Please review functional contribution guidelines to get started 👍.
NOTE: Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR contributors who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged and blocked by the (EasyCLA) tool. Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
Need an ICLA? Unsure if you are covered under an existing CCLA? Email help@finos.org
Code of Conduct
Please see the FINOS Community Code of Conduct.
License
Copyright 2023 Citigroup, Inc.
This project is distributed under the Apache-2.0 License. See
LICENSE for more information.
SPDX-License-Identifier: Apache-2.0.
Contact
If you have a query or require support with this project, raise an issue. Otherwise, reach out to opensource@citi.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opengris_parfun-7.3.0.tar.gz.
File metadata
- Download URL: opengris_parfun-7.3.0.tar.gz
- Upload date:
- Size: 678.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
097add7ef494d5395ef5cd690aca88a5741f625ba350818e89cb45ca86d7712b
|
|
| MD5 |
8e574ed6ab2788e47d8bcff7fc8e040a
|
|
| BLAKE2b-256 |
e95f2d49a21cb99235d5f930f879a909fd1201bc89797ce64ebd5b1dcf0db722
|
Provenance
The following attestation bundles were made for opengris_parfun-7.3.0.tar.gz:
Publisher:
pypi.yml on finos/opengris-parfun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opengris_parfun-7.3.0.tar.gz -
Subject digest:
097add7ef494d5395ef5cd690aca88a5741f625ba350818e89cb45ca86d7712b - Sigstore transparency entry: 922979019
- Sigstore integration time:
-
Permalink:
finos/opengris-parfun@d66b4f056ac75d977af33f5c1fc187c5f7adc415 -
Branch / Tag:
refs/tags/v7.3.0 - Owner: https://github.com/finos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@d66b4f056ac75d977af33f5c1fc187c5f7adc415 -
Trigger Event:
release
-
Statement type:
File details
Details for the file opengris_parfun-7.3.0-py3-none-any.whl.
File metadata
- Download URL: opengris_parfun-7.3.0-py3-none-any.whl
- Upload date:
- Size: 45.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1aafd4a91abfc7110947361099ac3b70c407f8c138d5cb2af1a468182fe2dd9
|
|
| MD5 |
0b7aa249cadd634dabe3585048bcf370
|
|
| BLAKE2b-256 |
76c8670a1354464ea8fe370f369d2b2d9a76079dd1165a32361fddf4eae60b38
|
Provenance
The following attestation bundles were made for opengris_parfun-7.3.0-py3-none-any.whl:
Publisher:
pypi.yml on finos/opengris-parfun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opengris_parfun-7.3.0-py3-none-any.whl -
Subject digest:
f1aafd4a91abfc7110947361099ac3b70c407f8c138d5cb2af1a468182fe2dd9 - Sigstore transparency entry: 922979090
- Sigstore integration time:
-
Permalink:
finos/opengris-parfun@d66b4f056ac75d977af33f5c1fc187c5f7adc415 -
Branch / Tag:
refs/tags/v7.3.0 - Owner: https://github.com/finos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@d66b4f056ac75d977af33f5c1fc187c5f7adc415 -
Trigger Event:
release
-
Statement type: