Porting Guide for ifort Users to ifx

Published: 05/03/2021  

Last Updated: 08/25/2021

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 (Beta) (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 few months for updates.


Intel® Fortran Compiler (Beta) (the “Materials”) are licensed to you under the Free User Type as defined in the enclosed Intel End User License Agreement for Developer Tools (Version October 2020) (“EULA”). The Materials are “Pre-Release Materials” as set forth in Section 4.2 of the EULA. 

The following restrictions for these Pre-Release Materials in Section 4.2 of the EULA are hereby waived:  (i) to not modify or incorporate the Pre-Release Materials into Your Product, (ii) to not continue to use the Pre-Release Materials once a commercial version is released, and (iii) to not disclose to any third party any benchmarks, performance results, or other information relating to the Pre-Release Materials. 

If You decide to use these Pre-Release Materials, You acknowledge and agree that (a) the Pre-Release Materials have only been validated to beta quality level, may not be error free, and may require more frequent updates; (b) the current performance may not be representative of the performance of the final production version; and (c) You are fully responsible for any issues that result from the use of these Pre-Release Materials.


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® Fortran Compiler (Beta) (ifx) is a new compiler based on the Intel® Fortran Compiler Classic (ifort) frontend and runtime libraries using LLVM backend technology.  ifx is released as a Beta version for users interested in trying offloading to supported Intel GPUs using OpenMP* TARGET directives which ifort does not support.  

Although considerable effort is being made to make the transition from ifort to ifx as smooth and as effortless as possible, customers can expect that some effort may be required to tune their application.

ifort will remain Intel’s recommended production compiler until ifx has performance and features superior to ifort.  In the future, when ifx functionality and performance equivalence or better against ifort is achieved, Intel may suggest using ifx, instead of, ifort for performance critical applications. We have no set timeline for this transition as it is conditional on reaching equivalence or better than current ifort technology.  Going forward BOTH ifort and ifx compilers will be provided in Intel oneAPI Toolkit packages.  So for the coming years you have a choice:  ifort for performance and stability and ifx to offload to supported Intel GPUs using OpenMP*. 

Major Changes in Compiler Option Defaults

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

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

Performance

  • With ifx to get all of the loop optimizations you got with ifort -O2 add these compiler options:  
    • -Ofast -funroll-loops -nostandard-realloc-lhs -align array32byte

ifx OpenMP* Options

  • 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 or -qopenmp
    • ​Compile and recognize OpenMP parallel and SIMD directives and clauses and use the Intel OpenMP runtime libraries.
  • -fopenmp NOT RECOMMENDED
    • ​Compile and recognize OpenMP parallel and SIMD pragmas/directives and clauses and use the open source OpenMP runtime.
    • Only use for compatibility testing, not performance.
    • For performance and Intel features use -fiopenmp or -qopenmp.
  • -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.

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) 2021.2.0 Beta 20210317

    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 “1” 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 YYYMMDD.

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 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.

PGO, IPO, and Linking Changes

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

  • PGO  
  • 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

Appendix

References

Useful references include

Intel® Fortran Compiler Classic and Intel® Fortran Compiler (Beta) 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.