Skip to content

Instantly share code, notes, and snippets.

@krischer
krischer / embarrassingly_parallel.py
Created June 21, 2015 09:38
Embarrassingly Parallel Code with MPI In Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple script illustrating how to perform embarrassingly parallel computations
in Python using MPI/mpi4py. I like this approach a lot as its very easy to get
right without having to deal with the complications arising from forked
processes which the multiprocessing module uses.
This script can be executed with or without `mpirun`; it will just run on one
core if not executed with it. With some more logic its also possible to make