PyTorch Prerequisites for Intel GPUs
These prerequisites let you compile and build PyTorch* 2.5 with optimizations for Intel GPUs. Developers doing early access stabilization work can also use these instructions when compiling and building PyTorch 2.4.
Important: Read the Release Notes for the latest information and known issues about system requirements and support packages.
The following sections provide prerequisite instructions for using:
- Intel Data Center GPUs such as Intel® Data Center GPU Max Series platforms, or
- Intel Client GPUs or CPUs with integrated GPUs such as Intel® Core™ Ultra Processors with Intel® Arc™ Graphics.
Build for Intel Data Center GPUs
These Intel Data Center GPUs are supported:
- Intel® Data Center GPU Max Series platforms (formerly codename Ponte Vecchio or PVC)
These Linux releases are supported:
- Red Hat* Enterprise Linux* 9.2
- SUSE Linux Enterprise Server* 15 SP5
- Ubuntu* Server 22.04 (>= 5.15 LTS kernel)
The following instructions show how to install:
-
Intel Data Center GPU Drivers along with compute and media runtimes and development packages
-
Intel GPU dependencies for PyTorch development package that collects a subset of oneAPI components needed for building and running PyTorch.
-
Profiling Tools Interfaces for Intel GPU (PTI for GPU) package that provides Kineto (part of the PyTorch profiler) with the interfaces it needs for collecting timing data from Intel GPUs for performance metrics during training and inference.
Step 1: Install Intel Data Center GPU Drivers
The Data Center GPU Installation Instructions describe software installation for Intel® Data Center GPU Max Series systems, along with compute and media runtimes and development packages. These general installation instructions install the Long Term Support (LTS) version of the Intel GPU drivers. However, you'll need to use the Intel GPU driver's rolling (also referred to as "rolling stable" or simply "rolling") release stream since this is where new hardware enablement first appears for early adopters who want to evaluate new features.
- The Intel GPU dependencies for PyTorch development package works with either the Intel GPU drivers LTS or rolling release stream.
- The PTI for GPU package only works with the Intel GPU drivers rolling release stream.
Important: If your use case needs the PyTorch profiler (and hence PTI for GPU support), follow the instructions in the Data Center GPU Release Streams documentation to configure the installation repository to the rolling release stream before following the rest of the GPU driver installation instructions. If PTI for GPU is not required, use the LTS release stream.
Before you can install the GPU drivers, you'll need to configure which release stream to use.
-
Configure the Release Stream
Here are links to specific sections in the Data Center GPU Installation Instructions for configuring the release stream, based on the Linux distribution you're using. As previously mentioned, choose the LTS or rolling release stream as appropriate for your use case:
• Release stream configuration: Red Hat Enterprise Linux Server
• Release stream configuration: SUSE Linux Enterprise Server
• Release stream configuration: Ubuntu Server -
Install the Intel GPU Drivers from the Configured Stream
After you've configured the release stream, here are links to specific sections within the Data Center GPU installation instructions for installing the Intel GPU drivers, based on the Linux distribution you're using. These installation instructions assume you're using the LTS release stream. Since you've already configured the release stream in the previous step, skip instructions that would change it.
• Intel GPU drivers installation: Red Hat Enterprise Linux Server
• Intel GPU drivers installation: SUSE Linux Enterprise Server
• Intel GPU drivers installation: Ubuntu Server -
Configure Render Group Membership
After the Intel GPU drivers are installed, follow these instructions to Configure Render Group Membership to have access to DRM render nodes.
-
Optional GPU Hardware Verification
Optionally, follow these instructions to verify expected Intel GPU hardware is working.
Step 2: Install Intel Support Packages
After the Intel GPU drivers are installed, choose one of these ways to install the two Intel support packages: either using a Linux package manager: APT, YUM, or Zypper, or using offline installation scripts
For RPM-based distributions such as Red Hat Enterprise Linux Server, YUM is the usual choice. You’ll need to configure YUM to install software packages that aren’t available in the default repositories. These instructions show how to add access to the appropriate Intel repository, along with the public key used to authenticate the downloaded packages.
- Create an Intel YUM repository information file and move it to the YUM configuration directory:
tee > /tmp/intel-for-pytorch-gpu-dev.repo << EOF [intel-for-pytorch-gpu-dev] name=Intel for Pytorch GPU dev repository baseurl=https://yum.repos.intel.com/intel-for-pytorch-gpu-dev enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB EOF sudo mv /tmp/intel-for-pytorch-gpu-dev.repo /etc/yum.repos.d
- Use YUM to install the two Intel support packages:
sudo yum install intel-for-pytorch-gpu-dev intel-pti-dev
For SUSE Linux Enterprise Server distributions, Zypper is the usual choice. You’ll need to configure Zypper to install software packages that aren’t available in the default repositories. These instructions show how to add access to the appropriate Intel repository, along with the public key used to authenticate the downloaded packages.
- The Zypper package manager uses the same
rpm
packages used by YUM, so add the Intel YUM repository:sudo zypper addrepo https://yum.repos.intel.com/intel-for-pytorch-gpu-dev intel-for-pytorch-gpu-dev
- If Zypper was unable to automatically import the Intel repository's public key, use RPM to manually import the key:
rpm --import https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
- Use Zypper to install the two Intel support packages:
sudo zypper install intel-for-pytorch-gpu-dev intel-pti-dev
For Debian-based Linux distributions such as Ubuntu Server, APT is the usual choice. You’ll need to configure APT to install software packages that aren’t available in the default repositories. These instructions show how to add access to the appropriate Intel repository, along with the public key used to authenticate the downloaded packages.
- Make sure the necessary tools to add repository access are available:
sudo apt update sudo apt install -y gpg-agent wget
- Download the Intel APT repository’s public key and put it into the
/usr/share/keyrings
directory:wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor > /tmp/intel-for-pytorch-gpu-dev-keyring.gpg sudo mv /tmp/intel-for-pytorch-gpu-dev-keyring.gpg /usr/share/keyrings
- Configure the APT client to add the Intel repository and its key:
echo "deb [signed-by=/usr/share/keyrings/intel-for-pytorch-gpu-dev-keyring.gpg] https://apt.repos.intel.com/intel-for-pytorch-gpu-dev all main" > /tmp/intel-for-pytorch-gpu-dev.list sudo mv /tmp/intel-for-pytorch-gpu-dev.list /etc/apt/sources.list.d
- Update the APT client package list and repository index:
sudo apt update
- Use APT to install the two Intel support packages:
sudo apt install intel-for-pytorch-gpu-dev intel-pti-dev
Instead of using a package manager, you can install the two Intel development packages using offline installation scripts. Each installation script is a file containing all the needed files together with a script that extracts and installs the development package.
IMPORTANT: Use sudo
to install files in system directories so they're available globally. Without sudo, files are installed in the current user's home directory.
- Make sure the necessary tools are available:
sudo apt update sudo apt install -y wget
- Download and install the Intel GPU dependencies for PyTorch development installation script:
cd /tmp wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/6758ce21-bde6-47f8-b4bf-6df4301f187d/l_intel-for-pytorch-gpu-dev_p_0.5.1.40_offline.sh sh ./l_intel-for-pytorch-gpu-dev_p_0.5.1.40_offline.sh
- Download and install the Profiling Tools Interfaces for GPU installation script:
cd /tmp wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/6758ce21-bde6-47f8-b4bf-6df4301f187d/l_intel-pti-dev_p_0.8.0.24_offline.sh sh ./l_intel-pti-dev_p_0.8.0.24_offline.sh
Step 3: Set Up oneAPI Environment Variables
Before you use any oneAPI component, you must have environment variables set to configure important folders and command settings. By default, oneAPI components are put in the /opt/intel/oneapi
, so configure the oneAPI environment using this command:
source /opt/intel/oneapi/setvars.sh
If that command fails, you may have installed the oneAPI components in your home directory, so try using this command instead:
source ~/intel/oneapi/setvars.sh
Consider adding this command to your ~/.bashrc
file so it runs every time you log in or create a new shell session.
Build for Intel Client GPUs
These Intel Client GPUs and CPUs with integrated GPUs are supported:
- Intel® Core™ Ultra processor family with Intel® Arc™ Graphics (Codename Meteor Lake)
- Intel® Arc™ Graphics family (Codename DG2)
These OS releases are supported:
- Windows 11 Family, Windows 10 (22H2)
- Windows Subsystem for Linux - Ubuntu 22.04 (WSL2)
- Ubuntu* 22.04, kernel version >= 6.7, depending on graphics process model, as shown in this Hardware Devices table)
The following instructions show how to install prerequisite components depending on your OS:
-
Intel Client GPU Drivers along with compute and media runtimes and development packages
-
Intel GPU dependencies for PyTorch development package, which collects a subset of oneAPI components needed for building and running PyTorch.
-
Profiling Tools Interfaces for Intel GPU (PTI for GPU) package that provides Kineto (part of the PyTorch profiler) with the interfaces it needs for collecting timing data from Intel GPUs for performance metrics during training and inference. (PTI for GPU is only supported on Linux and not Windows.)
Install for Windows 10/11
Step 1: Install Intel Client GPU Drivers
Follow the instructions in the Intel® Arc™ & Iris® Xe Graphics - Windows documentation to download and run the installer to update your WHQL Certified graphics driver to version 31.0.101.5522 or higher. That document also has links to version-specific release notes about this driver.
Step 2: Install Intel Support Package
Click on this link to download the PyTorch dev support package. Then double-click on the downloaded exe file to run it and follow the instructions to install:
The PTI SDK support package, which enables PyTorch profiling on Intel GPUs, is a Linux-only component and is not available for Windows.
Step 3: Set Up oneAPI Environment
Before you use any oneAPI component, you must have system variables set to configure important folders and command settings. By default, oneAPI components are put in the C:\Program Files (x86)\Intel\oneAPI
folder, so configure the oneAPI environment using this command:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
This command must be run every time you log in or create a new shell session.
Install for WSL2
Step 1: Install Intel Client GPU Drivers
When using WSL2, the GPU drivers are installed in the Windows OS and runtime components such as Level-Zero are installed within the WSL2 Linux environment.
-
Follow the instructions in the Intel® Arc™ & Iris® Xe Graphics - Windows documentation to download and run the Windows installer to update your WHQL Certified graphics driver to version 31.0.101.5522 or higher. That document also has links to version-specific release notes about this driver.
-
Configure the Ubuntu APT client to add the Intel graphics repository and its key (within WSL2) and update the APT client package list and repository index:
sudo apt-get install -y gpg-agent wget wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor --output /tmp/intel-graphics.gpg sudo mv /tmp/intel-graphics.gpg /usr/share/keyrings/ echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" > /tmp/intel-gpu-jammy.list sudo mv /tmp/intel-gpu-jammy.list /etc/apt/sources.list.d/ sudo apt-get update
- Install the necessary runtime packages (in WSL2)
sudo apt-get install intel-igc-cm intel-level-zero-gpu intel-opencl-icd \ level-zero libigc1 libigdfcl1 libigdgmm12
Step 2: Install Intel Support Packages
- Download the Intel APT repository’s public key and put it into the
/usr/share/keyrings
directory:wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor > /tmp/intel-for-pytorch-gpu-dev-keyring.gpg sudo mv /tmp/intel-for-pytorch-gpu-dev-keyring.gpg /usr/share/keyrings
- Configure the APT client to add the Intel repository and its key:
echo "deb [signed-by=/usr/share/keyrings/intel-for-pytorch-gpu-dev-keyring.gpg] https://apt.repos.intel.com/intel-for-pytorch-gpu-dev all main" > /tmp/intel-for-pytorch-gpu-dev.list sudo mv /tmp/intel-for-pytorch-gpu-dev.list /etc/apt/sources.list.d
- Update the APT client package list and repository index:
sudo apt update
- Use APT to install the Intel support packages:
sudo apt install intel-for-pytorch-gpu-dev intel-pti-dev
Step 3: Set Up oneAPI Environment Variables
Before you use any oneAPI component, you must have environment variables set to configure important folders and command settings. By default, oneAPI components are put in the /opt/intel/oneapi
, so you should configure the oneAPI environment using this command:
source /opt/intel/oneapi/setvars.sh
Consider adding this command to your ~/.bashrc
file so it runs every time you log in or create a new shell session.
Install for Ubuntu 22.04
For native Ubuntu, you'll need to have a Linux kernel with support for Intel graphics hardware, which wasn't available when Ubuntu 22.04 was released. You can find out your kernel version with the uname -r
command. If your kernel version is not 6.7 or higher, you'll need to upgrade the Linux kernel. After upgrading the kernel, as noted in the graphics hardware devices documentation, you'll need to update the GRUB parameters to add the i915.force_probe parameter to the kernel boot.
Step 1: Install Intel Client GPU Drivers
- Configure the Ubuntu APT client to add the Intel graphics repository and its key and update the APT client package list and repository index
sudo apt-get install -y gpg-agent wget wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ gpg --yes --dearmor --output /tmp/intel-graphics.gpg sudo mv /tmp/intel-graphics.gpg /usr/share/keyrings/ echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" > /tmp/intel-gpu-jammy.list sudo mv /tmp/intel-gpu-jammy.list /etc/apt/sources.list.d/ sudo apt update
- Install Compute, Media, and Display runtimes
sudo apt install -y \ intel-opencl-icd intel-level-zero-gpu level-zero \ intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \ libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \ libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \ mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo
Step 2: Install Intel Support Packages
- Download the Intel APT repository’s public key and put it into the
/usr/share/keyrings
directory:wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor > /tmp/intel-for-pytorch-gpu-dev-keyring.gpg sudo mv /tmp/intel-for-pytorch-gpu-dev-keyring.gpg /usr/share/keyrings
- Configure the APT client to add the Intel repository and its key:
echo "deb [signed-by=/usr/share/keyrings/intel-for-pytorch-gpu-dev-keyring.gpg] https://apt.repos.intel.com/intel-for-pytorch-gpu-dev all main" > /tmp/intel-for-pytorch-gpu-dev.list sudo mv /tmp/intel-for-pytorch-gpu-dev.list /etc/apt/sources.list.d
- Update the APT client package list and repository index:
sudo apt update
- Use APT to install the Intel support package:
sudo apt install intel-for-pytorch-gpu-dev intel-pti-dev
Step 3: Set Up oneAPI Environment Variables
Before you use any oneAPI component, you must have environment variables set to configure important folders and command settings. By default, oneAPI components are put in the /opt/intel/oneapi
, so configure the oneAPI environment using this command:
source /opt/intel/oneapi/setvars.sh
Consider adding this command to your ~/.bashrc
file so it runs every time you log in or create a new shell session.
Where to go next?
After installing Intel GPU drivers and the support package, as shown above, you're ready to return to and continue following the upstream PyTorch instructions in the PyTorch Building from Source: Install Dependencies section.
Support
For support questions, look through or post a question to this oneAPI developer support forum.