# MPI support¶

PySM 3 can be executed in parallel over multiple nodes of a supercomputer with MPI.

The requirements to run with MPI are mpi4py and, just for distributed smoothing, libsharp.

The input maps are read from the first process in order to prevent overloading the filesystem, and then maps are distributed rings by rings across all processes, not overlapping.

The pysm.MapDistribution object takes care of handling the metadata about how the data are distributed.

When the emission is requested, each process independently computes the emission just on its own portion of the sky.

When smoothing is applied, libsharp is used to efficiently perform a distributed spherical harmonics transform.

Check pysm3_mpi.py <https://github.com/healpy/pysm/blob/master/mpi_examples/pysm3_mpi.py>__ from the repository as an example.

Execute with (remove # to actually execute it):

[1]:

#!mpirun -np 3 python pysm3_mpi.py