Skip Navigation

Using the Cray compilers on Ookami

Ookami users can take advantage of the Cray Programming Environment that includes a set of compilers, high performance math libraries, and performance profiling tools.

To use the Cray compilers, you must first be on a node with aarch64 CPU architecture.  Therefore, users should first either:

A) start an interactive Slurm job


B) ssh to one of the accessible aarch64 nodes


C) Alternatively, if no interactive session is desired, users may simply write and submit a Slurm job submission script to compile the code.

Once on an appropriate node, load the following module to access the Cray compilers:

module load CPE

This is a meta-module that loads several different modules needed for accessing the Cray Programming Environment. Loading it will add the c ("cc"), c++ ("CC"), and fortran ("ftn") compiler executables to your PATH.

Here, we will use an example matrix multiplication code to demonstrate the use of the Cray c++ compiler. Because this code compiles without issue and does not require any interactive troubleshooting, we can  write a Slurm script to compile and run the code:

#!/usr/bin/env bash

#SBATCH --job-name=cray_example
#SBATCH --output=cray_example.log
#SBATCH --ntasks-per-node=48
#SBATCH --nodes=1
#SBATCH --time=05:00
#SBATCH -p short

# unload any modules currently loaded
module purge

# load the CPE module to setup the cray programming environment
module load CPE

# copy the sample C++ code to the working directory
cp /lustre/projects/global/samples/Cray-sample/mm.cpp $SLURM_SUBMIT_DIR

# compile the code using the Cray C++ compiler
CC mm.cpp -o mm

# run the code on a 1000 x 1000 x 1000 matrix
./mm 1000 1000 1000

Let's call this script "cray-example.slurm" and submit it with sbatch:

sbatch cray-example.slurm

Once the job has run, you should see something similar to the following in the job's log file ("cray_example.log"), indicating that the matrix multiplication code has compiled and run sucessfully:

Set up of matrices took: 0.151 seconds
Performing multiply
Naive multiply took: 5.939 seconds

Example code for testing the Cray compilers can be copied from the following directory: