Porting Guide for ifort Users to ifx

Version: 2022.1.0   Published: 05/03/2021  

Last Updated: 06/23/2022

Introduction

This porting guide provides information and suggestions to Intel® Fortran Compiler Classic (ifort) users migrating to the new Intel LLVM-based compiler Intel® Fortran Compiler (ifx).  There is a similar Porting Guide for ICC Users to DPCPP or ICX.

This porting guide is a work-in-progress.  Check back frequently during the next months for updates. 

Revision History  
June 23, 2022
  • Brutus or Bisectional Optimization Support
May 24, 2022
  • Link using ifx with dpcpp object files
April 1, 2022 
March 21, 2022
  • More on compiler options
February 24, 2022
  • Clarified ifx OpenMP* compiler options
  • Added information about OpenMP* environment variables
  • Updated Known Limitations
January 13, 2022
  • Known Limitations update

 

 

 

 

 

Nomenclature

Intel's traditional Fortran compiler that has a long history we will informally call ifort. Officially it is called the Intel® Fortran Compiler Classic and is part of the Intel® oneAPI HPC Toolkit beginning with the 2021.1 release.  

The new compiler informally referred to as ifx is also included in the Intel® oneAPI HPC Toolkit beginning with the 2021.1 release. 

Guiding Principles for ifx

The Intel® oneAPI product packages provide two Fortran compilers. Intel® Fortran Compiler Classic (ifort) provides best-in-class Fortran language features and performance for CPU. The Intel® Fortran Compiler (ifx) enables developers needing OpenMP* offload to Intel GPUs. The OpenMP 5.0, 5.1 GPU offload features in ifx are not available in ifort. For calendar year 2022 ifort continues to be our best-in-class Fortran compiler for customers not needing GPU offload support. The default compiler for the Microsoft Visual Studio* environment is ifort.

Our latest compiler, the Intel® Fortran Compiler (ifx), is production-ready for CPUs and GPUs. ifx is based on the Intel® Fortran Compiler Classic (ifort) frontend and runtime libraries, but uses LLVM backend compiler technology.  In this release in oneAPI 2022.2 ifx completely implements Fortran 77, Fortran90/95, Fortran 2003 (including parameterized derived types) and Fortran 2008 (except coarrays) language standards and OpenMP 4.5 and OpenMP 5.0/5.1 directives and offloading features. ifx is binary (.o/.obj) and module file (.mod) compatible. Binaries and libraries generated with ifort can be linked with binaries and libraries built with ifx, and .mod files generated with one compiler can be used by the other (64-bit targets only). Both compilers use the the same runtime libraries.  ifx may or may not match performance of ifort compiled applications. Performance and Fortran Standard language improvements will be coming in ifx with each update release throughout 2022.

In the oneAPI 2022.2 release, the ifx version number is 2022.1.0 and the ifort version number is 2021.6.0.

In the oneAPI 2022.1 release, the ifx version number is 2022.0.0 and the ifort version number is 2021.5.0.

Major Changes in Compiler Option Defaults

  • Intel Fortran Compiler Classic users continue to use the ifort driver.
  • Intel Fortran Compiler users use ifx to use the additional feature of compiling to use Intel GPUs via OpenMP TARGET directives.

Floating Point Behavior

  • To get ifort behavior in floating point comparisons, ifx users should specify assume [no]ieee_compares and/or assume nan_compares.
    • Tells the compiler to generate IEEE compareSignaling operations for floating point comparisons, as required by the Fortran 2018 standard. By default ifx assume NaNs are not going to be operands in floating point comparisons and does not generate that check for NaNs.  
      • Linux
        • -assume [no]ieee_compares
      • Windows
        • /assume:[no]ieee_compares
  • fp-model | fp and fast
    • The behavior with the fp-model | fp fast=1 or 2 option is different between ifort and ifx with respect to floating point compares.  To get ifort behavior when using the fp-model or fp fast option with ifx, assume nan_compares should also be specified on the ifx command line.
      • Linux
        • -fp-model fast=1 or -fp-model fast=2 -assume nan_compares
      • Windows
        • /fp:fast 1 or /fp:fast 2 /assume:nan_compares

CPU Performance

Optimization ifx (Linux Syntax) ifort (Linux Syntax)
Disable optimization -O0 -O0
Optimize for speed (no code size increase) -O1 -O1
Optimize for speed (default)

-O2

Add -x<code> to enable all available Intel

optimizations and advanced vectorization.

Add -xHost to enable those optimizations the

platform where you are compiling.

-O2
High-level loop optimization -O3

Add -x<code> to enable all available Intel

optimizations and advanced vectorization.

Add -xHost to enable those optimizations the

platform where you are compiling.

-O3
Create symbols for debugging -g -g
Multi-file inter-procedural optimization -ipo -ipo
Profile-guided optimization (multi-step build)

-fprofile-generate

-fprofile-use

-prof-gen

-prof-use

Optimize for speed across the entire program

