The Cray Compiling Environment (CCE) is a release of the Cray Fortran and Cray C compilers for Cray systems. OpenACC is no longer supported by the C and C++ compilers, which are based on Clang/LLVM (the legacy C and C++ compilers, referred to as Cray Classic C and C++, are no longer supported). OpenACC 2.0 support for Fortran will continue to be maintained, but users are encouraged to switch to OpenMP for accelerator support.
The Cray Fortran compiler supports the Fortran 2018 standard. The Cray Clang C and C++ compilers are compatible with gcc
and conformant with C/C++/ObjC and their variants: please see man clang
or use the -help
command line option for more information.
The compiler provides support for the Intel Sandy Bridge, Broadwell and Haswell architectures (AVX and AVX2 instruction sets).
The Cray Compiling Environment is accessed through the PrgEnv-cray
modulefile, which is loaded by default at login. Older and/or newer versions of the compiler may be available: to see which versions are available issue module avail cce
. To use a different version of the compiler issue module switch cce cce/<version>
.
The man pages (man crayftn
and man craycc
) provide information on all the compiler options available. Note that if two compiler options conflict, the last option on the command line takes precedence!
The Cray compiler is a highly optimizing compiler, and the default optimization level is equivalent to -O3
or -fast
in other compiler suites. The default optimization level is the most thoroughly tested level and is recommended by Cray.
Moreover, optimizations targeting the specific compute node architecture chosen by loading the daint-gpu
or daint-mc
module - as discussed in the section Piz Daint XC50 / XC40 - are turned on by default.
Cray has modified the Clang/LLVM C and C++ compiler to improve the performance of the generated code and to provide additional features. In general, performance improvements are enabled by default at appropriate optimization levels, but can be disabled using the option -fno-cray
(default is -fcray
, enabling Cray enhancements).
Please note that -fno-cray
is intended to help diagnose whether a problem is caused by a Cray enhancement or is present in the base Clang/LLVM distribution.
The Cray Fortran compiler enables inlining by default with the -O ipa3
option: one can set the level of inlining to 0
, 1
, 2
or 4
, see the man page man crayftn
for more information.
More aggressive optimization can be obtained with -O3
: the Fortran compiler flag -hfp3
adds floating point optimizations, especially with 32-bit operands. If bit reproducibility is important, you might need to reduce to -hfp1
(use -hfp0
only if absolutely necessary).
Cray Fortran provides compiler feedback called "Loopmark". If you compile with -hlist=m
flag, then the compiler will produce a listing file (filenmae.lst
) which consists of an annotated lisiting of the source code with letters indicating optimizations performed ("I" for inlined, "r" for unrolled, "b" for blocked, and so on).
The -O negmsgs
option (or equivalently, the -h negmesg
option) will tell the compiler to generate messages to standard error explaining why optimizations did not occur in a given instance. The -eo
option will display all optimizations used by the compiler.
CCE supports the OpenMP API Version 4.5 with some exceptions (see man crayftn
for the details) and several OpenMP 5.0 features as well for Fortran, C, and C++ (see module help CCE
). PGAS languages (UPC and CAF) are integrated into the compiler (no preprocessor is necessary).
OpenMP support is disabled by default and must be explicitly enabled using the -homp
option with the Fortran compiler crayftn
or the -fopenmp
flag. The Fortran compiler option -O threadn
controls the optimization of OpenMP directives, where n=0-3
with 0
meaning no optimization and 3
the most aggressive optimization.
Please refer to the man pages (man crayftn
, man craycc
) for a full list of compiler options available.
The following compiler flags may be useful for helping debug your code. Note that the -G
options can be specified on a per-file basis so that only part of an application pays the price for improved debugging
-g
, generate debugging information (equivalent to -G0
)-G0
, generate full debugging information with optimizations disabled (-O0
, -O ipa0
, -O scale0
, -O vector0
)-G01
, generate debugging information with partial optimization-G02
, generate debugging information with full optimizationThe Cray compiler can produce many messages during the compiling and linking phases. To obtain further information about these messages, use the explain
command: for example, explain ftn-500
to get information on message 500.
For information on the explain command, see man explain
.
See the man pages for detailed information on the compilers and compiler flags (man crayftn
; man craycc
) and refer to the Cray Compiling Environment (CCE), the Cray Fortran Reference Manual and the Cray C and C++ Reference Manual available on the HPE Cray Support Center.