→ Make sure passwordless ssh access is enabled: start "Remote Login" under System Preferences/Sharing, then generate a public/private dsa key pair.
ssh-keygen -t dsa [tap enter three times] cp $HOME/.ssh/id_dsa $HOME/.ssh/authorized_keys2
→ Then try
ssh localhost, which should go through without a password.
→ Install MPICH1.
curl http://www-unix.mcs.anl.gov/mpi/mpich1/downloads/mpich.tar.gz \ > mpich.tar.gz tar zxf mpich.tar.gz cd mpich-1.2.7p1 ./configure --with-device=ch_p4 -rsh=ssh --prefix=$HOME make make install cd ..
→ Make sure $HOME/bin is in your PATH.
→ Install mpi4py.
curl http://pypi.python.org/packages/source/m/mpi4py/mpi4py-0.5.0.tar.gz \ > mpi4py.tar.gz tar zxf mpi4py.tar.gz cd mpi4py-0.5.0 python setup.py install --prefix=$HOME ln -s /Library/Frameworks/Python.framework . [this seems to be needed on Tiger with Python 2.5] python setup.py build_exe cp build/exe.macosx-10.3-fat-2.5/mpi4py $HOME/bin/. cd ..
$HOME/bin/mpi4py is now a parallelized Python interpreter that needs to be used with
mpirun instead of
→ Now we're all set; as a test, we can run
mpi4py-0.5.0/tests/helloworld.py. Because of mpich1's peculiarities,
mpirun needs to be given the explicit location of
mpirun -np 4 $HOME/bin/mpi4py helloworld.py
→ Alas, this fails, because
mpirun does not pass the correct environment (including
PYTHONPATH to the slaves. One possibility is to hardwire the
PYTHONPATH in the python script, adding something like this at the top:
import sys, os sys.path.append(os.environ['HOME'] + '/lib/python2.5/site-packages')
© M. Vallisneri 2012 — last modified on 2010/01/29
Tantum in modicis, quantum in maximis