Intel
In this section:
Description
Intel provides a suite of compilers and libraries optimized for Intel processors, including C/C++ and Fortran compilers, mathematical libraries (MKL), and an MPI implementation.
Available Versions
intel/compilers/2017 (default)
intel/mpi/2017 (default)
intel/oneapi/hpc/2025.2
mkl/2022.2.0 (default)
Components
Intel Compilers: icc (C), icpc (C++), ifort (Fortran)
Intel MPI: Optimized MPI implementation
Intel MKL: Math Kernel Library (BLAS, LAPACK, FFT)
Intel IPP: Integrated Performance Primitives
Intel TBB: Threading Building Blocks
Loading Modules
# Compilers only
module load intel/compilers/2017
# Compilers + MPI
module load intel/compilers/2017
module load intel/mpi/2017
# OneAPI
module load intel/oneapi/hpc/2025.2
# MKL
module load mkl/2022.2.0
Compilation with Intel Compilers
C
#!/bin/bash
#SBATCH -J compile_intel_c
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program.c"
export OUTPUT="program"
module load intel/compilers/2017
job-nanny icc -O3 -xHost -o program program.c
C++
#!/bin/bash
#SBATCH -J compile_intel_cpp
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program.cpp"
export OUTPUT="program"
module load intel/compilers/2017
job-nanny icpc -O3 -xHost -std=c++11 -o program program.cpp
Fortran
#!/bin/bash
#SBATCH -J compile_intel_fortran
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program.f90"
export OUTPUT="program"
module load intel/compilers/2017
job-nanny ifort -O3 -xHost -o program program.f90
Compilation with OpenMP
#!/bin/bash
#SBATCH -J compile_intel_omp
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program_omp.c"
export OUTPUT="program_omp"
module load intel/compilers/2017
job-nanny icc -qopenmp -O3 -xHost -o program_omp program_omp.c
Compilation with Intel MPI
#!/bin/bash
#SBATCH -J compile_intel_mpi
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program_mpi.c"
export OUTPUT="program_mpi"
module load intel/compilers/2017
module load intel/mpi/2017
job-nanny mpiicc -O3 -xHost -o program_mpi program_mpi.c
Execution with Intel MPI
#!/bin/bash
#SBATCH -J run_intel_mpi
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 24:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="program_mpi"
export OUTPUT="mpi_output/"
module load intel/compilers/2017
module load intel/mpi/2017
job-nanny mpirun -np $SLURM_NTASKS ./program_mpi
Using Intel MKL
#!/bin/bash
#SBATCH -J compile_mkl
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="dgemm_example.c"
export OUTPUT="dgemm_example"
module load intel/compilers/2017
module load mkl/2022.2.0
job-nanny icc -O3 -xHost -mkl -o dgemm_example dgemm_example.c
#include <stdio.h>
#include <stdlib.h>
#include <mkl.h>
int main() {
int n = 2000;
double *A, *B, *C;
double alpha = 1.0, beta = 0.0;
// Allocate matrices
A = (double*)mkl_malloc(n*n*sizeof(double), 64);
B = (double*)mkl_malloc(n*n*sizeof(double), 64);
C = (double*)mkl_malloc(n*n*sizeof(double), 64);
// Initialize
for (int i = 0; i < n*n; i++) {
A[i] = (double)i;
B[i] = (double)(i+1);
}
// DGEMM: C = alpha*A*B + beta*C
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
n, n, n, alpha, A, n, B, n, beta, C, n);
printf("C[0] = %f\n", C[0]);
mkl_free(A);
mkl_free(B);
mkl_free(C);
return 0;
}
OneAPI (Modern Version)
#!/bin/bash
#SBATCH -J compile_oneapi
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:10:00
#SBATCH --mem=2G
export INPUT="program.c"
export OUTPUT="program"
module load intel/oneapi/hpc/2025.2
# icx compiler (C) and icpx (C++) based on LLVM
job-nanny icx -O3 -march=native -o program program.c
Intel Optimization Flags
Flag |
Description |
|---|---|
|
No optimization |
|
Basic optimization |
|
Recommended optimization |
|
Aggressive optimization |
|
Optimize for current architecture |
|
Optimize for specific architecture (xAVX, xCORE, etc.) |
|
Interprocedural optimization |
|
Enable OpenMP |
|
Link with Intel MKL |
|
Combination of aggressive optimizations |
Job Array for Testing Different Flags
#!/bin/bash
#SBATCH -J test_intel_flags
#SBATCH --array=1-6
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:30:00
#SBATCH --mem=4G
FLAGS=("-O0" "-O1" "-O2" "-O3" "-O3 -xHost" "-fast")
FLAG=${FLAGS[$SLURM_ARRAY_TASK_ID-1]}
export INPUT="benchmark.c"
export OUTPUT="benchmark_flag_${SLURM_ARRAY_TASK_ID}/"
module load intel/compilers/2017
mkdir -p benchmark_flag_${SLURM_ARRAY_TASK_ID}
cd benchmark_flag_${SLURM_ARRAY_TASK_ID}
# Compile with specific flag
job-nanny icc $FLAG -o benchmark ../benchmark.c
# Run and measure time
time ./benchmark > performance.txt 2>&1
References
Intel Compilers documentation: https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/
Intel MPI: https://software.intel.com/content/www/us/en/develop/documentation/mpi-developer-reference/
Intel MKL: https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-c/
See also
GCC - GNU compilers
OpenMPI - Open-source MPI
Running Simulations - How to submit jobs