Skip to content

Intel Compiler on MeluXina

The MeluXina system environment provides the Intel compiler.

EasyBuild module description

 Intel C, C++ & Fortran compilers (classic and oneAPI).

You can use Intel to compile your C/C++ programs.

Intel usage

Interactive

Reserve an interactive session:

salloc -A COMPUTE_ACCOUNT -t 01:00:00 -q dev --res cpudev -p cpu -N 1

The example above will allocate one CPU node in interactive mode (dev QoS with cpudev reservation). Load the Intel (Will load default version if not specified) module as in below script.

module load Intel
icc hello.c -o ./HelloTest_C

Batch

Intel can also be used in a batch job using Slurm. The script below compile a simple C HelloWorld test on one CPU node allocated for 5 minutes.

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -p cpu
#SBATCH -q test
#SBATCH --time 00:05:00

#Load Intel module
module load Intel

#Check Intel version
icc --version

#Compile C program with Intel
icc hello.c -o ./hello_c

#Execute the program
hello_c

It is recommended to use a Makefile to compile your program. Your Makefile should look like the example below:

#Defines compiler
CC=icc

# These are the options we pass to the compiler.
# -std=c++14 means we want to use the C++14 standard.
# -stdlib=libc++ specifies that we want to use the standard library implementation called libc++
# -g specifies that we want to include "debugging symbols" which allows us to use a debugging program.
# -O0 specifies to do no optimizations on our code.
CFLAGS = -std=c++14 -stdlib=libc++ -g -O0

all: hello

hello: hello.o
        $CC $CFLAGS -o hello_c hello.o

hello.o: hello.cpp
          $CC $CFLAGS -c hello.c

It is also possible to compile via a Makefile inside a batch job:

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=128
#SBATCH -p cpu
#SBATCH -q test
#SBATCH --time 00:05:00

#Load Intel module
module load Intel

#Check Intel version
icc --version

#Compile C program with Intel (in parallel)
make -j

#Execute the program
hello_c