References:
You need to have the following software properly installed in order to buildĀ MPI for Python:
A working MPI implementation, preferably supporting MPI-3 and built with shared/dynamic libraries. If you don't have an MPI implementation installed, for Linux you can install openMPI (an open source MPI implementation) using APT:
sudo apt install openmpi-bin openmpi-common libopenmpi-dev
Python 2.7, 3.5 or above.
python -m pip install mpi4py
or
python3 -m pip install mpi4py
Run the following command in your terminal:
mpirun -n 4 python -m mpi4py.bench helloworld
or
mpirun -n 4 python3 -m mpi4py.bench helloworld
The output should look like this (except for the username at the end):