Setting Up the Build Environment for Using Intel® C++ or Fortran Compilers

Intel® Parallel Studio XE for Windows*

Follow these steps to invoke the Intel® C++ Compiler or the Intel® Visual Fortran Compiler from the command line:

  1. Open a command prompt.

    Windows 8.x and Windows 10

    1. From the Start screen, swipe up from the bottom edge or click the arrow to move the Apps screen.

    2. In the Apps screen, scroll to the right until you find the Intel Parallel Studio XE 201X group.

    3. Click Intel 64 Visual Studio mode or IA-32 Visual Studio mode to open a command window on the Desktop.

    Other versions of Windows*

    • Click the appropriate mode from Start > All Programs > Intel Parallel Studio XE 201X > Compiler and Performance Libraries > Command prompt with Intel Compilers.

  2. From the command window, invoke the compilers as follows:

    icl [options... ] inputfile(s) [/link link_options]

    ifort [options... ] inputfile(s) [/link link_options]

    Use the command icl /help or ifort /help to display all available compiler options.

Intel® Parallel Studio XE for Linux, for OS X*

This also applies to Intel® C++ Composer XE for Linux, Intel® Fortran Composer XE for Linux, Intel® C++ Composer XE for OS X* and Intel® Fortran Composer XE for OS X*.

Before you can use these tools, you must first set the environment variables by running the compiler environment script compilervars.sh or compilervars.csh with an argument that specifies the target architecture.

The following procedure uses the compilervars.sh script:

  1. Open a terminal session.

  2. Run the compiler environment script compilervars.sh:

    Intel Parallel Studio XE 2016 or later

    • source <install-dir>/<arch>/bin/compilervars.sh <arg>

      where <install-dir> is the directory structure containing the compiler /bin directory, <arch> is either linux or mac, and <arg> is one of the following architecture arguments:

      • intel64: Compilers and libraries for Intel® 64 architectures only

      • ia32: Compilers and libraries for IA-32 architectures only

      Note: The default path for <install-dir> is 
      /opt/intel/compilers_and_libraries_201X.

    Intel Parallel Studio XE 2015 or Intel Composer XE

    • source <install-dir>/bin/compilervars.sh <arg>

      where <install-dir> is the directory structure containing the compiler /bin directory, and <arg> is one of the following architecture arguments:

      • intel64: Compilers and libraries for Intel® 64 architectures only

      • ia32: Compilers and libraries for IA-32 architectures only

      Note: The default path for <install-dir> is /opt/intel/composer_xe_201X.

Intel® System Studio

Before you invoke the compiler component of the Intel® System Studio you must set certain environment variables that define the location of compiler-related components.

The Intel® C++ Compiler includes the compilervars scripts that you can run to set environment variables.

  • On Windows*, the file is a batch file called compilervars.bat.
  • On Linux*, the file is a shell script called compilervars.sh or compilervars.csh.

The following information is operating system dependent.

Intel® System Studio for Windows*

Under normal circumstances, you do not need to run the compilervars.bat batch file. The Intel® C++ command-line window sets these variables for you automatically.

NOTE: You need to run the batch file if a command-line window is opened without using one of the provided menu items in the Start menu, or if you want to use the compiler from a script of your own.

The batch file inserts the directories used by the Intel® C++ Compiler at the beginning of the existing paths. Because these directories appear first, they are searched before any directories in the path lists provided by Windows*. This is especially important if the existing path includes directories with files having the same names as those needed by the Intel® C++ Compiler.

If needed, you can run compilervars.bat each time you begin a session on Windows* systems by specifying it as the initialization file with the PIF Editor.

The syntax for using the compilervars batch file is as follows:

> compilervars.bat -arch <arch> -platform <platform>

The environment batch file requires an architecture argument <arch>, which takes the following values:

  • intel64: Compiler and libraries for Intel® 64 architecture-based host systems

  • ia32: Compiler and libraries for IA-32 architecture-based host systems

The environment batch file requires a platform argument <platform>, which takes the following values:

  • linux: sets up variables for Linux* targets
  • android: sets up variables for Android* targets

The default install path for Windows* host Linux* target is:

For Intel® System Studio 2018 or newer

 C:\IntelSWTools\system_studio_yyyy.x\compilers_and_libraries\ 
[where y.x is the version of the build package]

For Intel® System Studio 2017 or earlier

 C:\Program Files (x86)\IntelSWTools\system_studio_yyyy.x.zzz\
compilers_and_libraries\linux\bin

The default install path for Windows* host Windows* target is:

 C:\Program Files (x86)\IntelSWTools\system_studio_for_windows_yyyy.x.zzz\
compilers_and_libraries_yyyy\windows\bin

Intel® System Studio for Linux*

Set the environment variables before using the compiler. You use the source command to execute the shell script compilervars.sh or compilervars.csh. You can also type the location of the shell script, beginning with . /.

//Syntax: 
source /<install-dir>/bin/compilervars.sh -arch <arch> -platform <platform>
OR
. /<install-dir>/bin/compilervars.sh -arch <arch> -platform <platform>

The environment script file requires an architecture argument <arch>, which takes the following values:

  • intel64: Compiler and libraries for Intel® 64 architecture-based host systems.
  • ia32: Compiler and libraries for IA-32 architecture-based host systems.

The environment script file requires a target platform argument <platform>, which takes the following values:

  • linux: sets environment variables for the compiler and libraries for Linux targets only.
  • android: sets environment variables for the compiler and libraries for Android targets only.

The default install path is /opt/intel/system_studio_yyyy.x/compilers_and_libraries/ if the installation is conducted by the root user, where y.x is the version of the build package.

// Examples: (assuming <install-dir> is /opt/intel/system_studio_2018.x/compilers_and_libraries)
$ source <install-dir>/linux/bin/compilervars.sh -arch ia32 -platform linux		//for Linux targets
OR
$ . <install-dir>/linux/bin/compilervars.sh -arch ia32 -platform android		//for Android targets
For more complete information about compiler optimizations, see our Optimization Notice.