Configure Your CPU or GPU System
Intel® oneAPI Base Toolkit
- CPU, GPU and FPGA users, install CMake* and pkg-config to build most samples
- Set environment variables for CPU/GPU
- For GPU users, install GPU drivers
- For GPU users, disable hangcheck for applications with long-running GPU compute workloads
- For GPU non-root users, add a user to the video group
- For Eclipse* users, install a recent release of the Eclipse IDE for C/C++ Developers, then install the oneAPI Eclipse plugins.
Install CMake*, pkg-config, and GNU* Dev Tools to Build Samples
Although the CMake and pkg-config build tools are not required by the oneAPI tools and toolkits, many oneAPI samples are provided as CMake projects and require CMake to build them. In some cases pkg-config is necessary to locate libraries needed to complete a build of the application.
The Intel compilers utilize the existing GNU build toolchains to provide a complete C/C++ development environment. If your distribution of Linux does not include the complete suite of GNU development tools, you need to install these tools.
To install CMake, pkg-config, and the GNU development tools on your Linux system, open a terminal session and enter the following commands:
Ubuntu*
sudo apt update
sudo apt -y install cmake pkg-config build-essential
Red Hat* and Fedora*
sudo yum update
sudo yum -y install cmake pkgconfig
sudo yum groupinstall "Development Tools"
SUSE*
sudo zypper update
sudo zypper --non-interactive install cmake pkg-config
sudo zypper --non-interactive install pattern devel_C_C++
Verify the installation by displaying the installation location with this command:
which cmake pkg-config make gcc g++
One or more of these locations will display:
/usr/bin/cmake
/usr/bin/pkg-config
/usr/bin/make
/usr/bin/gcc
/usr/bin/g++
For more information about CMake, refer to CMake.org. If you are unable to install CMake using your Linux distribution's standard package manager, see the CMake.org downloads page for additional installation options.
Set Environment Variables for CLI Development
The Unified Directory Layout was implemented in 2024.0. If you have multiple toolkit versions installed, the Unified layout adds the ability to ensure your development environment contains the component versions that were released as part of that specific toolkit version.
The directory layout that was used prior to 2024.0 is still supported on new and existing installations. This prior layout is called the Component Directory Layout. Now you have the option to use the Component Directory Layout or the Unified Directory Layout.
Environment variables are set up with a script called setvars or oneapi-vars, depending on which layout you are using.
To understand more about the Unified Directory Layout, including how the environment is initialized and the advantages of using the layout, see Use the setvars and oneapi-vars Scripts with Linux *.
Set up your CLI environment:
Option 1: Source setvars.sh once per session
Source setvars.sh | oneapi-vars.sh every time you open a new terminal window:
Component Directory Layout
For system wide installations:
. /opt/intel/oneapi/setvars.sh
For private installations:
. ~/intel/oneapi/setvars.sh
Unified Directory Layout
For system wide installations:
. /opt/intel/oneapi/<toolkit-version>/oneapi-vars.sh
For private installations:
. ~/intel/oneapi/<toolkit-version>/oneapi-vars.sh
Option 2: One time setup for setvars.sh
Environment variables can be set up to automatically set using one of the methods below:
- Use a startup script, as described on this page
- Use modulefiles
- Use a setvars.sh configuration file
To have the environment automatically set up for your projects, include the command source <install_dir>/setvars.sh in a startup script where it will be invoked automatically (replace <install_dir> with the path to your oneAPI install location). The default installation locations are /opt/intel/oneapi/ for system wide installations and ~/intel/oneapi/ for private installations.
For example, you can add the source <install_dir>/setvars.sh command to your ~/.bashrc or ~/.bashrc_profile or ~/.profile file. To make the settings permanent for all accounts on your system, create a one-line .sh script in your system's /etc/profile.d folder that sources setvars.sh (for more details, see Ubuntu documentation on Environment Variables).
The setvars.sh script can be managed using a configuration file, which is especially helpful if you need to initialize specific versions of libraries or the compiler, rather than defaulting to the "latest" version. For more details, see Using a Configuration File to Manage Setvars.sh.If you need to set up the environment in a non-POSIX shell, see oneAPI Development Environment Setup for more configuration options.
GPU: Disable Hangcheck
This section applies only to applications with long-running GPU compute workloads in native environments. It is not recommended for virtualizations or other standard usages of GPU, such as gaming.
A workload that takes more than four seconds for GPU hardware to execute is a long running workload. By default, individual threads that qualify as long-running workloads are considered hung and are terminated. By disabling the hangcheck timeout period, you can avoid this problem.
- Open a terminal.
- Open the grub file in /etc/default.
- In the grub file, find the line GRUB_CMDLINE_LINUX_DEFAULT="" .
- Enter this text between the quotes (""):
i915.enable_hangcheck=0
- Run this command:
sudo update-grub
- Reboot the system. Hangcheck remains disabled.
GPU Drivers or Plug-ins (Optional)
You can develop oneAPI applications using C++ and SYCL* that run on Intel, AMD*, or NVIDIA* GPUs.
To develop and run applications for specific GPUs, you must first install the corresponding drivers or plug-ins:
- To use an Intel GPU, install the latest Intel GPU drivers.
- To use an AMD GPU (Linux only):
- Read the oneAPI for AMD GPUs Guide from Codeplay.
- Download oneAPI for AMD GPUs.
- To use an NVIDIA GPU (Linux and Windows):
- Read the oneAPI for NVIDIA® GPUs Guide from Codeplay.
- Download oneAPI for NVIDIA® GPUs.
GPU: Add User to Video Group
For GPU compute workloads, non-root (normal) users do not typically have access to the GPU device.
- To give a user access, first determine which group name is assigned ownership of the render nodes:
stat -c "%G" /dev/dri/render*
In this example, the video group is assigned ownership of the render nodes:
- Determine if the current user is a member of that render node group:
groups ${USER}
In this example the current user is not included in the video group.
- Add the user to the group using gpasswd:
sudo gpasswd -a ${USER} video
- Activate the video group:
newgrp video