Compilers
Compilers are tools that allow you to create executable binaries from source code.
Available Compilers
Palmetto offers the following compiler suites for C, C++ and Fortran applications:
- GNU Compiler Collection (
gcc
) - Intel oneAPI DPC++/C++ Compiler (
intel-onapi-compilers
) - AMD Optimizing C/C++ and Fortran Compiler (
AOCC
) - NVIDIA HPC SDK (
nvhpc
)
module avail gcc
module avail intel-oneapi-compilers
module avail aocc
module avail nvhpc
Compiling "Hello World" Program
C
Simple hello.c
file that reads
#include <stdio.h>
int main(void){
printf("Hello, world!\n");
return 0;
}
can be compiled on Palmetto using the following commands
Compiler | Module | Command |
---|---|---|
GCC | gcc/12.3.0 | gcc hello.c -o hello.x |
Intel | intel-oneapi-compilers/2024.0.2 | icx hello.c -o hello.x |
AOCC | aocc/4.1.0 | clang hello.c -o hello.x |
NVHPC | nvhpc/23.11 | nvcc hello.c -o hello.x |
C++
The same example in C++ put in a file hello.cpp
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
can be compiled on Palmetto using the following commands
Compiler | Module | Command |
---|---|---|
GCC | gcc/12.3.0 | g++ hello.cpp -o hello.x |
Intel | intel-oneapi-compilers/2024.0.2 | icpx hello.cpp -o hello.x |
AOCC | aocc/4.1.0 | clang++ hello.cpp -o hello.x |
NVHPC | nvhpc/23.11 | nvc++ hello.cpp -o hello.x |
FORTRAN
To compile a simple FORTRAN program test.f90
program test
print *,'hello from fortran'
end program test
use a command appropriate for a given compiler suite
Compiler | Module | Command |
---|---|---|
GCC | gcc/12.3.0 | gfortran test.f90 -o hello.x |
Intel | intel-oneapi-compilers/2024.0.2 | ifx test.f90 -o hello.x |
AOCC | aocc/4.1.0 | flang test.f90 -o hello.x |
NVHPC | nvhpc/23.11 | nvfortran test.f90 -o hello.x |