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

Publicado:08/26/2014   Última actualización:04/23/2019

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:

Step 1: Open a Command Prompt.

  • Windows 8.x and Windows 10
    • From the Start screen, swipe up from the bottom edge or click the arrow to move the Apps screen.    Start Menu

    • In the Apps screen, scroll down until you see the Intel Parallel Studio XE 201X group.

    • Click Compiler 19.0 Update 3 for Intel 64 (or IA-32) Visual Studio 2017 environment to open a command window.

  • Other versions of Windows*

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

Step 2: From the command window, invoke the compiler 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

Información sobre productos y desempeño

1

Los compiladores Intel pueden o no optimizar al mismo nivel para los microprocesadores que no son Intel en optimizaciones que no son exclusivas de los microprocesadores Intel. Estas optimizaciones incluyen los conjuntos de instrucciones SSE2, SSE3 y SSSE3, y otras optimizaciones. Intel no garantiza la disponibilidad, funcionalidad o eficacia de ninguna optimización en microprocesadores que no sean fabricados por Intel. Las optimizaciones dependientes del microprocesador en este producto fueron diseñadas para usarse con microprocesadores Intel. Ciertas optimizaciones no específicas de la microarquitectura Intel se reservan para los microprocesadores Intel. Consulte las guías de referencia y para el usuario para obtener más información acerca de los conjuntos de instrucciones específicos cubiertos por este aviso.

Revisión del aviso n.° 20110804