rustc
rustc (rustc) is the reference and most popular Rust compiler.
The compiler program’s name is simply rustc.
In all software stacks, the module name is rust.
To load a specific version, run
module load rust/VERSION
To load the default version, run
module load rust
Targeting CPU Architecture
By default, the rust will compile code targeting some generic version of the CPU the compiler is run on.
On an x86-64 node, this means being compatible with the original 64-bit AMD and Intel processors from 2003 and thus no AVX/AVX2/AVX-512 without SSE fallback.
The compiler uses the -C target-cpu=ARCH option to control the architecture.
If you use cargo, you can use the RUSTFLAGS environment variable instead:
export RUSTFLAGS="-C target-cpu=ARCH"
The ARCH values for the different CPU architectures (Spack naming) we provide are
| Architecture/Target (Spack naming) | ARCH value for rustc |
|---|---|
| Most generic version of node compiler is running on | generic |
| The CPU of the node the compiler is running on | native |
haswell | haswell |
broadwell | broadwell |
skylake_avx512 | skylake-avx512 |
cascadelake | cascadelake |
sapphirerapids | sapphirerapids |
zen2 | znver2 |
zen3 | znver3 |