Intel compilers
Intel Compilers
Intel Compiler Parallel Suites [1] offer C, C++, and FORTRAN Compilers which have optimization and multi-threading features. We have a license for the HPC, and provide recent annual releases from Intel.
Compiler Version
Check the Suite versions using the lmod 'modules' command:
module spider intel
output:
Description:
Intel Compilers Suite - loads C/C++/Fortran Compilers+Debug environment
Versions:
intel/17
intel/18
intel/20
intel/20-1
Load the appropriate module. Version (20)17 supports most installed modules, while version 20-1 is the latest for developing and compiling with Intel Parallel Suite:
module load intel/20-1
To check the version of Intel Compilers, type:
icc --version
output:
icc (ICC) 19.1.1.217 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
Compiling a Code & Executing
Compiling a C or C++ Program
Interactive
Request the compute node:
srun -t 1:00:00 -c 4 --mem=16gb --pty bash
Copy the content below in a hello.c file
hello.c:
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
Compile the code to create "hello" as an executable
icc -o hello hello.c
Run the Executable
./hello
Your output will be: Hello World
Batch
Copy the content in your file (let's say job.slurm).
#!/bin/bash
#SBATCH -o hello.o%j
#SBATCH --time=00:02:00
#SBATCH -N 1
#SBATCH -n 1
#Compiling section
# module load intel #-- intel/17 is loaded by default, uncomment for specific version
icc -o hello hello.c
#Copying files to scratch
cp -r hello $PFSDIR
#Running job
cd $PFSDIR
./hello
cp -ru * $SLURM_SUBMIT_DIR
Submit the job:
sbatch job.slurm
You will find the output at hello.o<jobid>
To compile the C++ source file "test.cpp" with the Intel C++ compiler, use the command
icc -o test test.cpp
Note that the Intel C compiler is used for source files ending in ".c" and the Intel C++ compiler is used for source files ending in ".cpp" or ".C".
Compiling a FORTRAN Program
To compile the FORTRAN 77 source file "test.f" with the Intel FORTRAN 77 compiler, use the command
ifort -o test test.f
To compile the FORTRAN 90 source file "test.f90" with the Intel FORTRAN 90 compiler, use the command
ifort -o test test.f90
Note that the Intel FORTRAN 77 compiler is used for source files ending in ".f" and the Intel FORTRAN 90 compiler is used for source files ending in ".f90".
Monitoring Licenses
Refer to HPC Guide to Licenses.