Re: [Pympi-users] starting from scratch
Status: Alpha
Brought to you by:
patmiller
From: Pat M. <pat...@ll...> - 2005-06-10 17:49:35
|
I've answered build questions below, but thought I would add a bit on pyMPI in the classroom first... I've used pyMPI in a classrooom environment.... I think its a great way to learn about MPI without the hassle of doing it with C or Fortran. I was able to concentrate on the parallelism instead of burying the students in the opaque API requirements [but Prof Miller, whats a communicator? whats a tag? why do I have to specify the type?] This is particularly spiffy since pyMPI hides a lot of spurious arguments, so you can introduce point-to-point with something as simple as: % mpirun -np 2 pyMPI Python 2.4 (pyMPI 2.4b1) on linux2 Type "help", "copyright", "credits" or "license" for more information. Python 2.4 (pyMPI 2.4b1) on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from mpi import * >>> if rank == 0: ... send("hello",1) ... else: ... print recv() ... ('hello', <MPI_Status Source="0" Tag="0" Error="0" MPI: no errors\>) >>> The good news is that students (after using only pyMPI) were able to transfer all their knowledge back to C and FORTRAN parallel programming. Cheers! Pat --------- %< -------------------------------------------------- The basic requirements for pyMPI are (not surprisingly ;-) ), Python and a MPI C compiler (or appropriate includes and libraries). I think there is a debian package for LAM MPI (see http://packages.debian.org/testing/source/lam ) This installs several things, but the only ones you likely need to know will be lamboot, mpirun, mpicc. Now make sure the Python was installed with development options: You can run this command to find out python's install root... % python -c "from distutils.sysconfig import parse_makefile, get_makefile_filename; print parse_makefile ( get_makefile_filename ( ) ) ['prefix']" /usr/local Now look to see if the install things are there... (the below assumes python2.4, the path is similar for 2.1, 2.2, 2.3). % ls /usr/local/include/python2.4/Python.h /usr/local/includ I've used pyMPI in a classrooom environment.... I think its a great way to learn about MPI without the hassle of doing it with C or Fortran. I was able to concentrate on the parallelism instead of thee/python2.4/Python.h % ls /usr/local/lib/python2.4/config Makefile Setup.config config.c install-sh* makesetup* Setup Setup.local config.c.in libpython2.4.a python.o If you don't see those files, then you may need to build Python from scratch. Now to build a version of pyMPI that uses those tools.... First, use which to make sure you are using. % which mpicc /usr/local/bin/mpicc % which python /usr/local/bin/python % cd pyMPI-2.4b1 % env CC=/usr/local/bin/mpicc ./configure --prefix=/where/ever --with-python=/usr/local/bin/python % make % make install % make check using the env CC=xyz ensures that the configure will pick the parallel mpi compiler you want [similarly the --with-python]. If you don't pick a installation prefix, it is supposed to default to the same place python is installed. If you download the latest and greatest directly from CVS, you need to do % ./boot before you do the % ./configure [this bootstraps the autoconf environment]. ---------%<---------------------------------- To run, you should do % lamboot % mpirun -np 2 pyMPI myscript.py if you want to run across a cluster, you set up a machines file in bhost format (do a % man bhost for info) % cat machines tux132 tux147 You also need to either have to be running rsh or you must set up ssh keys for passwordless login. % ssh-keygen -t dsa <blah blah blah> % cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys If you have any problems, let me know. Cheers, Pat -- Pat Miller | (925) 423-0309 | http://www.llnl.gov/CASC/people/pmiller In order that people may be happy in their work, these three things are needed: they must be fit for it; they must not do too much of it; and they must have a sense of success in it. -- John Ruskin |