| Author: |
Timothy Kaiser, Ph.D. tkaiser@sdsc.edu |
| Revised: | July 24, 2003 |
Much of the information on this page is dated. The information about password-less ssh and network address resolution is still important. For information about more recent developments in running MPI on OSX see:
http://www.sdsc.edu/~tkaiser/mac_stuff/new_mpi.htmlThere is also a new note on how I set up my local area network to enable MPI to work without having a domain name server. See:
http://www.sdsc.edu/~tkaiser/mac_stuff/mac_setup.htmlThis document discusses compiling and running MPI under Macintosh OS X 10.1, in particular, the MPICH version of MPI using P4. If you don't know what P4 is, don't worry.
tar -xf mpich.tar"on the command line.
tar -xf mpich.tar"on the command line.
nslookup "your IP address"
[mac:~] tkaiser% nslookup 132.249.65.138
Server: ns1.sdsc.edu
Address: 198.202.75.26
Name: dhcp-65-138.sdsc.edu
Address: 132.249.65.138
There is a mapping between my address, 132.249.65.138
and dhcp-65-138.sdsc.edu. The P4 device will not work
without such a mapping.
~/.ssh/identity.pub Do this on all of the machines
of interest. Concatenate the identity.pub files from each machine
into a single file and put a copy in
~/.ssh/authorized_keys
on all of your machines.
[mac:~/.ssh] tkaiser% cat config
Protocol 1,2
setenv CFLAGS -fno-common
setenv RSHCOMMAND /usr/bin/ssh
setenv USERF77 /Applications/Absoft/bin/f77
setenv F77 "f77 -N109"
./configure --with-device=ch_p4 -with-arch=LINUX --with-comm=ch_p4 --without-romio --enable-f77
setenv CFLAGS -fno-common
setenv RSHCOMMAND /usr/bin/ssh
./configure --with-device=ch_p4 -with-arch=LINUX --with-comm=ch_p4 --without-romio --disable-f77
make mpilib
you will get messages like
ranlib: file: $HOME/mpich-1.2.2.3/lib/libmpich.a(sendutil.o) has no symbols
This does not appear to be a problem.
[mac:~/mpich-1.2.2.3] tkaiser%cd src/fortran
[mac:~/mpich-1.2.2.3] tkaiser%make flibs
When finished, your mpi library should be in lib
[mac:~/mpich-1.2.2.3] tkaiser% ls -lt $HOME/mpich-1.2.2.3/lib/*a
-rw-r--r-- 1 tkaiser staff 197692 Nov 20 20:28 libfmpich.a
-rw-r--r-- 1 tkaiser staff 1376332 Nov 20 20:28 libmpich.a
-rw-r--r-- 1 tkaiser staff 9048 Nov 20 20:28 libmpichfsup.a
-rw-r--r-- 1 tkaiser staff 198076 Nov 20 20:28 libpmpich.a
B
[mac:~/mpich-1.2.2.3] tkaiser%ranlib $HOME/mpich-1.2.2.3/lib/*a
or, if you did not "setenv CFLAGS -fno-common" add the "-c" option
[mac:~/mpich-1.2.2.3] tkaiser%ranlib -c $HOME/mpich-1.2.2.3/lib/*a
cp $HOME/mpich-1.2.2.3/util/mpiCC $HOME/mpich-1.2.2.3/bin/mpicc
(NOTE CASE an the above command)
cd $HOME/mpich-1.2.2.3/examples/basic
If you do a make of "cpi" you should get an executable. For example:
[mac:~/mpich-1.2.2.3/examples/basic] tkaiser% make cpi
/Users/tkaiser/mpich-1.2.2.3/bin/mpicc -c cpi.c
/Users/tkaiser/mpich-1.2.2.3/bin/mpicc -o cpi cpi.o -lm
[mac:~/mpich-1.2.2.3/examples/basic] tkaiser%
For Fortran you get
[mac:~/mpich-1.2.2.3/examples/basic] tkaiser% make fpi
/Users/tkaiser/mpich-1.2.2.3/bin/mpif77 -c fpi.f
FORTRAN 77 Compiler 7.0, Copyright (c) 1987-2001, Absoft Corp.
/Users/tkaiser/mpich-1.2.2.3/bin/mpif77 -o fpi fpi.o
[mac:~/mpich-1.2.2.3/examples/basic] tkaiser%
I captured the steps given above (except checking that the Fortran Unix library links) and put
them in a script. The script assumes that it and the mpich.tar file are in
the same directory.
#!/bin/csh -f
setenv MPI_DIR $PWD/mpich-1.2.2.3
tar -xf mpich.tar
cd $MPI_DIR
setenv CFLAGS -fno-common
setenv RSHCOMMAND /usr/bin/ssh
setenv USERF77 /Applications/Absoft/bin/f77
setenv F77 "f77 -N109"
./configure --with-device=ch_p4 -with-arch=LINUX --with-comm=ch_p4 --without-romio --enable-f77
make mpilib
cd src/fortran
make flibs
ranlib $MPI_DIR/lib/*a
cp $MPI_DIR/util/mpiCC $MPI_DIR/bin/mpicc
cp $MPI_DIR/mpid/ch_p4/p4/lib/p4_globals.o $MPI_DIR/lib/p4_globals.o
cd $MPI_DIR/examples/basic
make cpi
make fpi
cp cpi ~
Then we go there.
cd ~
Now use scp to copy your application to all machines that you
want to use to run your job. For example I will copy to a machine
called peloton.
scp cpi peloton:cpi
where peloton is the name of a machine. If you are asked for
a password when you do this go back and look at the section for
setting up password-less logins.
cpi -p4pg cpi.p4pg
local 0
peloton 1 /Users/tkaiser/cpi
ozark 1 /Users/tkaiser/cpi
In theory, we can run multiple tasks on a single node and have
the tasks swap messages using shared memory. (I don't have
a multiple processor Mac so there is not a lot of use in doing
this so I built MPICH with sharing memory turned off.)
[mac:~] tkaiser% cpi -p4pg cpi.p4pg
Process 0 of 3 on mac.sdsc.edu
pi is approximately 3.1416009869231254, Error is 0.0000083333333323
wall clock time = 0.010493
Process 1 of 3 on ozark.sdsc.edu
Process 2 of 3 on peloton.sdsc.edu
[mac:~] tkaiser%