-fast 

(-ipo -O3 -static -fp-model fast)*

-fast 

(-ipo -O3 -no-prec-div -static -fp-model=fast=2 -xHost)

OpenMP support -fiopenmp or -qopenmp -qopenmp

* may not be final

ifx Compiler Options and OpenMP Directives

  • OpenMP 4.5/5.0/5.1 TARGET directives are only recognized by the ifx ompiler that is included in the Intel® oneAPI HPC Toolkit.  ifx also recognizes OpenMP PARALLEL and SIMD directives.
  • -fiopenmp and -qopenmp and -fopenmp are equivalent.
    • ​Compile and recognize OpenMP parallel and SIMD directives and clauses and use the Intel OpenMP runtime libraries.
  • -fopenmp is deprecated and will be removed in a future release.
  • -fopenmp-targets=spir64
    • This option is needed when OpenMP 4.5/5.0/5.1 TARGET pragmas/directives are used to run on Intel GPUs.
    • spir64 stands for "64-bit Standard, Portable Intermediate Representation"
  • Use the compiler options above together to create a fat binary for both the cpu and the Intel GPU.
    • ifx -fiopenmp -fopenmp-targets=spir64 code.F90
    • ifx -qopenmp -fopenmp-targets=spir64 code.F90

Important Compiler Options Mapping

  • ifx will accept many ifort compiler options.  
  • Not all ifort options are accepted and/or implemented in ifx.
  • Undocumented options from ifort are NOT implemented and there are no plans to do so.  Remember, this is a very different compiler – the old internal, undocumented ifort options have no meaning or mapping to the ifx compiler.  If there is functionality in an undocumented option that you think you need, submit a bug report via Online Service Center (OSC), explain the behavior you expect and how ifx is not providing what you need. “Because ifort accepted this option and it’s in my makefile” is not justification.  This is a different compiler with different optimizations and behavior.  Try ifx without the option.
  • Diagnostic warnings are emitted for ifort options that are not CURRENTLY planned to be implemented in ifx. For example,

       command line warning #10148: option '-ip' not supported.

  • ifx option –qnextgen-diag causes the ifx compiler to emit a long list of ifort options that are NOT accepted by ifx.
  • If you have an unsupported compiler option that is important to your application AND removing it from your build with ifx leads to an error, please report an issue via OSC.  We would like to know which options you need implemented in ifx.
  • ifort options that ARE IMPLEMENTED in ifx or will be implemented soon are accepted quietly.
  • GNU* and Microsoft* compatible options are accepted by ifort and ifx.

fp-model, fp

To reduce a possible performance degradation when using -fp-model=source (Linux) or /fp:source (Windows), be sure to also include the compiler option -assume noprotect_parens (Linux) or /assume:noprotect_parens (Windows).

fimf Family of Compiler Options

With ifx and the fimf* compiler options, the optional:funclist list of functions that is available with ifort is not supported. Here is the list of fimf compiler options.

fimf-absolute-error=value
fimf-accuracy-bits=bits
fimf-arch-consistency=value
fimf-max-error=ulps
fimf-precision=value
fimf-domain-exclusion=classlist

Optimization Reports

Optimization reports are a work-in-progress for ifx. With each release more information is included. 

Some things to know include:

  • The compiler option itself remains the same, -qopt-report | /Qopt-report.
  • There are 3 levels of detail available: 1, 2 and 3.
  • On Linux the report goes to stdout. On Windows when compiling in a command window, the output goes to the command window.
    • The optimization report that is printed to stdout or the terminal reports the optimizations performed by Intel's proprietary vectorizer.
  • On Linux -qopt-report also creates files with the .yaml suffix. That is an optimization report created by the LLVM community. It can be viewed using opt-viewer.py. At this time we recommend the Intel optimization report for Intel optimizations.

Compiler Versioning

  • A new versioning macro is defined for ifx
    •  __INTEL_LLVM_COMPILER
  • Version String
    The version string for the two compilers, ifort and ifx, is new. With Intel oneAPI semanitic versioning is used. This article explains more about the Intel oneAPI versioning schema. 

    An example:
    ifx –-version 
    ifx (IFORT) 2022.0.0 20211123

    The format is:
         MAJOR.MINOR.PATCH build-string
    where 
    ·    MAJOR is the product version. It may not always match the calendar year.
    ·    MINOR is a single-digit minor version number, starting at “0” for initial release and incremented as needed for minor releases.
    ·    PATCH starts at “0” for the initial release. If a critical PATCH for specific bug and security fixes, the number is incremented.
    The build-string is of the form YYYYMMDD.

Object Files and .mod Files

ifx is binary (.o/.obj) and module (.mod) file compatible with ifort, i.e. binaries and libraries generated with ifort can be linked with binaries and libraries built with ifx, and .mod files generated with one compiler can be used by the other (64-bit targets only). Object files created with icc, icl, icpc, icx, icpx, dpcpp are also binary compatible; they will link.

