Compiling C, C++ and Fortran programs by using Intel compilers
Intel compilers are installed on Xeon server in the PDS Lab.
In order to compile a C/C++ code to an Intel Xeon Phi executable, Intel compilers must be given the argument –mmic for native mode. The same way, for openMP application we must use -openmp flag.
icc <-mmic> source_code -o exec_code (Compile C code)
icpc <-mmic> source_code -o exec_code (Compile Cpp code)
ifort <-mmic> source_code -o exec_code (Compile fortran code)
-mmic: Used only for compiling the code as a native application, i.e., run on Intel Xeon Phi coprocessor.
-o <file>: place
the output into <file>. If this option is omitted, the compiler
will create executable program named a.out in working directory.
Compiling Native Application
Native execution occurs when an application runs entirely on an Intel Xeon Phi coprocessor.
Generraly we use extension .mic in the exec_code name for native applications.
Compiling C++ program on Native application
- icpc -mmic mm-nat.cpp -o mm-nat.mic
Compiling C program on Native application
- icc -mmic mm-nat.cpp -o mm-nat.mic
Compiling fortran program on Native application
- ifort -mmic mm-nat-omp.f90 -o mm-nat.mic
Compiling Offload Application
Offload applications run on the
host and employ the MIC (Many Integrated Core) architecture by
transferring only some of the data and functions to the coprocessors.
in this case -mmic argumet is not used by the compilers.
The process of data and code transfer to the coprocessor is generally
called offload, and applications using this procedure are known as offload applications.
Compiling C++ program on offload application
- icpc mm-nat-omp.cpp -o mm-nat
Compiling C program on offload application
- icc mm-nat-omp.cpp -o mm-nat
Compiling fortran program on off application
- ifort mm-nat-omp.cpp -o mm-nat