MPI/Python

Leopold Grinberg's Lecture Material

MPI Resources

MPI Libraries

Python

MPI programming with pypar

Step 1: Install Python 2.5

Create a directory, eg ~/am258, move the file Python-2.5.tar.bz2 into the directory and issue the following commands:

$ export AM258=`pwd`
$ bunzip2 -c Python-2.5.tar.bz2 | tar x
$ cd Python-2.5
$ ./configure --prefix=$AM258 --enable-shared
$ make
$ make install
$ cd ..
$ echo "export AM258=$AM258" > am258.env
$ echo 'export PATH=$AM258/bin:${PATH}' >> am258.env
$ echo 'export LD_LIBRARY_PATH=$AM258/lib' >> am258.env
$ source am258.env

You can source the file am258.env whenever you want to use this python and the other packages.

Step 2: Install LAM/MPI

While in the directory created in the previous step issue the following commands (make sure you have sourced am258.env):

$ bunzip2 -c lam-7.1.3.tar.bz2 | tar x
$ cd lam-7.1.3
$ ./configure --prefix=$AM258 --enable-shared --without-fc
$ make
$ make install
$ cd ..
$ echo 'localhost' > bhost-file

Step 3: Install Numeric

$ gunzip -c Numeric-24.2.tar.gz | tar x
$ cd Numeric-24.2
$ python setup.py build
$ python setup.py install

Step 4: Install Pypar

$ gunzip -c pypar_1_9_2.tgz | tar x
$ cd pypar_1_9_2
$ python setup.py build
$ python setup.py install

Step 5: running mpi/python programs

At this point you want to create a file with just one line "localhost" this is the bhost file used to invoke lamboot:

$ lamboot -v bhostfile

Now you can run any mpi program including python scripts using pypar:

$ mpirun -np 4 python demo.py

Examples

Files from the lecture [tar.gz]