However, if you compile using the -ipo compiler option, there is no compatibility between the object files created by ifort and ifx. 

Proprietary Intel Directives Support

Support for general, non-OpenMP compiler directives (!DIR$) is growing release by release. 

!DIR$ directives are recognized by the front end, but not all are implemented. !DIR$ directives that ifx 2022.0.0 supports are: IVDEP, VECTOR [NO]DYNAMIC_ALIGN,  VECTOR [NO]REMAINDER, DISTRIBUTE_POINT, NOFUSION, [NO]UNROLL, [NO]UNROLL_AND_JAM, among others.

Essential OpenMP Offload Environment Variables 

These environment variables are useful to control and get more information about the computations being offloaded. For more details see this section of the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference.

  • Select the target device:  OMP_TARGET_OFFLOAD = mandatory | disabled | default
    • mandatory: The TARGET region runs code on the GPU or other accelerator.
    • disabled: The TARGET region runs on the CPU.
    • default: The TARGET region run on GPU if the device is available, else falls back and runs on the CPU.
  • Select the plugin, i.e. device driver: LIBOMPTARGET_PLUGIN = OPENCL | LEVEL0
    • The default is LEVEL0.
    • Companion environment variable: LIBOMPTARGET_DEVICE_TYPE = GPU | CPU
      • The default is GPU.
      • CPU is only implemented for OPENCL.
  • Print GPU kernel runtime profile when the program finishes: LIBOMPTARGET_PLUGIN_PROFILE = T
    • The profile includes GPU kernel start and complete time.
    • Data transfer times are also printed.
  • Dump offloading runtime debug information
    • LIBOMPTARGET_DEBUG = 0 | 1 | 2
      • The default is 0, disabled.
    • LIBOMPTARGET_INFO = 0 | 1 | 2 | 4 | 8 | 32

Link Using ifx with dpcpp Object Files

Some developers are choosing to offload compute kernels in a Fortran program using DPC++. 

To link successfully, additional ifx compiler options are required as in this example:

dpcpp -c device.cpp

ifx -qopenmp -fsycl host.f90 device.o -lstdc++ -lsycl

This works for ifx 2022.1.0 and earlier. In a future release, -qopenmp will not be required.

Known Limitations

  • At this time, the only I/O allowed with ifx in an OpenMP TARGET region is print * and even that is limited to numeric and character strings.
  • On Windows* the ATTRIBUTES DLLEXPORT and DLLIMPORT are not yet supported.
  • On Windows QuickWin applications are not yet supported.

PGO, IPO, and Linking Changes

The ifx compiler has different methods for both Interprocedural Analysis (IPO) and Profile Guided Optimizations (PGO). 

  • PGO  
    • Not yet supported with ifx. When it is supported, refer to Multi-Stage PGO for more information.
  • IPO  
    • LLVM uses Link Time Optimization (LTO) technology. In ifort it is termed “Interprocedural Optimization” (IPO).
    • For more information on LLVM LTO, refer to LLVM Link Time Optimization: Design and Implementation.
    • -ipo is automatically translated to -flto for the user by the ifx driver.
    • The variants of the -ipo compiler option are removed.
    • If you compile using the -ipo compiler option, there is no compatibility between the object files created by ifort and ifx. 
  • Intel linker xi* tools removed
    • Intel tools xilink, xild, and xiar are removed from ifx as they serve no purpose – they are specific to the proprietary object file formats used by the Intel® Compilers.
    • In your Makefiles or Project Settings, if you have used xilink or xild, replace these with the equivalent native linkers. Similarly replace xia with ar or similar archive tool.

ifort Features Not Supported in ifx

  • Guided Auto Parallelism
    • Deprecated in ifort
  • Profile Guided Optimization (PGO) is being redesigned.
  • Identification of code with possible speculative execution side-channel effects

Brutus or Bisectional Optimization Support

If you are unfamiliar with “Brutus” in the Intel Fortran Compiler Classic or Bisectional Optimizations in Clang/LLVM, you may skip this section.

ifx has support for Clang/LLVM –opt-bisect-limit=N for bisectional optimization debug. This is similar to the Brutus option in ifort. A community effort is underway to enhance optimization debugging capabilities in Clang/LLVM through the open source community.

Usage example:

ifx -mllvm -opt-bisect-limit=300 t.f90

For more information, refer to, Using -opt-bisect-limit to debug optimization errors

Appendix

References

Useful references include

Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

New Features for ifx in Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

Intel oneAPI Programming Guide  A general guide to help developers get started from setting the environment to compiling and running simple applications.

Fortran Language and OpenMP Features in ifx Updated with each compiler release

Intel® Fortran Compiler for oneAPI Release Notes

Intel® Fortran Compiler Classic - Support for Fortran Language Standards

Intel® Fortran Compiler Information and Frequently Asked Questions

Porting Guide for ICC Users to DPCPP or ICX

 

 

Product and Performance Information

1

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