This package implements the DFM class.
The DFM is a useful abstraction for working with lists distributed over a set of MPI ranks. The acronym stands for distributed free monoid, which is just a fancy way to say it’s a list.
If you’re familiar with spark, it’s like an RDD, but only holds a list.
Quick Start
from mpi_list import Context, DFM
C = Context() # calls MPI_Init via mpi4py
# After each of the three lines below:
# 1. each rank now has 1000//C.procs consecutive numbers
# 2. each rank now has a list of strings
# 3. only numbers containing a '2' remain
dfm = C . iterates(1000) \
. map(lambda i: f"String {i}") \
. filter(lambda s: '2' in s)
if C.rank == 0:
# Caution! Uncommenting this will deadlock your program.
# Collective calls must be called by all ranks!
#print( dfm . head(10) )
pass
# This is OK, since all ranks now have 'ans'
ans = dfm.head(10)
if C.rank == 0:
print( ans )
ans = dfm . filter(lambda s: len(s) <= len("String nn")) \
. collect()
if ans is not None: # only rank 0 gets "collect"
print( ans )
Launch your program with mpirun python my_prog.py.
If you’re using a supercomputer, consider installing spindle, and then use spindle mpirun python my_prog.py.
Note
This project has been set up using PyScaffold 4.0.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
Metadata
Release files for mpi_list 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mpi_list-0.4.0.tar.gz | 23.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mpi_list-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / mpi_list-0.4.0.tar.gz
| Download URL | mpi_list-0.4.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90e546be5f9568dad00b7406aec08cb8251f957bd3fd3c087880b589812bd924
|
|
BLAKE2b-256 checksum How to use checksums |
fb87c54f150c6787e5295b0fce748252a7a718852d9e76acc39014bebf85c97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|
Release files / mpi_list-0.4.0-py3-none-any.whl
| Download URL | mpi_list-0.4.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eac94c7ebea47487988d71646099ba39d36dcf203b9cfefb594a5e00457fc13b
|
|
BLAKE2b-256 checksum How to use checksums |
254f50f30c849558947f2fbf949a0b4c34fa19fc025f790fd0d03367434aff46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.15
|