Compilers and libraries on Tegner¶
This cluster does not use compiler wrappers so you must load the appropriate modules and link to libraries yourself. many versions of the different compilers do exist and the command does differ depending on language and type of compiler.
Examples¶
Compiling serial code:
# GNU
gfortran -o hello hello.f
gcc -o hello hello.c
g++ -o hello hello.cpp
# Intel
module add i-compilers
ifort -FR -o hello hello.f
icc -o hello hello.c
icpc -o hello hello.cpp
# Portland
module add pgi
pgf90 -fast -o hello hello.f
pgcc -fast -o hello hello.c
pgc++ -fast -o hello hello.cpp
Compiling OpenMP/MPI code:
# GNU+OpenMPI
module add gcc/5.1 openmpi/1.8-gcc-5.1
mpif90 -FR -fopenmp -o hello_mpi hello_mpi.f
mpicc -fopenmp -o hello_mpi hello_mpi.c
mpic++ -fopenmp -o hello_mpi hello_mpi.cpp
# Intel+IntelMPI
module add i-compilers intelmpi
mpiifort -openmp -o hello.f90 -o hello_mpi
mpiicc -openmp -o hello_mpi hello_mpi.c
mpiicpc -openmp -o hello_mpi hello_mpi.cpp
# Portland
module add pgi
pgf90 -mp -fast -o hello hello.f
pgcc -mp -fast -o hello hello.c
pgc++ -mp -fast -o hello hello.cpp
Compiling CUDA code:
# CUDA
module add cuda/8.0
nvcc -arch=sm_37 -O2 hello.cu -o hello.x