PyTorch* Prerequisites for Intel GPUs

ID 827139
Updated 10/10/2024
Version
Public

author-image

By

PyTorch Prerequisites for Intel GPUs

These prerequisites let you compile and build PyTorch* 2.5 with optimizations for Intel Data Center or Client GPUs.

Developers compiling and building PyTorch 2.4 (for Intel Data Center GPUs only) should instead follow the prerequisite instructions for 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, when building PyTorch 2.4 or 2.5, or
  • Intel Client GPUs or CPUs with integrated GPUs such as Intel® Core™ Ultra Processors with Intel® Arc™ Graphics, when building PyTorch 2.5.

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, which collects a subset of oneAPI components needed for building and running PyTorch.

  • Profiling Tools Interfaces for Intel GPU (PTI for GPU) package, which provides Kineto (part of the PyTorch profiler) with the interfaces it needs to collect 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") release stream since this is where new hardware enablement first appears for early adopters who want to evaluate new features.

Important: Follow the instructions to configure the GPU driver's installation repository to the rolling release stream (and not the LTS stream) as described in the GPU driver installation instructions.

  1. Install the Intel GPU Drivers

    Use the instructions in the Linux OS-specific tabs within the Data Center GPU installation instructions for installing the Intel GPU drivers, based on the Linux distribution you're using. Be sure to follow all the instructions including selecting the right release stream and adding your user to the render node group

  2. 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. Note that installing the development support package assumes you don't already have existing oneAPI components installed. You should uninstall them if you do.

 

Step 3: Set Up oneAPI Environment Variables

Before you use any oneAPI component installed by the PyTorch development bundle, use this command to configure environment variables, important folders, and command settings.

source /opt/intel/oneapi/pytorch-gpu-dev-0.5/oneapi-vars.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/pytorch-gpu-dev-0.5/oneapi-vars.sh

Similarly, activate the PTI component using this command:

source /opt/intel/oneapi/pti/latest/env/vars.sh

Consider adding these commands to your ~/.bashrc file so they run 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 for PyTorch 2.5 (and are not supported for PyTorch 2.4):

  • Intel® Core™ Ultra processor family with Intel® 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 (WSL2) running Ubuntu 24.04 (WSL2 support is experimental)
  • Note: Linux (e.g., Ubuntu) is not supported.

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 that collects a subset of oneAPI components needed for building and running PyTorch.

  • Profiling Tools Interfaces for Intel GPU (PTI for GPU) package, which 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.

Install for Windows 10/11

Step 1: Install Intel Client GPU Drivers

Follow the instructions in the Intel® & 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 the following two links to download the PyTorch dev support package and PTI support package installers. (The PTI support package enables PyTorch profiling on Intel GPUs.) Then double-click on the downloaded exe files to run it and follow the instructions to install:
 

Step 3: Set Up oneAPI Environment

Before you use any oneAPI component installed by the PyTorch development bundle, use these two commands to configure environment variables, important folders, and command settings for the dev bundle and PTI support packages:

"C:\Program Files (x86)\Intel\oneAPI\pytorch-gpu-dev-0.5\oneapi-vars.bat"
"C:\Program Files (x86)\Intel\oneAPI\pti\latest\env\vars.bat"

These commands must be run every time you log in or create a new shell session.

Install for WSL2

Support for Windows Subsystem for Linux (WSL2) is experimental.

Step 1: Install Intel Client GPU Drivers

When using WSL2 (running Ubuntu 24.04) , the GPU drivers are installed in the Windows OS and runtime components such as Level-Zero are installed within the WSL2 Linux environment.
 

  1. Follow the instructions in the Intel® & 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.

  2. Install the necessary runtime packages from Canonical (in WSL2):

    sudo apt-get update
    
    sudo apt-get install -y intel-ocloc intel-opencl-icd libze1 libze-intel-gpu1
    

Step 2: Install Intel Support Packages

  1. 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
    
  1. 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
    
  1. Update the APT client package list and repository index:
    sudo apt update
    
  1. Use APT to install the two Intel support packages:
    sudo apt install intel-for-pytorch-gpu-dev-0.5 intel-pti-dev
    

Step 3: Set Up oneAPI Environment Variables

Before you use any oneAPI component installed by the PyTorch development bundle, use this command to configure environment variables, important folders, and command settings

source /opt/intel/oneapi/pytorch-gpu-dev-0.5/oneapi-vars.sh

Activate the PTI component using this command:

source /opt/intel/oneapi/pti/latest/env/vars.sh

Consider adding these commands to your ~/.bashrc file so they run every time you log in or create a new shell session.

Where to go next?

After installing Intel GPU drivers and the two support packages, 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.