--- title: Cray Programming Environment #tags: keywords: cray, module last_updated: 24 Mai 2023 summary: "This document describes how to use the Cray Programming Environment on Merlin7." sidebar: merlin7_sidebar permalink: /merlin7/cray-module-env.html --- ## Loading the Cray module The Cray Programming Environment, with Cray's compilers and MPI, is not loaded by default. To load it, one has to run the following command: ```bash module load cray ``` The Cray Programming Environment will load all the necessary dependencies. In example: ```bash 🔥 [caubet_m@login001:~]# module list Currently Loaded Modules: 1) craype-x86-rome 2) libfabric/1.15.2.0 3) craype-network-ofi 4) xpmem/2.9.6-1.1_20240510205610__g087dc11fc19d 5) PrgEnv-cray/8.5.0 6) cce/17.0.0 7) cray-libsci/23.12.5 8) cray-mpich/8.1.28 9) craype/2.7.30 10) perftools-base/23.12.0 11) cpe/23.12 12) cray/23.12 ``` You will notice an unfamiliar `PrgEnv-cray/8.5.0` that was loaded. This is a meta-module that Cray provides to simplify the switch of compilers and their associated dependencies and libraries, as a whole called Programming Environment. In the Cray Programming Environment, there are 4 key modules. * `cray-libsci` is a collection of numerical routines tuned for performance on Cray systems. * `libfabric` is an important low-level library that allows you to take advantage of the high performance Slingshot network. * `cray-mpich` is a CUDA-aware MPI implementation, optimized for Cray systems. * `cce` is the compiler from Cray. C/C++ compilers are based on Clang/LLVM while Fortran supports Fortran 2018 standard. More info: https://user.cscs.ch/computing/compilation/cray/ You can switch between different programming environments. You can check the available module with the `module avail` command, as follows: ```bash 🔥 [caubet_m@login001:~]# module avail PrgEnv --------------------- /opt/cray/pe/lmod/modulefiles/core --------------------- PrgEnv-cray/8.5.0 PrgEnv-gnu/8.5.0 PrgEnv-nvhpc/8.5.0 PrgEnv-nvidia/8.5.0 ``` ## Switching compiler suites Compiler suites can be exchanged with PrgEnv (Programming Environments) provided by HPE-Cray. The wrappers call the correct compiler with appropriate options to build and link applications with relevant libraries, as required by the loaded modules (only dynamic linking is supported) and therefore should replace direct calls to compiler drivers in Makefiles and build scripts. To swap the the compiler suite from the default Cray to GNU compiler, one can run the following. ```bash 🔥 [caubet_m@login001:~]# module swap PrgEnv-cray/8.5.0 PrgEnv-gnu/8.5.0 Lmod is automatically replacing "cce/17.0.0" with "gcc-native/12.3". ```