Compiling and Executing MPI programs on theHIVE

------------------------------------------------

theHive supports both mpich and lam software packages.
The mpich library can be used with cc, f77 and f95.
The lam library can be used with cc and f77.

Using MPICH:

Setting the Environment:

------------------------
In ".bash_profile" on drone:
PATH=$PATH:/usr/local/mpi/bin
MANPATH=$MANPATH:/usr/local/mpi/man
export PATH MANPATH
In ".bashrc" on each bee:
PATH=$PATH:/usr/local/mpi/bin
export PATH

MPICH programs are compiled and executed from the drone.

On drone:
---------
1. Compiling C programs
To compile a program hello.c:
% mpicc -o hello hello.c
Once the program has been compiled, the executable has to be copied to the bees. To copy the executable, ``hello'' to the directory $HOME/mpi_executables
% Pcp hello $HOME/mpi_executables
2. Compiling f77 programs
To compile a program hello.f:
% mpif77 -o hello hello.f
Once the program has been compiled, the executable has to be copied to the bees. To copy the executable, ``hello'' to the directory $HOME/mpi_executables
% Pcp hello $HOME/mpi_executables
3. Compiling f95 programs
To compile a program hello.f95
% f95 -I/usr/local/mpi_f90/include -c hello.f95
% f95 -o hello -L/usr/local/mpi_f90/lib/LINUX/ch_p4 hello.o -lpmpich -lmpich -L/usr/lib/gcc-lib/i386-linux/2.7.2.1 -lc -lgcc
% Pcp hello $HOME/mpi_executables
4. To execute the "hello" program on 8 processors of theHive:
% rsh b0 mpirun -np 8 $HOME/mpi_executables/hello

Using LAM:

Setting the Environment:

In ".bash_profile" on drone:
LAMHOME=/usr/local/lam
PATH=$PATH:$LAMHOME/bin
MANPATH=$MANPATH:$LAMHOME/man
export PATH MANPATH
In ".bashrc" on each bee:
LAMHOME=/usr/local/lam
PATH=$PATH:$LAMHOME/bin
export PATH

LAM MPI programs are compiled on the drone.

On drone:
1. Compiling C programs
To compile a program hello.c:
% hcc -o hello hello.c -lmpi
Once the program has been compiled, the executable has to be copied
to the bees.
To copy the executable, ``hello'' to the directory $HOME/mpi_executables
% Pcp hello $HOME/mpi_executables
2. Compiling fortran programs
To compile a program hello.f:
% hf77 -o hello hello.f -lmpi
Once the program has been compiled, the executable has to be copied
to the bees.
To copy the executable, ``hello'' to the directory $HOME/mpi_executables
% Pcp hello $HOME/mpi_executables

The MPI daemon has to be started on b0. Also, MPI programs are executed from b0.

On b0:
------
1. To verify that the cluster is bootable:
% recon -v
2. To start MPI daemons:
% lamboot -v
3. To test whether cluster and LAM are running:
% tping -c1 N
4. To execute program hello on b0 and b1
% mpirun -v n0-1 $HOME/mpi_executables/hello
5. To view full MPI synchronization status of all processes and messages:
% mpitask
6. To view status of messages pending:
% mpimsg
7. To remove all user processes and messages without rebooting:
% lamclean -v
8. To terminate MPI:
% wipe -v /usr/lam/boot/bhost.def
Always remember to execute this command when you finally logout of
the system in order to ensure that there are no leftover MPI
processes.

Udaya A. Ranawake / NASA GSFC / udaya@neumann.gsfc.nasa.gov