This section describes the basic steps required to compile and link an MPI program using only the Intel MPI Library Development Kit. To compile and link an MPI program with the Intel MPI Library:
Ensure that the underlying compiler and related software appear in your PATH environment variable. For example, regarding the Intel® C++ Compiler and Intel® Fortran Compiler, execution of the appropriate set-up scripts will do this automatically:
...\bin\iclvars.bat
and
...\bin\ifortvars.bat
If you have added the architecture argument ia32 to the iclvars.bat and ifortvars.bat invocation as illustrated with the following examples:
...\bin\iclvars.bat ia32
and
...\bin\ifortvars.bat ia32>
then you will also need to use the same type of argument for ictvars.bat as follows:
...\ictvars.bat ia32
To revert back to the Intel® 64 architecture, use the following command in your command prompt:
...\ictvars.bat
Ensure that the underlying compiler and related software appear in your PATH. If you are using Intel compilers, ensure that the compiler library directories appear in LD_LIBRARY_PATH environment variable. For example, regarding the Intel® C++ Compiler and Intel® Fortran Compiler, the execution of the appropriate set-up scripts will do this automatically (the build number for the compilers might be something different than “composer_xe_2013.1.061” for your installation). For Intel® 64 architecture, call:
/opt/intel/composer_xe_2013.1.061/bin/iccvars.[c]sh intel64
and
/opt/intel/composer_xe_2013.1.061/bin/ifortvars.[c]sh inte64
For IA-32 architecture, call:
/opt/intel/composer_xe_2013.1.061/bin/iccvars.[c]sh ia32
and
/opt/intel/composer_xe_2013.1.061/bin/iccvars.[c]sh ia32
- Compile your MPI program using an appropriate mpi compiler command shown in the table below. For example, C code uses the mpiicc command as follows:
mpiicc<mpi-install-dir>\test\test.c
mpiicc<mpi-install-dir>/test/test.c
Other supported compilers have an equivalent command that uses the prefix mpi on the standard compiler command. For example, the Intel MPI Library command for the Intel® Fortran Compiler (ifort) is mpiifort.
Supplier of Core Compiler | MPI Compilation Command | Core Compiler Compilation Command | Compiler Programming Language | Support Application Binary Interface (ABI) |
---|---|---|---|---|
Microsoft Visual C++* Compiler or Intel C++ Compiler 11.1, 12.0, 12.1, and 13.0 | mpicc | cl.exe | C/C++ | 32/64 bit |
mpicl | cl.exe | C/C++ | 32/64 bit | |
mpiicc | icl.exe | C/C++ | 32/64 bit | |
Intel Fortran Compiler 11.1, 12.0, 12.1, and 13.0 | mpif77 | ifort.exe | Fortran 77 and Fortran 95 | 32/64 bit |
mpif90 | ifort.exe | Fortran 77 and Fortran 95 | 32/64 bit | |
mpifc | ifort.exe | Fortran 77 and Fortran 95 | 32/64 bit | |
mpiifort | ifort.exe | Fortran 77 and Fortran 95 | 32/64 bit |
Supplier of Core Compiler | MPI Compilation Command | Core Compiler Compilation Command | Compiler Programming Language | Support Application Binary Interface (ABI) |
---|---|---|---|---|
GNU* Compilers | mpicc | gcc, cc | C | 32/64 bit |
mpicxx | g++ version 3.x g++ version 4.x | C/C++ | 32/64 bit | |
mpif77 | f77 or g77 | Fortran 77 | 32/64 bit | |
mpif90 | gfortran | Fortran 95 | 32/64 bit | |
Intel C++ and Fortran Compilers versions 11.1, 12.0, 12.1, and 13.0 | mpiicc | icc | C | 32/64 bit |
mpiicpc | icpc | C++ | 32/64 bit | |
mpiifort | ifort | Fortran 77 and Fortran 95 | 32/64 bit |
NOTE:
The Compiling and Linking section of <mpi-install-dir> \doc\Getting_Started.htm<mpi-install-dir> /doc/Getting_Started.htm or the Compiler Commands section of <mpi-install-dir> \doc\Reference_Manual.htm<mpi-install-dir> /doc/Reference_Manual.htm on the system where Intel MPI Library is installed include additional details on mpiicc and other compiler commands, including commands for other compilers and languages.
You can also use the Intel® C++ Compiler, the Microsoft Visual C++ Compiler*, or the Intel Fortran Compiler directly. For example, on the master node of your cluster, go to a shared directory that contains the Intel® MPI Library test cases. For the test case test.c, you can build an MPI executable using the following command line involving the Intel C++ Compiler:
icl /Fetestc /I"%I_MPI_ROOT%\em64t\include" test.c "%I_MPI_ROOT%\em64t\lib\impi.lib"
The executable will be called testc.exe. This is a result of using the command-line option /Fe. The /I option references the path to the MPI include files. The library path reference is for the MPI library.
mpiexec-machinefile machines.Windows-n 4 testc.exe
The –machinefile parameter has a file name reference called machines.Windows. This file contains a list of node names for the cluster. The results might look something like:
Hello world: rank 0 of 4 running on clusternode1 Hello world: rank 1 of 4 running on clusternode2 Hello world: rank 2 of 4 running on clusternode3 Hello world: rank 3 of 4 running on clusternode4
If you have a version of the Microsoft Visual C++ Compiler that was not packaged with Microsoft* Visual Studio* 2010, use the following command line:
cl /Fetestc /I"%I_MPI_ROOT%\em64t\include" test.c "%I_MPI_ROOT%\em64t\lib\impi.lib" bufferoverflowU.lib
If you have a version of the Microsoft Visual C++ Compiler that was packaged with Microsoft* Visual Studio* 2008 or 2010, type the following command-line:
cl /Fetestc /I"%I_MPI_ROOT%\em64t\include" test.c "%I_MPI_ROOT%\em64t\lib\impi.lib"