IPython Parallel is the IPython API for parallel computing. We will set it up to use MPI for message passing. We may have to set environment variables as follows:
$ export LC_ALL=en_US.UTF-8 $ export LANG=en_US.UTF-8
Issue the following command at the command line:
$ ipython profile create --parallel --profile=mpi
The preceding command will create a file in our home directory, which can be found at .ipython/profile_mpi/iplogger_config.py
.
Add the following line in this file:
c.IPClusterEngines.engine_launcher_class = 'MPIEngineSetLauncher'
Start a cluster that uses the MPI profile as follows:
$ ipcluster start -–profile=mpi --engines=MPI --debug
The preceding command specifies that we are using the mpi
profile and MPI engine with debug-level logging. We can now interact with the cluster from an IPython Notebook. Start a notebook with plotting enabled and with NumPy, SciPy, and matplotlib automatically imported as follows:
$ ipython notebook --profile=mpi --log-level=DEBUG...