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

ID 662714
Updated 8/17/2023
Version Latest
Public

author-image

By

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

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

This article shows how to select 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 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 2023.2 and have left Intel oneAPI Toolkit 2022.3 and 2021.4 installed, you can select either the 2023.2 or 2022.3 or 2021.4 compiler in Visual Studio 2022 or 2019. To make this selection, navigate to Tools > Options > Intel Compiler and Libraries > IFX Intel Fortran > Compilers

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

Microsoft Visual Studio 2022 Dialog

                         

Switching to IFX (Intel® Fortran Compiler) inside the Visual Studio Solution

For every Fortran project, Intel® Fortran Compiler Classic (IFORT) is selected by default in Visual Studio. To use 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 2023 or Intel oneAPI 2022 folder and expand it
  • Click on Intel oneAPI command prompt for Visual Studio 2022
  • 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