Running MPI Programs
- To compile your .c program:
mpicc -o filename filename.c
This should create the executable file.
Use mpiCC -o filename filename.cpp for C++ programs
(note: the Cray can only compile .c MPI programs, not .cpp MPI programs)
- CREATE A HOST FILE:
Sample file (called "hostfile") -
yourcomputer.tjhsst.edu
deadend.tjhsst.edu
helium.tjhsst.edu
- Check if these can connect correctly:
recon -v hostfile
- If this works okay, run the mpi system:
lamboot -v hostfile
- Run the executable:
mpirun N filename This runs your program on all the processors in your
hostfile
mpirun -np 4 filename This runs your program on 4 processes
OR USE: mpirun -O N filename
The N means "run it on all the machines in your hostfile."
-O indicates that all the machines that you will be running on
are homogenous -- no data conversions need to be made. This is
not necessary, but can make your program run faster, since LAM
will not check to see if endian conversions need to be made.
( -c 4 specifies the number of processes, 4 in this case)
This information comes from Running LAM/MPI
Also see "mpirun -c and mpirun -np -- what's the difference?"
- lamclean can be used to in between different runnings of your program
- To leave mpi:
lamhalt OR lamwipe
MPI Resources