GNU CompilerProgramming EnvironmentTo use the GNU compiler, swap in the GNU programming environment (PrgEnv-gnu) and use the wrappers for C (cc), C++ (CC), and Fortran (ftn). To see all available compiler versions, use the command: module avail gcc To switch to a different version, use the command: module swap gcc gcc/<version> When to Use the GNU CompilerThe GNU compiler is particularly good for code that includes vectorization using inlined assembly (i.e., intrinsics). Cray has observed outstanding performance from GNU-compiled C and C++ code (if you ignore vectorization), but only so-so performance from GNU-compiled Fortran code. FlagsThere are numerous compile-time flags that can be used. For complete listings, see the man pages: man gfortran man gcc man g++ Cray recommends: -O3 -ffast-math -funroll-loops Note that using OpenMP For OpenMP programs, use: -fopenmp For compiler feedback, use:
Fortran file naming, preprocessing
Underflow, Flush-to-Zero, and When floating-point calculations result in numbers that are so small that they underflow (also called "sub-normal" numbers), GNU-compiled code normally takes a huge performance hit (which may be > 100x) while attempting to preserve the numbers. The alternative is to flush those results to zero. Using the |