Running an MPI Program
Before running an MPI program, place it to a shared location and make sure it is accessible from all cluster nodes. Alternatively, you can have a local copy of your program on all the nodes. In this case, make sure the paths to the program match.
Run the MPI program using the
command. The command line syntax is as follows:
mpiexec
> mpiexec -n <number-of-processes> -ppn <processes-per-node> -f <hostfile> myprog.exe
For example:
> mpiexec -n 4 -ppn 2 -f hosts myprog.exe
The
mpiexec
command launches the Hydra process manager, which controls the execution of your MPI program on the cluster.
In the command line above:
- -nsets the number of MPI processes to launch; if the option is not specified, or uses the number of cores on the machine.
- -ppnsets the number of processes to launch on each node; if the option is not specified, processes are assigned to the physical cores on the first node; if the number of cores is exceeded, the next node is used.
- -fspecifies the path to the host file listing the cluster nodes; alternatively, you can use the-hostsoption to specify a comma-separated list of nodes; if hosts are not specified, the local node is used.
- myprogis the name of your MPI program..exe
For the list of all available options, run
mpi
with the
exec
-help
option, or see section
mpiexec.hydra in the
Intel® MPI Library Developer Reference
.