My favorites | Sign in
Project Logo
                
Search
for
Updated Feb 09, 2007 by steder
Labels: Featured
Installation  
MaroonMPI Installation instructions

MaroonMPI Installation

Prerequisites

You will need the following packages installed:

To avoid possible problems MPI must be compiled with shared library support! The mpicc command (usually included as part of the MPI Library install)

To avoid possible problems Python must be compiled with shared library support Numeric Python, Numpy or Scipy.Core( one of the Python array packages )

I recommend installing MPICH2 and Python2.4. However, you should be fine with earlier versions. Sorry not to go into more detail on installing these prerequisites but installing MPICH and Python can be non-trivial and is definitely well beyond the scope of this page.

Step 1: Compile

Assuming you have the prerequisites installed you should be able to compile MMPI using the included distutils setup.py script.

You will need to specify your "flavor" of Python Arrays (Numeric, Numarray, or Numpy) along with the name(or path) of your mpicc executable. You MUST specify your version of Python Arrays and if the mpicc you want to use is not in your path you should specify it as well.

If you do not know the path of your mpicc you can determine the path by running the nix command which.

For instance:

$ which mpicc
/usr/local/bin/mpicc

If you don't know where your mpicc is installed you'll have to find that out before we continue.

Now you should just be able to execute the following command to build the package:

$ python setup.py --with-array=Numeric --with-mpicc=mpicc build

(Note about the above command: In this example, "Numeric", not "Numarray" or "numpy" is the name of the installed Python array package. Additionally, "mpicc" is the name of your C compiler that links with MPI, and it is in your path.

Another build command that's slightly more complex:

$ python setup.py --with-array=numpy --with-mpicc=/usr/local/bin/mpicc build

(Another Note about the above commands: We're assuming that "python" is the name of your Python 2.3+ executable. As with mpicc, if this does not exist or is called something else on your system you will need to figure out the appropriate value before we can continue.)

If all goes well you should see the following:

steder@Penzilla mikempi $ python setup.py build
['mmpi_module.c']
Running MMPI setup...
Python: /usr/bin/python
Version: 2.4.2 (#1, Oct 31 2005, 12:11:31)
[GCC 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8)]
running build
running build_py
running build_ext
building '_mpi' extension
/usr/local/bin/mpicc -fno-strict-aliasing -DNDEBUG -g -fPIC -Wall -ansi -DNDEBUG -fPIC -I/usr/in
clude/python2.4 -c mmpi_module.c -o build/temp.linux-i686-2.4/mmpi_module.o
mmpi_module.c: In function `mmpi_init':
mmpi_module.c:216: warning: unused variable `dimensions'
mmpi_module.c:216: warning: unused variable `data'
mmpi_module.c:331:2: warning: #warning "TODO:  Define doc strings for: mpi_error, mpi_wtick, 
mpi_wtime"
mmpi_module.c: At top level:
            [SNIP] Some warnings removed [/SNIP]
mmpi_module.c:70: warning: 'mmpi_get_processor_name' declared `static' but never defined
mmpi_module.c:71: warning: 'mmpi_get_version' declared `static' but never defined
/usr/local/bin/mpicc -pthread -shared -DNDEBUG -g -fPIC -Wall -ansi -DNDEBUG build/temp.linux
-i686-2.4/mmpi_module.o -o build/lib.linux-i686-2.4/mpi/_mpi.so

The above warnings may mention undefined functions and TODO:'s. These warnings are nothing to worry about, they are simply there as reminders(to the developers) of things that will be added in future versions.

Step 2: Install

At this point all you should have to do is type:

$ python setup.py install

By default that will try to install in the site-packages directory of whichever Python you used to run the setup.py script. If you'd like to install in a different place (perhaps you don't have adminstrator privileges on the computer you are installing on) you can use:

$ python setup.py --install-lib="/some/other/path/"

Step 3: Check

Now that you've got MMPI installed we should do a quick test to see if it's working. Try the following in Python:

import Numeric
import mpi
A = Numeric.ones( 12, 'i' )
rank,size = mpi.init()
request = mpi.isend( A, 12, mpi.MPI_INT, 0, 0, mpi.MPI_COMM_WORLD )
B = mpi.recv( 12, mpi.MPI_INT, 0, 0, mpi.MPI_COMM_WORLD )

Optional: Troubleshooting

At the moment I don't have any troubleshooting tips but this is where they'll go when I do.

Problems?

Earlier I mention that the MPI Libraries and Python should be compiled with support for shared libraries. The reason that I recommend this is that certain applications that need multiple language support (i.e. A Python Program that uses Compiled C or Fortran extension codes that make calls into MPI ) will not work properly if they are statically linked. Specifically, each language will have to initialize and use its own copy of of the MPI libraries. This makes communicators passed between languages completely invalid. If this doesn't make a whole lot of sense feel free to e-mail me and I'll illustrate it more completely with an example.

For now it's enough to keep this in mind and try to use dynamic libraries when you can.

© m. steder (2006)


Sign in to add a comment
Hosted by Google Code