Skip to main content
https://img.shields.io/pypi/v/mpipartition.svg https://github.com/ArgonneCPAC/MPIPartition/actions/workflows/pypi.yml/badge.svg https://github.com/ArgonneCPAC/MPIPartition/actions/workflows/sphinx.yml/badge.svg

A python module for MPI volume decomposition and particle distribution

Features

  • Cartesian partitioning of a cubic volume (arbitrary dimensions) among MPI ranks

  • Equal area decomposition of the spherical shell (S2) among MPI ranks

  • distributing particle-data among ranks to the corresponding subvolume / surface segment

  • overloading particle-data at rank boundaries (“ghost particles”)

Installation

Installing from the PyPI repository:

pip install mpipartition

Installing the development version from the GIT repository

git clone https://github.com/ArgonneCPAC/mpipartition.git
cd mpipartition
python setup.py develop

Requirements

These packages will be automatically installed if they are not already present:

  • Python >= 3.8

  • mpi4py: MPI for Python

  • numpy: Python array library

  • numba: Python JIT compiler

Basic Usage

Check the documentation for an in-depth explanation / documentation.

# this code goes into mpipartition_example.py

from mpipartition import Partition, distribute, overload
import numpy as np

# create a partition of the unit cube with available MPI ranks
box_size = 1.
partition = Partition()

if partition.rank == 0:
    print(f"Number of ranks: {partition.nranks}")
    print(f"Volume decomposition: {partition.decomposition}")

# create random data
nparticles_local = 1000
data = {
    "x": np.random.uniform(0, 1, nparticles_local),
    "y": np.random.uniform(0, 1, nparticles_local),
    "z": np.random.uniform(0, 1, nparticles_local)
}

# distribute data to ranks assigned to corresponding subvolume
data = distribute(partition, box_size, data, ('x', 'y', 'z'))

# overload "edge" of each subvolume by 0.05
data = overload(partition, box_size, data, 0.05, ('x', 'y', 'z'))

This code can then be executed with mpi:

mpirun -n 10 python mpipartition_example.py

A more applied example, using halo catalogs from a HACC cosmological simulation (in the GenericIO data format):

from mpipartition import Partition, distribute, overload
import numpy as np
import pygio

# create a partition with available MPI ranks
box_size = 64.  # box size in Mpc/h
partition = Partition(3)  # by default, the dimension is 3

# read GenericIO data in parallel
data = pygio.read_genericio("m000p-499.haloproperties")

# distribute
data = distribute(partition, box_size, data, [f"fof_halo_center_{x}" for x in "xyz"])

# mark "owned" data with rank (allows differentiating owned and overloaded data)
data["status"] = partition.rank * np.ones(len(data["fof_halo_center_x"]), dtype=np.uint16)

# overload by 4Mpc/h
data = overload(partition, box_size, data, 4., [f"fof_halo_center_{x}" for x in "xyz"])

# now we can do analysis such as 2pt correlation functions (up to 4Mpc/h)
# or neighbor finding, etc.

Release files for mpipartition 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpipartition 1.5.0
File Size Uploaded
mpipartition-1.5.0.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mpipartition 1.5.0
File Interpreter ABI Platform
mpipartition-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / mpipartition-1.5.0.tar.gz

Download URL mpipartition-1.5.0.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b5d8e1cfce04dc54e986dc04a8bed5319a69d2eeb26fabe1440089eabf29b0f8
BLAKE2b-256 checksum
How to use checksums
e4b06ce9dc49717defa946d04bb15e4f078fead98dcfaa00140701d9abb72b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1012-azure

Release files / mpipartition-1.5.0-py3-none-any.whl

Download URL mpipartition-1.5.0-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b50d834a19da7cdf8221e9aa1bb1f351fd54dba75998276864a6a133cf4510f0
BLAKE2b-256 checksum
How to use checksums
f5799cfafc8eb58272df88586fc465d462ab975cfabbcb0b12ffba6563143be1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1012-azure

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page