ATPESC Minutes, 29 July Day 2 Evening - ahmadia/atpesc-2013 GitHub Wiki

MPICH Hands-On

Bill Gropp's Exercises

Aron's Get mpi4py Going on Vesta Guide

All the way from scratch! Debugged by Max Katz

You'll need to resoft against mpiwrapper-gcc, this stuff doesn't work by default against xlc.

You need Cython to build mpi4py from source.

Navigate here to get src https://code.google.com/p/mpi4py/source/checkout

Install Cython

mkdir -p ~/.local/lib/python2.6/site-packages
easy_install --prefix=~/.local/ cython
#aron's checkout command
hg clone https://[email protected]/p/mpi4py/ 

Or you can build from the latest release:

wget https://mpi4py.googlecode.com/files/mpi4py-1.3.tar.gz
cd mpi4py
# only run this if you are building from source
python setup.py build

This will fail after Cythonization, you can halt it as soon as it starts trying to compile things.

now call the hostpython compiler to do the build

/bgsys/tools/Python-2.6/bin/hostpython setup.py build

Okay, assuming that worked, you're ready to submit a job.

  • PYTHONPATH for running (assuming you unpack mpi4py at top level):

You don't need want to set this, but we'll use this path in the job command

PYTHONPATH=~/mpi4py/build/lib.linux-ppc64-2.6
  • python to run on compute nodes, again don't call this, we use it below

/bgsys/tools/Python-2.6/bin/python

  • Command to run
qsub -A ATPESC2013 -n 4 -t 10 --env=PYTHONPATH=$HOME/mpi4py/build/lib.linux-ppc64-2.6 \
/bgsys/tools/Python-2.6/bin/python ~/mpi4py/demo/helloworld.py

It's essential that PYTHONPATH contain an "absolute path", in this case we dereference the HOME environment variable. The BG/Q Python otherwise receives no environment variables, and won't be able to figure out what to do with something like ~.

sample output

Hello, World! I am process 2 of 4 on Task 2 of 4 (0,0,0,1,0,0)  R00-M1-N01-J13.
Hello, World! I am process 1 of 4 on Task 1 of 4 (0,0,0,0,1,0)  R00-M1-N01-J06.
Hello, World! I am process 0 of 4 on Task 0 of 4 (0,0,0,0,0,0)  R00-M1-N01-J01.
Hello, World! I am process 3 of 4 on Task 3 of 4 (0,0,0,1,1,0)  R00-M1-N01-J10.