[MPICH] recompile with -fPIC

Paul Van Allsburg vanallsburg at hope.edu
Tue Aug 7 10:20:44 CDT 2007

>>I've been asked to port a Mandelbrot example written in c to perl - to
>>prepare an exercise to get students familiar with the
>>ideas of writing parallel/distributed code. Perl is what the students will
>>be learning in the course.
>>I have:
>>        installed MPICH release (1.2.7p1) required by the Perl
>>Parallel:MPI module
>>        installed mpiexec-0.82 from OSC, required interface to PBS
>>        compiled the mandelbrot c code with the MPICH mpicc wrapper and
>>successfully ran it using PBS.
>>Next steps:
>>(fail) install the Parallel:MPI code & test,
>>        begin porting the Mandelbrot example...
I found the problem in an earlier install(2006) of lam-mpi had placed mpi.h files in /usr/include that caused the Parallel::MPI 
install script to fail.  I changed a few lines in Makefile.PL for parallel:MPI from:
$MPIDIR = "/usr/local/mpich/include";
foreach (qw(/usr/mpich/include /usr/local/mpich/include
            /usr/include/mpi /usr/local/include/mpi
            /usr/lib/mpich/include /usr/local/lib/mpich/include))
$MPIDIR = "/usr/local/mpich/include";
foreach (qw(/usr/local/mpich/include))

In brief- I did this:

   get MPICH current release (1.2.7p1)  from http://www-unix.mcs.anl.gov/mpi/mpich1/download.html

wget http://www-unix.mcs.anl.gov/mpi/mpich1/downloads/mpich.tar.gz
gunzip mpich.tar.gz
tar -xf mpich.tar
cd /home/vanallp/mpich-1.2.7p1
make clean

./configure --with-device=ch_p4 --prefix=/usr/local/mpich --enable-sharedlib | tee config.out
make  | tee make.out
su - root
cd /home/vanallp/mpich-1.2.7p1
make install  |  tee make-install.out

- now get the correct mpicc in my path

PATH="/usr/local/mpich/bin:$PATH";export PATH


PATH="/usr/local/mpich/bin:$PATH";export PATH
wget http://www.osc.edu/%7Epw/mpiexec/mpiexec-0.82.tgz
gunzip  mpiexec-0.82.tgz
tar -xf  mpiexec-0.82.tar
cd /home/vanallp/mpiexec-0.82
make clean
rm test*
./configure --with-pbs=/usr/local --with-default-comm=mpich-p4  --disable-p4-shmem --prefix=/usr/local/osc | tee config.out
make  | tee make.out
make hello   | tee make-hello.out
su - root
cd /home/vanallp/mpiexec-0.82
make install  | tee make-install.out

- TESTING  Parallel - Mendelbrot - Master / Slave:
    test mpich & mpiexec with an example in c

cp -R /usr/local/lam-7.1.3/examples/mandelbrot .
cd  mandelbrot
mpicc -o master master.c
mpicc -o slave slave.c

  - my PBS ms.sh script:

#PBS -N ms
#PBS -l nodes=4
#PBS -j oe
PATH="/usr/local/mpich/bin:$PATH";export PATH
alias mpiexec='/usr/local/osc/bin/mpiexec -verbose'
mpiexec -config /home/vanallp/mpi/mpich/ms.config

   - my mpiexec config file: ms.config
-n 1   : /home/vanallp/mpi/mpich/mandelbrot/master
curie* : /home/vanallp/mpi/mpich/mandelbrot/slave

- submit job to cluster:
qsub ms.sh
produces --> /home/vanallp/mandel.out   Sun rasterfile formatted file. Try viewing it with eog or xloadimage:

start Xming or CygwinXsvr on windows desktop,
$ eog
$ xloadimage mandel.out

- INSTALL Perl Parallel::MPI module

wget http://search.cpan.org/CPAN/authors/id/J/JO/JOSH/Parallel-MPI-0.03.tar.gz
tar -zxf Parallel-MPI-0.03.tar.gz
cd Parallel-MPI-0.03
perl Makecurie.PL | tee makecurie.out  <-THIS IS THE MODIFIED Makefile.PL
make  |  tee make.out
make test | tee make-test.out
su - root
cd /home/vanallp/Parallel-MPI-0.03
make install | tee make-install.out

I also came across a perl parallel example for this specific port by Josh Wilmes and Chris Stevens,
that runs successfully.


Paul Van Allsburg
Computational Science & Modeling Facilitator
Natural Sciences Division,  Hope College
35 East 12th Street
Holland, Michigan 49423

More information about the mpich-discuss mailing list