Introduction¶
The mpi_array python package provides a numpy.ndarray API to a Partitioned Global Address Space array which utilizes MPI (via mpi4py) for parallelism.
Quick Start Example¶
The following quickstart.py
script creates a zero-initialised array and
performs some element assignments:
import mpi_array as mpia
# creates zero-initialized PGAS (distributed) array
dary = mpia.zeros((1000, 1000, 1000), dtype="uint16")
# Add one to all elements of array
dary += 1
# Assign to slice
dary[250:750, :, 250:750] = 8
# ufuncs
dary[...] = mpia.power(dary, 1.0/3.0)
The quickstart.py
script can be executed serially
(single process) as:
python quickstart.py
or in parallel (using 8 processes) as:
mpirun -n 8 python quickstart.py
Installation¶
Using pip
from latest github source:
pip install --user git+git://github.com/mpi-array/mpi_array.git#egg=mpi_array
Requirements¶
Requires:
- python-2 version >= 2.7 or python-3 version >= 3.3,
- array_split version >= 0.4.0,
- psutil >= 4.3.0
- numpy version >= 1.13 (require __array_ufunc__ API),
- an MPI implementation which supports at least MPI-3 (such as OpenMPI, MPICH or Intel MPI)
- mpi4py version >= 2.0.
Testing¶
Run tests (unittest test-cases and doctest docstring test-cases) using:
python -m mpi_array.tests
or, from the source tree, run:
python setup.py test
Run tests with parallelism:
mpirun -n 8 python -m mpi_array.tests
Travis CI at:
Documentation¶
Latest sphinx generated documentation at readthedocs.org:
and at github gh-pages:
Sphinx documentation can be built from the source:
python setup.py build_sphinx
with the HTML generated in docs/_build/html
.
Latest source code¶
Source at github:
clone with:
git clone https://github.com/mpi-array/mpi_array.git
License information¶
See the file LICENSE.txt for terms & conditions, for usage and a DISCLAIMER OF ALL WARRANTIES.