Compiling C, C++ and Fortran programs on Xeon Phi using Intel compilers

Home

Intel compilers are installed on Xeon server in the PDS Lab.

I
n 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 -qopenmp flag.

Syntax:

icc <-mmic> source_code.c -o exec_code                   (Compile C code)

icpc <-mmic> source_code.cpp -o exec_code             (Compile Cpp code)

ifort <-mmic> source_code.f90 -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