--- title: 'Cray Compiler' taxonomy: category: - docs external_links: process: true no_follow: true target: _blank mode: active --- [toc] ## Environment Settings{#enviroment} ### Software Version and System Requirements{#version} Version | System A | System B | System C | Notes -------- | ----------- | -------- | -------- | --------- 9.1.3 | + | + | + | Installed in March 2020 (Clang 9 based) 9.1.3 classic | + | + | + | Installed in March 2020 9.0.2 | + | + | + | Installed in October 2019 (Clang 9 based) 9.0.2 classic | + | + | + | Installed in October 2019 8.7.9 | + (default) | + (default) | + (default) | Installed in March 2019 8.7.6 | + | + | + | Installed in Dedember 2018 8.6.5 | + | + | + | Installed in March 2018 8.6.3 | + | ― | ― | Installed in December 2017 8.6.1 | + | ― | ― | Installed in August 2017 8.5.8 | + | ― | ― | Installed in March 2017 8.5.5 | + | + | + | Installed in Dedember 2016 8.5.2 | + | ― | ― | Installed in October 2016 \+ : Available for use ― : Not available for use ### Setting Up System{#modules} Version | Modulefile Name ------------------| --------------- 9.1.3|cce/9.1.3 9.1.3 classic|cce/9.1.3-classic 9.0.2 |cce/9.0.2 9.0.2 classic|cce/9.0.2-classic 8.7.9 |cce/8.7.9 8.7.6 |cce/8.7.6 8.6.5 |cce/8.6.5 8.6.3 |cce/8.6.3 8.6.1 |cce/8.6.1 8.5.8 |cce/8.5.8 8.5.5 |cce/8.5.5 8.5.2 |cce/8.5.2 When logging in to the System A, Cray Compiler is set as default: ```nohighlight $ module list Currently Loaded Modulefiles: x) cce/8.3.0 x) PrgEnv-cray/5.2.14 ``` When logging in to the System B,C, Intel Compiler is set as default. Thus, you need to switch from the Intel Compiler to the Cray Compiler as below: ```nohighlight $ module switch PrgEnv-intel PrgEnv-cray ``` The default version of Intel Compiler is as listed above. To switch the version of Cray Compiler to another, execute the module command with the PrgEnv-cray loaded as below: ```nohighlight $ module switch cce/8.0.4 cce/8.0.6 ``` To automatically execute a command when logging in to the System, specify such command in the login shell startup-file by following [Setting Up System](/config#login_shell). For details on the module command, see [Modules](/config/modules). ### Cray Compiler moves to be Clang-based (version 9 and later){#ver9} The architecture of Cray C Compiler 9 and Cray C++ Compiler 9 has moved from proprietary to Clang-based. The compile options of Clang-based version are much different from the previous versions'. Major options are shown in [Compile Options](#option_clang). Note that Cray Fortran Compiler 9 continues to be the proprietary-based and its options are same as the previous versions. At version 9, the proprietary-based Cray C Compiler 9 and Cray C++ Compiler 9 are also provided, called the classic version. The compile options of classic version are same as the previous versions. The module name of classic version is like that: **cce/(version name)\_classic.** When you switch to Cray Compiler 9, the Clang-based version is loaded first. If you want to use the classic version, switch the loaded cce module from Clang-based to classic version. ### Major changes of Cray Compiler 9 {#change} See the below document. (Japanese version only) [CDT 19.09](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/CDT_19.09.pdf) ### Notice for using version 8.6 or later{#caution} #### for 8.6.1 Cray Compiler 8.6.1 is not available by merely switching the version of current cce module to 8.6.1. craype and cray-mpich (in system BC, cray-impi), and cray-libsci also need to be switched as shown below. ```nohighlight $ module switch craype/2.5.12 $ module switch cray-mpich/7.6.0 $ module switch cray-libsci/17.06.1 ``` [PrgEnv](/config/modules#prgenv) command is useful as switching those modules by one command. ```nohighlight $ PrgEnv cce 8.6.1 ``` #### for 8.6.3 and later The craype and cray-mpich (in system BC, cray-impi), and cray-libsci also need to be switched as same as the case of 8.6.1. [PrgEnv](/config/modules#prgenv) command is useful as switching those modules. (Sorry, this command is available only in system A.) ## How to Compile{#usage} ### Compile Commands{#command} Language | Commands | Operands --------- | -------- | ------------------------------------------- Fortran | ftn | ftn [sequence_of_options] sequence_of_files C | cc | cc [sequence_of_options] sequence_of_files C++ | CC | CC [sequence_of_options] sequence_of_files ### Compile Options (classic version){#option} #### **Main options (e.g., parallelization, optimization)** Option | Purpose --------------------------------------- | ----------------------------------------------------------------------------------------------------------- -o _FILENAME_ | Specifies the name of the object file. -h omp | Enables compiler recognition of OpenMP directives. (Enables by default.) -h noomp | Disables compiler recognition of OpenMP directives. -h autothread | Enables autothreading. -O0/-O1/-O2/-O3 | Performs general optimization at four levels. (The default is 2.) -h msgs | Displays optimization messages. -h negmsgs | Displays messages to explain why optimizations did not occur in a given instance. -h add_paren | Performs a calculation in order from left to right when sequencing an operation by operators; +, -, and *. -h pic | Compiles codes using more than 2GB of static memory. (use -dynamic together) -dynamic | Links libraries dynamically. -g | Generates debug information. #### **Fortran language options** Option | Purpose --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- -ra | Generates a report. -m2 | Displays all warning messages. -eI | Considers that using an undefined variable is an error. -Rb | Defines an array out of bounds error. -en | Displays information on non-standard functions. -e0 | Initializes all undefined local stack variables to 0. If a user variable is of type character, it is initialized to NUL. -ez | Initializes to 0 when allocating memory dynamically by an ALLOCATE statement. -f fixed | Specifies that Fortran source programs are written in fixed source form. -f free | Specifies that Fortran source programs are written in free source form. -em | Enables modules. -h byteswapio | Supports the big-endian file. -ev | Supports when the total number of local variable within subroutine exceeds 2GB. -G1/-G2/-Gfast | Generates debug information with optimization. #### **C/C++ language options** Option | Purpose --------- | ----------------------------------------------------- -h list=a | Generates a report. -h zero | Initializes all undefined local stack variables to 0. ### Compile Options (Clang-based C and C++){#option_clang} **The below options are of Clang, so the details of function of options may differ from the classics'.** #### Main options (e.g., parallelization, optimization) |Option |Purpose| |-|-| |-o FILENAME |Specifies the name of the object file.| |-fopenmp |Enables compiler recognition of OpenMP directives. (**Disables by default.**)| |-O0/-O1/-O2/-O3 |Performs general optimization at four levels(**-O0 by default**) Specify "**-O3 -ffast-math**" to be equivalent to **-O3** of classic version. | |-ffast-math | Tolerant for minute errors of floating point calculation to perform aggressive optimizations.| |-fsave-optimization-record |Saves optimization messages to a file.| |-mcmodel=medium|Compiles codes using more than 2GB of static memory. (use -dynamic together)| |-dynamic|Links libraries dynamically.(**Enables by default.**)| |-static|Links libraries statically.| |-g | Generates debug information.| |-Wall|Displays warning messages.| ### Compile Options (Clang-based Fortran){#option_flang} Clang Cray Fortran Compiler 9 continues to be the proprietary-based (not Flang) and its options are same as [Compile Options (classic version)](#option). ## Examples of Compiling{#sample} ### Non-Parallelized Program{#serial} ```nohighlight $ ftn test.f90 # For Fortran ``` ```nohighlight $ cc test.c # For C ``` ```nohighlight $ CC test.cpp # For C++ ``` ```nohighlight $ tssrun ./a.out # Executing ``` ### Using Auto-Parallelization (classic version only){#auto_parallel} ```nohighlight $ ftn -h autothread -h noomp test.f90 ``` ```nohighlight $ tssrun -A p=1:t=4:c=4 ./a.out # Executing with the number of parallels = 4 ``` ### Using OpenMP{#openmp} * classic version ```nohighlight $ cc -h omp test.c ``` * Clang version ```nohighlight $ cc -fopenmp test.c ``` ```nohighlight $ tssrun -A p=1:t=8:c=8 ./a.out # Executing with the number of parallels = 8 ``` ## Compiler Messages{#compile_message} ### Fortran{#fortran_message} Cray Fortran compiler outputs messages, that indicate important information or programming error, in the format below. ```nohighlight ftn-XXX crayftn: YYY MAIN, File = File name, Line = Line number, Colum = Column number Message body ``` * XXX : Message serial number * YYY : Type of message(ERROR/WARNING/CAUTION/NOTE/COMMENT/ANSI) #### Examples ```nohighlight ftn-1197 crayftn: ERROR MAIN, File = test.f90, Line = 27, Column = 28 The array subscript for dimension 2 does not fall within the defined range. ``` ### C/C++{#c_message} #### classic version Cray C/C++ Compiler outputs messages in the following format when indicating important information or programming errors: ```nohighlight CC-XXX craycc: YYY File = File name, Line = Line number Message body ``` * XXX : Message serial number * YYY : Type of message (ERROR/WARNING/CAUTION/NOTE/COMMENT) * Examples ```nohighlight CC-175 craycc: WARNING File = test.c, Line = 27 The indicated subscript is out of range. ``` ### Checking Message Details{#message_detail} Use the explain command to see details of the message that indicate when compiling. ```nohighlight $ explain ftn-XXX   (Fortran) $ explain CC-XXX   (C/C++) ``` #### Examples ```nohighlight $ explain ftn-1197 Error: The array subscript for dimension %d does not fall within the defined range. An array reference was encountered where a subscript was out of bounds for the array. (The rest is omitted.) ``` ### FAQs{#faq} * **Q-1:** An error like below occurs when compiling. ```nohighlight sample.f90:32: relocation truncated to fit: R_X86_64_32S against `.bss' sample.f90:33: additional relocation overflows omitted from the output ``` * **A-1:** This message indicates that the memory usage of the program may exceed 2GB. Please specify the -h pic -dynamic option when compiling. * **Q-2:** The following error occurs when compiling. ```nohighlight sample.s:837: Error: 0x9ab5c0f0 out range of signed 32bit displacement ``` * **A-2:** This message indicates that the memory usage of local variable within the Fortran subroutine may exceed 2GB. Please specify the -ev option when compiling. * **Q-3:** The following error occurs when writing the CONVERT specifier in the OPEN statement with Cray Fortran. ```nohighlight ftn-73 crayftn: ERROR MAIN, File = sample.f90, Line = 6, Column = 30 This control item specifier is not allowed for this I/O statement. ``` * **A-3:** The CONVERT specifier in OPEN statement does not exist in Fortran standards, and is not supported by Cray Fortran compiler. Thus both file formats(big-endian and little-endian) cannot be loaded in the same program by Cray Compiler. * **Q-4:** The following error occurs when executing. ```nohighlight lib-4211 : UNRECOVERABLE library error A WRITE operation tried to write a record that was too long. Encountered during a sequential formatted WRITE to unit 11 Fortran unit 11 is connected to a sequential formatted text file: "fort.11" Current format: 1000 FORMAT (1000(f7.5,1x)) ``` * **A-4:** This error occurs because it sets 1024 characters per line of output restriction by default in the Cray Fortran compiler. Please specify the number of characters per line (e.g., recl=2048) by using the RECL specifier in the OPEN statement. * **Q-5:** The following error occurs when executing an MPI program including “MPI_LONG_DOUBLE”. ```nohighlight MPI_Irecv(110): Null Datatype pointer ``` * **A-5:** Cray Compiler does not support “MPI_LONG_DOUBLE”, please use “MPI_DOUBLE”. When using MPI in the System A, Intel Compiler (PrgEnv-intel) and GNU compiler (PrgEnv-gnu) support “MPI_LONG_DOUBLE”. ## Available Libraries{#library} ### MPI Library{#mpi_library} <!-- [Cray MPI library](/compilers/craympi) is available in the System A and E. For details on how to compile, link, and run MPI programs, see [Cray MPI Library](/compilers/craympi). --> Library | System A | System B,C ---------------------------------------- | -------- | -------- [Cray MPI library](/compilers/craympi) | + | ― Cray IntelMPI library (wrapper for cray env.) | ― | + <!-- [MVAPICH2](/compilers/mvapich2) | ― | + | ― --> ### Numerical Library{#numerical_library} The following numerical libraries are available when using Cray Compiler in the System A,B,C. For details on how to use each library, see each library’s page. Library | System A | System B,C ---------------------------------------- | -------- | -------- [Cray LibSci Library](/compilers/craylibsci) | + | + [IMSL Library](/compilers/imsl) | ― | AU \+: Available for all users AU: Available for academic users only ― : Not available for use ### Available combinations of modules{#combi} There are restrictions for available combinations of Cray compilers and libraries. The following combinations of Cray compiler modules and Cray MPICH modules, and Cray compiler modules and Cray LibSci modules, can be loaded at the same time. * cce and cray-mpich |mpi\cce|8.4.6|8.5.2|8.5.5|8.5.8|8.6.1|8.6.3|8.6.5|8.7.6|8.7.9| |-|-|-|-|-|-|-|-|-|-| |7.3.3|〇|x|x|x|x|x|x|x|x| |7.4.2|x|〇|〇|〇|x|x|x|x|x| |7.5.0|x|〇|〇|〇|x|x|x|x|x| |7.5.3|x|〇|〇|〇|x|x|x|x|x| |7.6.0|x|x|x|x|〇|〇|〇|〇|〇| |7.6.3|x|x|x|x|〇|〇|〇|〇|〇| |7.7.0|x|x|x|x|〇|〇|〇|〇|〇| |7.7.3|x|x|x|x|〇|〇|〇|〇|〇| |7.7.6|x|x|x|x|〇|〇|〇|〇|〇| * cce and cray-libsci |libsci\cce|8.4.6|8.5.2|8.5.5|8.5.8|8.6.1|8.6.3|8.6.5|8.7.6|8.7.9| |-|-|-|-|-|-|-|-|-|-| |16.03.1|〇|〇|〇|〇|〇|〇|〇|〇|〇| |16.07.1|x|〇|〇|〇|〇|〇|〇|〇|〇| |16.11.1|x|〇|〇|〇|〇|〇|〇|〇|〇| |16.11.1|x|〇|〇|〇|〇|〇|〇|〇|〇| |17.06.1|x|x|x|x|〇|〇|〇|〇|〇| |17.09.1|x|x|x|x|〇|〇|〇|〇|〇| |18.03.1|x|x|x|x|〇|〇|〇|〇|〇| |18.07.1|x|x|x|x|〇|〇|〇|〇|〇| |19.02.1|x|x|x|x|〇|〇|〇|〇|〇| If you load modules excluding the above combinations, you cannot compile your program with an error like the following. ```nohighlight Error: cray-mpich 7.7.6 is not compatible with cce 8.5.8. Either switch to cce/8.6.0 or later, or switch to cray-mpich earlier than 7.6.0. ``` ## Manuals{#manual} ### Version 8.5{#ver8_5} * [Cray Fortran Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Fortran_Reference_Manual_S-3901_85.pdf) * [Cray C and C++ Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_C_and_Cplusplus_Reference_Manual_S-2179_85.pdf) ### Version 8.6{#ver8_6} * [Cray Fortran Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Fortran_Reference_Manual_S-3901_86.pdf) * [Cray C and C++ Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_C_and_Cplusplus_Reference_Manual_S-2179_86.pdf) ### Version 8.7{#ver8_7} * [Cray Fortran Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Fortran_Reference_Manual_S-3901_87.pdf) * [Cray C and C++ Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_C_and_C++_Reference_Manual_S-2179_87.pdf) ### Version 9.0{#ver9_0} * [Cray Fortran Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Fortran_Reference_Manual_S-3901_90.pdf) * [Cray Classic C and C++ Reference Manual](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Crassic_C_and_C++_Reference_Manual_S-2179_90.pdf) * [Clang Compiler User's Manual](https://clang.llvm.org/docs/UsersManual.html) ### CrayDoc{#craydoc} * [Cray XE and Cray XK System Documentation](http://docs.cray.com/cgi-bin/craydoc.cgi?mode=SiteMap;f=xe_sitemap) * [Cray XC System Documentation](http://docs.cray.com/cgi-bin/craydoc.cgi?mode=SiteMap;f=xc_sitemap) ## Release Notes{#release_notes} * [CCE 8.2.2](https://web.kudpc.kyoto-u.ac.jp/release/cray/S-9407-1312.pdf) * [CCE 8.3.0](https://web.kudpc.kyoto-u.ac.jp/release/cray/S-5212-83.pdf) * [CCE 8.4.0](https://web.kudpc.kyoto-u.ac.jp/release/cray/S-5212-84.pdf) * [CCE 8.5](https://web.kudpc.kyoto-u.ac.jp/Cray_Manual/Cray_Compiling_Environment_Release_Overview_and_Installation_Guide_85.pdf) ### 8.6 and later The release notes for CCE 8.6 and later are not provided in book style. Please type `$ module help cce/<version>` to see the release note for each version.