Notes are given below.
MPICH 1.2.5 will compile out of the box. In the distribution directory you just type:
This assumes that you have a Fortran compiler. If you don't then you can add --nof77 on the configure line.
There are two scripts created that are used to compile "c" and "c++" mpi programs mpicc and mpiCC. Because the default OSX file system is not case sensitive one of these scripts will be overwrite. This can be avoided if you build MPICH on a Unix formated disk.
Assume you are a machine "geight" and you built MPICH in "/Volumes/unix/tkaiser/default/mpich-1.2.5." To run the program examples/basic/cpi
Create a file "p4pg.file" that contains:
local 0 geight 1 /Volumes/unix/tkaiser/default/mpich-1.2.5/examples/basic/cpi
Make cpi. Then type:
cpi -p4pg p4pg.file
You will get output from the program.
[geight:mpich-1.2.5/examples/basic] tkaiser% Process 0 of 2 on geight pi is approximately 3.1415926544231318, Error is 0.0000000008333387 wall clock time = 0.051736 Process 1 of 2 on geight
The default configure does not use shared memory to pass messages on dual processor machines. I have not had a lot of luck building MPICH to use shared memory to pass messages. It works on some machines with some compilers. You might want to try:./configure --with-comm=shared
Then to run the example as shown above replace the file "p4pg.file" with a file that contains a single line
If you only want to use "c" then there is a OSX Package available from the download page. It installs into /usr/local/bin and /usr/local/lib.
There are instructions for building the LAM version of MPI on the page:
Chapter 3 has the quick start instructions. The "bin" distribution does not include the startup utility mpiexec and I want to use the NAG Fortran compiler and I wanted to install in /usr/local so I did:
setenv FC /usr/local/bin/f95 ./configure --prefix=/usr/local --with-rsh="ssh -x" make sudo make install make examples
I then copied the examples cpi and fpi to my home directory. I created the machine list file "mlist" also in my home directory. I ran the examples using the commands:mpiexec -machinefile mlist cpi
You need to have perl version 5.8 installed to build and use mpiexec.
It looks like LAM/MPI will uses shared memory to communicate between tasks on the same machine.