How to Select oneAPI Intel® Fortran Compiler and Compiler Version in Microsoft* Visual Studio

Published: 03/04/2021  

Last Updated: 04/05/2022

By Devorah Hayman

Fortran IDE – Intel® Fortran Compiler Integration into Microsoft Visual Studio

When you install a new version of Intel® Fortran Compiler, the previous versions are uninstalled into Microsoft Visual Studio. The new version of the Fortran integration supports the current compiler version and two or three previous versions. For example, if you currently have Intel oneAPI HPC Toolkit 2021.4 installed and later install Intel oneAPI HPC Toolkit 2022.2, the 2021.4 integration is removed and the 2022.2 integration is installed. Using the 2022.2 version of HPC Toolkit, you can access the compiler versions 2021.6, 2021.5, and 2021.4 only, even if you still have older versions, such as 19.5, installed. Older versions can be accessed only through command line interface.

This article shows how to select Intel® Fortran Compiler Classic version and Intel® Fortran Compiler version within Visual Studio.

NOTE: You can choose which version of Microsoft Visual Studio to integrate your new Intel® Fortran Compiler with. During Intel oneAPI HPC Toolkit installation, click Customize at the Select Your Installation Mode step. Follow the on-screen instructions until you see a window with all the Visual Studio versions available on your system checked. Check the desired version of Visual Studio.

Selecting Intel® Fortran Compiler Classic (IFORT) Version in Visual Studio IDE

If you have multiple versions of Intel® Fortran Compiler installed, you can select among recent compiler versions in supported Microsoft Visual Studio. Only compiler versions that support that version of Visual Studio can be selected.
For example, if you have installed Intel oneAPI Toolkit 2022.1 and have left Intel oneAPI Toolkit 2021.4 and Parallel Studio XE 2020 installed, you can select either the 2021.5 or 2021.4 or 19.1 compiler in Visual Studio 2017 or 2019. To make this selection, navigate to Tools > Options > Intel Compiler and Libraries > IFORT Intel Fortran Classic > Compilers

Note: compiler version might be different on your system depending on which one you have installed.

Microsoft Visual Studio 2019 Dialog


You can choose a different compiler version for 32-bit (Win32) or 64-bit (x64) platform targets. By default, the latest installed compiler version is selected. Use the Selected compiler drop-down menu to choose from among the available versions. If you want to make a choice for the 64-bit platform as well, click on the x64 tab (VS2017 or later) and choose the compiler there.  

Selecting Intel® Fortran Compiler(IFX) Version in Visual Studio

The same process applies for selecting Intel® Fortran Compiler (IFX) version: Tools > Options > Intel Compiler and Libraries > IFX Intel Fortran > Compilers

 Note: IFX Compiler is available for x64 build configuration only.

                                                                                                                                                                                             

Selecting IFX (Intel® Fortran Compiler) in Visual Studio

For every Fortran project, Intel® Fortran Compiler Classic (IFORT) is selected by default in Visual Studio. If you need the Intel® Fortran Compiler (IFX) to build your project right click on the Fortran project you wish to build and select Intel Compiler > IFX Intel® Fortran Compiler

Note: IFX compiler is available in x64 build configuration only.

Selecting Intel® Fortran Compiler Classic (IFORT) Version in Visual Studio CLI

  • Click Start menu button on the taskbar and scroll down to Intel oneAPI 2022 or Intel oneAPI 2021 folder and expand it
  • Click on Intel oneAPI command prompt for Visual Studio 2019 or 2017
  • This will open an oneAPI cmd interface and load the latest oneAPI Compiler and other tools installed on the system, thus setting up an oneAPI environment. 

  • In the Intel oneAPI cmd interface window type the following two commands in order to change (in this example) from compiler version 2021.3 to 2021.2
cd C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\env
vars.bat
  • See output below for example
C:\Program Files (x86)\Intel\oneAPI>ifort
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.
 

C:\Program Files (x86)\Intel\oneAPI>cd C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\env

C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\env>vars.bat

C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\env>ifort
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.2.0 Build 20210228_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.
 

C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\env>

Related Information

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.