User`s guide

Intel® MPI Library User’s Guide for Linux* OS
8
To compile your MPI program:
1. (SDK only) Make sure you have a compiler in your PATH. To find the path to your compiler, run
the which command on the desired compiler. For example:
$ which icc
/opt/intel/composerxe-2013/bin/intel64/icc
2. (SDK only) Compile a test program using the appropriate compiler driver. For example:
$ mpiicc -o myprog <installdir>/test/test.c
To run your MPI program:
1. Use the previously created hostfile and start the mpirun command as follows:
$ mpirun -n <# of processes> -f ./hostfile ./myprog
See the rest of this document and the Intel® MPI Library Reference Manual for more details.
2.4. Compiling and Linking
(SDK only)
To compile and link an MPI program with the Intel® MPI Library:
1. Ensure that the underlying compiler and related software appear in your PATH.
If you are using the Intel® Composer XE packages, ensure that the compiler library directories
appear in the LD_LIBRARY_PATH environment variable.
For example, for Intel® Composer, source the environment variable scripts to configure the
PATH and LD_LIBRARY_PATH appropriately:
2. Compile your MPI program using the appropriate mpi compiler script.
For example, to compile C code using the GNU* C compiler, use the following command:
$ mpicc -o myprog <installdir>/test/test.
where <installdir> is the full path to the installed package.
All supported compilers have equivalent commands that use the prefix mpi for the standard
compiler command. For example, the Intel MPI Library command for the Intel® Fortran Compiler
(ifort) is mpiifort.