## 7.1 Compiler options 

Compiler options are one of the main tools that are used to debug and optimize the performance of your code during development. Several compilers, including IBM Xpertise Library (XL); GNU Compiler Collection (GCC); The Portland Group, Inc. (PGI); and NVIDIA compilers, support the latest IBM POWER9 processor-based features and enhancements. 

## 7.1.1 IBM XL compiler options 

IBM XL C/C++ for Linux V16.1.0 and IBM XL Fortran for Linux V16.1.0 support POWER9 processors with new features and enhancements, such as Little Endian distributions support, compiler optimizations, and built-in functions for POWER9 processors. In addition, many Open Multi-Processing (OpenMP) 4.5 features were introduced$^{1}$, such as the constructs that enable the loading and offloading of applications and data to NVIDIA graphics processing unit (GPU) technology. 

By default, these compilers generate code that runs on various IBM Power Systems servers. Options can be added to exclude older processors that are not supported by the target application. The following major IBM XL compiler options control this support: 

-mcpu Specifies the family of the processor architecture for which the instruction code is generated. 

-mtune Indicates the processor generation of most interest for performance. It tunes instruction selection, scheduling, and other architecture-dependent performance enhancements to run optimally on a specific hardware architecture. 

-qcache Defines a specific cache or memory geometry. 

The -mcpu=pwr9 suboption produces object code that contains instructions that run on the POWER9 processor-based hardware platforms. With the -mtune=pwr9  suboption, optimizations are tuned for the POWER9 processor-based hardware platforms. This configuration can enable better code generation because the compiler uses capabilities that were not available on those older systems. 

For all production codes, it is imperative to enable a minimum level of compiler optimization by adding the -O  option for the IBM XL compilers. Without optimization, the focus of the compiler is on faster compilation and debug ability, and it generates code that performs poorly at run time. 

For projects with increased focus on runtime performance, use a more advanced compiler optimization. For numerical or compute-intensive codes, the IBM XL compiler options -O3 or -qhot -O3  enable loop transformations, which improve program performance by restructuring loops to make their execution more efficient by the target system. These options perform aggressive transformations that can sometimes cause minor differences in the precision of floating point computations. If the minor differences are a concern, the original program semantics can be fully recovered with the -qstrict option. 

For more information about IBM XL C/C++ support for POWER9 processor-based servers, see IBM Knowledge Center. 

For more information about IBM XL Fortran, see the IBM Knowledge Center. 

