Minor compiler refresh
We’ve refreshed some of the additional compilers we provide on our Ubuntu Linux platform. Read on for full details.
NEW! Intel compiler 2023.1.0
We’ve installed the latest version (2023.1.0) of Intel’s C, C++ & Fortran compilers. They’ve been made available as an environment module, so you need to activate this module before you use the compilers.
Here’s a wee example of how you could use the Intel C & C++ compiler (icx) to compile a trivial C code (called mycode.c):
module load intel/compiler/2023.1.0 icx mycode.c
The first line activates the Intel compiler module, and you’ll need to type this before using the Intel compilers.
The 2nd line uses the Intel C & C++ compiler (icx) to compile mycode.c into an executable file called a.out. In practice, you’ll normally pass additional parameters to the compiler, for example:
- to tell the compiler to warn you about potential bugs in your code (e.g. via the -Wall option)
- to tell the compiler which C or C++ standard you’re using (e.g -std=c11 or -std=c++17)
- to enable compiler optimisations (e.g. -O2, -O3, -Ofast)
- to give your final executable a better name than a.out (e.g. -o mycode)
However I’ve kept the above example deliberately simple.
If you’ve already used our Intel compilers, please note:
- icx is Intel’s newest C & C++ compilers, based on the LLVM/Clang framework. icx will shortly replace the classic C & C++ compilers (icc & icpc). The classic compilers are still included here, but you’ll need to start moving away from them. We’ll aim to keep a version of the classic compilers for as long as necessary. Please do tell us if you’re using the classic compilers!
- We’re removed the oldest versions of the Intel compilers: 2021.1.1 & 2021.2.0, so currently provide just 3 recent versions of the compilers. Type module avail for a full list.
If you’re compiling Fortran, you can continue to use the classic Intel ifort compiler.
Do let us know if you give the Intel compilers a try – we’re always interested to see how they perform on our AMD EPYC phcompute0NN compute nodes. I’ve certainly seen it generate fast code in some cases, but not in others!
NEW! AMD compiler 4.0.0
We’ve installed the latest version of AMD’s Optimizing C/C++ and Fortran Compilers (AOCC).
As with the Intel compiler (see above), this needs to be activated via an environment module.
Here’s an example of how you could use the AMD C compiler (via the command clang) to compile a trivial C code (mycode.c):
module load amd/compiler/4.0 clang mycode.c
As with the Intel example above, you’ll typically pass additional options to the compiler, but I’ve kept things very simple for now.
To compile C++ code, you can also use the clang command or the more explicit clang++ – it doesn’t matter. You can compile Fortran code with flang. Flang is still quite new, so I’d recommend being a bit careful with it – make sure you compare with the classic GNU Fortran compiler.
Like Intel’s new C & C++ compilers, the AMD compiler is based on the LLVM/Clang compiler framework, hence the name clang for the command we use to invoke the compiler.
Note that we also provide “vanilla” Clang compilers – also invoked via the clang command. You’ll find the typing clang will give you the vanilla Clang compiler by default, but will instead give you the AMD compiler whenever the amd/compiler/4.0 environment module is loaded. Hopefully this isn’t too confusing – you can always type clang -v or which clang to see which Clang you’re actually getting.
If you’ve already been using the AMD compiler, note that we’ve kept the previous version (3.2.0) for now, but deleted the one before that (3.0.0).
Do let us know if you give the AMD compilers a try – we’re always interested to see how it performs on our AMD EPYC phcompute0NN compute nodes. So far, I haven’t seen the AMD compilers do any better than the vanilla Clang compiler.
Newer version of Clang… maybe later
We currently provide version 10 of the Clang compiler framework – invoked by typing clang (for C and C++), or explicitly clang++ for C++ code.
I’m going to look at providing some newer versions of these compilers. More on that later…
Which C, C++ and Fortran compilers do we currently provide?
Here’s a summary of the compilers we currently provide:
- GCC 9.4 (the system default compiler suite)
- GCC 10.2
- Clang 10
- Intel compiler (2023.1.0, 2022.2.1 & 2022.0.2)
- AMD compiler (4.0 & 3.2)
Most of these compilers support C, C++ and Fortran.
These compilers are available on all School Ubuntu Linux desktop PCs & compute hosts.
The default compiler suite will continue to be GCC 9.4. It’s useful – and fun – to try compiling codes with different compilers and comparing performance. Using different compilers can also identify potential problems in your code
Full details:
Help!
If you have any questions about using our compilers:
- You can email the School Helpdesk: sopa-helpdesk@ed.ac.uk
- Alternatively, you can post in the SoPA Research Computing space in Teams.
Comments are closed
Comments to this thread have been closed by the post author or by an administrator.