Examples:
% time python example_script.py
real 0m10.205s
user 0m0.080s
sys 0m0.035s
% time python example_script.py --threads=2
real 0m5.465s
user 0m0.096s
sys 0m0.049s
% time mpiexec -n 4 python example_script.py --mpi
real 0m5.131s
user 0m1.664s
sys 0m4.744s
I did a somewhat similar thing here, but a slightly different approach:
https://github.com/keflavich/FITS_tools/blob/master/FITS_tools/cube_regrid.py#L334
You'd think something as fundamental as parallel mapping would be easier to access from core libraries, no?