IBM Support

Power10 Quick Start Guide – GNU Compiler Collection (GCC)

How To


Summary

This article provides a brief guide for setup and performance tuning of the GNU Compiler Collection (GCC) on Power10 systems.

Steps

Availability
  • The GCC compilers are available on all Enterprise Linux distributions and on AIX.
  • The installed GCC version is 8.4 on RHEL 8 and 7.4 on SLES 15. RHEL 9 is expected to ship GCC 11.2.
  • There are several ways to obtain a sufficiently recent version of GCC when the default compilers for the distribution are too old to support Power10.
  • Red Hat supports the GCC Toolset [1] for this purpose.
  • SUSE provides the Development Tools Module. [2]
  • IBM provides the latest compilers and libraries via the Advance Toolchain. [3]

Languages
  • C (gcc), C++ (g++), and Fortran (gfortran), along with others such as Go (gccgo), D (gdc), and Ada (gnat).
  • Only gcc, g++, and gfortran are usually installed by default.
  • The golang compiler [4] is the preferred alternative for building Go programs on Power.
IBM Advance Toolchain
  • The Advance Toolchain provides Power-optimized system libraries along with the compilers, debuggers, and other tools.
  • Building code with the Advance Toolchain can produce the most highly optimized code possible on the latest processors.
Compatibility and New Features on Power10
  • Applications compiled with earlier versions of GCC to run on POWER8 or POWER9 processors will run compatibly on Power10 processors.
  • GCC 11.2 or later is recommended to exploit all new features available in Power ISA 3.1 and implemented in Power10 processors.
  • GCC 11.2 provides access to the Matrix Multiply Assist (MMA) feature provided by Power10 processors. [5]
  • MMA programs can be compiled using any of the GCC, LLVM, and Open XL compilers, provided you use sufficiently recent releases.
IBM Recommended and Supported Compiler Flags [6]
  • -O3 or -Ofast
    • Aggressive optimization. -Ofast is essentially equivalent to -O3 -ffast-math, which also relaxes restrictions on IEEE floating-point arithmetic.
  • -mcpu=powern
    • Compile using instructions supported by the Powern processor. For example, to use instructions available only on Power10, select -mcpu=power10
  • -flto
    • Optional. Perform “link-time” optimization. This optimizes code across function calls where the caller and called functions exist in different compilation units, and can often provide a significant performance boost.
  • -funroll-loops
    • Optional. Perform more aggressive duplication of loop bodies than the compiler normally would. Generally you should omit this, but on some codes this can provide better performance.
  • Note: Although -mcpu=power10 is supported as early as GCC 10.3, GCC 11.2 is preferred because earlier compilers don’t support every feature implemented in the Power10 processors. Also, objects created using -mcpu=power10 will not run on POWER9 or earlier processors! However, there are ways to create code that is optimized for different processor versions. [7]

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"POWER10","label":"IBM Power10"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}]}]

Document Information

Modified date:
04 June 2024

UID

ibm17155156