Kahibaro
Discord Login Register

Intel oneAPI

Overview of Intel oneAPI in HPC

Intel oneAPI is Intel’s modern, cross-architecture toolchain for high-performance applications. In HPC, it is primarily used for:

Unlike older “Intel Compiler” branding, oneAPI is a broader ecosystem that includes compilers, libraries, analysis tools, and deployment utilities.

This chapter focuses on what you need to know as an HPC beginner to use Intel oneAPI compilers effectively on typical clusters.

Key Components Relevant to HPC Users

For this course, you mainly interact with:

And several optimized libraries (used either directly or via other software):

On many clusters, you won’t install these yourself; you’ll load an environment module that provides them.

Using Intel Compilers on an HPC Cluster

Loading Intel oneAPI with Modules

Typical workflow (details vary per system):

bash
module avail               # see available modules
module load intel-oneapi   # or similar: intel/2023.2, intel-compilers, etc.

Common variations:

Once loaded, commands like icx, icpx, ifx, or ifort become available in your PATH.

Basic Compiler Invocation

C and C++

Compile a single C source file:

bash
icx mycode.c -o myprog

C++:

bash
icpx mycode.cpp -o myprog

On systems still using classic compilers:

bash
icc mycode.c -o myprog
icpc mycode.cpp -o myprog

Fortran

Modern oneAPI Fortran:

bash
ifx mycode.f90 -o myprog

Classic Fortran (still very common in legacy codes):

bash
ifort mycode.f90 -o myprog

MPI and Intel Compilers

Clusters often provide MPI “compiler wrappers” that are configured to use Intel compilers:

Example:

bash
mpiifort parallel.f90 -o parallel_mpi

These wrappers automatically add the right MPI include paths and libraries.

Optimization and Architecture Flags (Intro Level)

You will see Intel compiler flags in other HPC examples and build systems. At a beginner level, you should recognize these:

General Optimization Levels

Example:

bash
icx -O3 code.c -o code_opt

Targeting CPU Features

Intel compilers can generate code tuned for specific microarchitectures or instruction sets:

On shared clusters, using extremely specific CPU features may cause problems if nodes differ. Often, system-wide build defaults are chosen by admins; as a new user, you generally:

Basic Vectorization Options

Vectorization is often enabled automatically at -O2 or higher. Some related flags you might encounter:

At this stage, just recognize that Intel compilers often add their own -q... or -f... options.

Debugging vs Optimized Builds with Intel oneAPI

Matching the “Debug builds” and “Optimized builds” concepts from the parent section, Intel compilers support:

Debug-Oriented Flags

Example debug build:

bash
ifx -g -O0 -traceback mycode.f90 -o mycode_debug

Release/Optimized Builds

Example:

bash
icpx -O3 -march=native main.cpp -o main_fast

In practice, you usually do not tune every flag manually; instead, you:

Libraries: Intel oneAPI and Math/Linear Algebra

Many HPC applications and libraries link against Intel’s math libraries. As a beginner, you should:

Manual linking can be complex; a minimal C example might look like:

bash
icx mycode.c -o myprog -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

On most clusters, you will instead follow local documentation or example job scripts that already know how to link MKL correctly.

Basic Use in CMake and Makefiles (Conceptual)

Without going deep into build systems (covered later), note that:

bash
export CC=icx
export CXX=icpx
export FC=ifx
cmake ..
make
CC = icx
FC = ifx
CFLAGS = -O3
FFLAGS = -O3

As a user, you often only need to adjust which compiler is used (e.g., switch from gcc to icx) by setting these variables or by loading the appropriate module before configuring the project.

When (and Why) to Use Intel oneAPI in HPC

As an absolute beginner, you don’t have to decide compilers for every project, but it helps to know typical reasons people choose Intel oneAPI on clusters:

For new projects, clusters may recommend:

As you progress through the course, you will encounter Intel oneAPI again when:

Views: 10

Comments

Please login to add a comment.

Don't have an account? Register now!