Compiling your own programs

Researchers using the Artemis service have access to the following compiler suites to compile and debug their own code:

  • GNU (i.e. GCC, G++, gfortran)
  • Portland Group (PGI)
  • Intel
  • Java
  • GPU

Small compiliations may be performed on the login nodes, but large compiliations should be done by submitting a job or by starting an interactive session. Some large compilations will fail if performed on the login nodes (especially Java compilation).

GNU

To use the GNU compilers, load the GNU compiler modules:

module load gcc

or:

module load gcc openmpi-gcc

for OpenMPI programs.

There are many versions of the GNU compilers installed on Artemis. To see what versions are available, run the following command:

module avail \|& grep gcc

The following table shows the various commands to use when compiling code, depending on the language and style of execution being used:

Language Single CPU Using MPI Using OpenMP
Fortran gfortran mpif90 gfortran -fopenmp
C gcc mpicc gcc -fopenmp
C++ g++ mpicxx g++ -fopenmp

PGI

To use the PGI compiler, load the PGI modules with the following command:

module load pgi

or:

module load openmpi-pgi

for OpenMPI programs.

The following table shows the various commands to use when compiling code, depending on the language and style of execution being used:

Language Single CPU Using MPI Using OpenMP
Fortran pgf90 mpif90 pgf90 -mp
C pgcc mpicc pgcc -mp
C++ pgcc mpicxx pgCC -mp

Intel

To use the Intel compilers, load the Intel modules with the following command:

module load intel

or:

module load intel-mpi

for Intel MPI programs.

The following table shows the various commands to use when compiling code, depending on the language and style of execution being used:

Language Single CPU Using MPI Using OpenMP
Fortran ifort mpiifort ifort -openmp
C icc mpiicc icc -openmp
C++ icpc mpiicpc icpc -openmp

Java

To use Java compilers, load the java module with the following command:

module load java

The java compiler is called javac. Node that all Java compilations performed on the login nodes will fail. To compile Java code on Artemis, submit a Java compilation job to Artemis, or compile your Java program in an interactive session.

GPU

To take advantage of the GPU accelerated compute nodes, your code will need to be modified to run in the hybrid GPGPU environment. The compile chain will need to specify that the target is GPU via the target argument to the pgcc/pgfortran compiler. This include the compiler argument: -ta=nvidia. This compiler flag tells the PGI compiler to compile for the NVIDIA GPU.

The preferred method of accessing GPUs is to use the NVIDIA CUDA toolkit:

module load cuda

which places the nvcc compiler in your path. See the NVIDIA CUDA programming guide for more details.