Compiling C, C++ and Fortran programs by using Intel compilers

Home
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.

Syntax:

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)

Compiling options:

-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

Compiling C program on Native application

Compiling fortran program on Native application

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

Compiling C program on offload application

Compiling fortran program on off application