New User Compiler Basic Usage

By Amanda K Sharp, Published: 10/17/2013, Last Updated: 09/10/2014

Compiler Methodology for Intel® MIC Architecture

New User Compiler Basic Usage

This chapter is intended for users that are new users of Intel compilers or are not very familiar with common compiler options used to control optimization, vectorization, and floating point calculations. It is important to understand basic use of the compiler, optimizations, vectorization, and the set of essential compiler options and their use. This chapter also covers important environment variables and pragmas/directives to control compilation and runtime characteristics.

If you are looking for information on configuring your workstation or host for Intel® Xeon Phi™ coprocessors (software drivers, firmware, Getting Started for your hardware configuration) GO HERE instead: Intel® Xeon Phi™ Coprocessor Developer's Quick Start Guides (Windows and Linux)


Users should learn how to get started compiling with the Intel® C/C++ Compiler and the Intel® Fortran Compiler. You should also be able to answer the question "where can I find product documentation for my compiler?".



Intel Compilers come with extensive documentation on compiler usage, compiler options, and language and library runtime details. In addition, Samples and Tutorials are available with the compiler for both C++ and Fortran to help you get started. 

Documentation: The compiler product User and Reference Guide also contains extensive documentation. Open the "Getting Started" document using the paths and links below:

Locate the "Getting Started" document for your compiler (Fortran or C++).  The following hyperlinks will only work if you are viewing this page from a system that has the Intel compilers installed in the default path of /opt/intel:

  • Fortran  <path to docs>/get_started_lf.htm
  • C/C++ <path to docs>/get_started_lc.htm

where <path to docs> is by default in directory /opt/intel/composerxe/Documentation/en_US

If for some reason you cannot access this directory with a web browser, you can also find this information online.  Visit

If you are able to access the document on your computer, you should familiarize yourself with the "Getting Started" content available in your product documentation. Bookmark this HTML page. Scrolling down, find the reference to the "User and Reference Guide" document. 

Whether online or from the installed documentation on you system, once you have found and opened the "User and Reference Guide" document, you will notice a navigation sidebar on the left-hand-side of your window.  If you are completely new to Intel compilers, start with the chapter "Getting Started".  Before moving on, the following topics should be well understood:

  1. Getting Started chapter, Using the Command Line, Using the compilervars File to Specify location of Components: In this chapter, the 'source intel64' source command to set paths correctly is essential.  Please familiarize yourself with setting paths properly, this is the most common source of beginner errors. So that you do not have to remember to enter this command for each session, this 'source' command should be added to your ~/.bashrc file.
  2. Getting Started chapter, Using the Command Line, Invoking the Intel .. Compiler: basic use of ifort, icc, and icpc.
  3. Compiler Reference chapter, Compiler Options:  lists compiler options by category.  However, If you know the compiler option you are interested in, you can use the 'Search' button to quickly find details on this specific option.
    Want to see an alphabetical list of options?  Hit the 'Index' button to list topics alphabetically.  After some macro definitions, if you scroll down you will find all the compiler options listed in this index ( hyphen-option ).

The information in the compiler User and Reference Guide is information generic to applications running on either Intel® Xeon® processors or the Intel® Xeon Phi™ coprocessor.  In subsequent chapters we will explore information unique and specific to programming for the Intel® Many Integrated Core Architecture (Intel® MIC Architecture).


Samples:  The best way to learn a new compiler is to try some simple programs as you explore compiler options and usage.  Do not try complex applications until you are comfortable with the compiler and it's options.  Samples are installed under the same root path as your compilers.  By default, this compiler root path directory is /opt/intel/composerxe/Samples/en_US/[C++ | Fortran].  Of course, if you have some simple applications you may wish to use these as you become familiar with the Intel compiler.  Samples are also referenced by the compiler Tutorials (see below).


Tutorials are ideal for those seeking a step-by-step method to learn compiler features using supplied Samples.

A list of tutorials for all Intel Developer Tools

Release Notes

The Release Notes include information about system requirements, product installation, new and changed features, and notes about features and problems not described in the product documentation.

Video Series

How-to videos contain detailed instructions on how to use the Intel Compilers within a specific environment or how to perform very basic optimization techniques. The Intel Software Tools webinars provide comprehensive overviews on vectorization and threading.

Let's Get Going!  Learning to use the Intel Compilers

Take Aways

You should be able to start creating or converting code to the  Intel® C/C++ and Fortran compilers.  You should be familiar with the source file 'compilervars' to set your path and library paths for correct use of the compiler.  You should be familiar with essential compiler options such as -O, -x, -ax, -qopt-report, -fp-model, -ansi-alias, -prof-gen/-prof-use, -ipo, -ip, -qopenmp, -parallel, -restrict and others.  You should be familiar with compiler directives/pragmas such as loop count, distribute, unroll, unroll_and_jam, and inline.


It is essential that you read this guide from start to finish using the built-in hyperlinks to guide you along a path to a successful port and tuning of your application(s) on Intel® Xeon Phi™ coprocessors. The paths provided in this guide reflect the steps necessary to get best possible application performance.

The next chapter, Efficient Parallelization covers parallelization techniques.

Attachment Size
quicklabs.tgz 31.9 KB
compiler-essentials-1.pdf 1.8 MB

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804