Configure WSL 2 for GPU Workflows
With Microsoft* Windows Subsystem for Linux 2 (WSL 2), you can use native Linux distribution of Intel® oneAPI tools and libraries on Windows*. Get the latest version of WSL 2 following the process described in The Windows Subsystem for Linux in the Microsoft Store is now generally available on Windows 10 and 11.
To be able to use Intel oneAPI tools on WSL 2 for GPU workflows, install the Intel GPU drivers as described below.
Ubuntu* 20.04 (focal)
Step 1: Add package repository
Install the repositories.intel.com/graphics package repository by executing the following command in your WSL 2 console:
sudo apt-get install -y gpg-agent wget wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu focal-devel main' | \ sudo tee /etc/apt/sources.list.d/intel.gpu.focal.list sudo apt update
The code above performs the following:
Checks that your system has gpg-agent and wget installed
Downloads and installs the public key used to verify the integrity of the package repository
Adds the repositories.intel.com/graphics repository to the system
Step 2: Install runtime and development (optional) packages
Install GPU software packages with the following command:
sudo apt-get install \ 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 libigdgmm11 libxatracker2 mesa-va-drivers \ mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all
OPTIONAL: If you plan to perform development tasks, you need to install the following optional development packages to make sure that oneAPI tools function correctly:
sudo apt-get install -y \ libigc-dev \ intel-igc-cm \ libigdfcl-dev \ libigfxcmrt-dev \ level-zero-dev
Reboot WSL 2 by executing wsl.exe –shutdown in PowerShell.
Step 3: Verify installation
Verify Computing drivers installation:
sudo apt-get install clinfo clinfo
The command should return similar to the following:
Number of platforms 2 Platform Name Intel(R) OpenCL HD Graphics Platform Vendor Intel(R) Corporation Platform Version OpenCL 3.0 Platform Profile FULL_PROFILE
Ubuntu* 22.04 (jammy)
Step 1: Add package repository
Install the repositories.intel.com/graphics package repository by executing the following command in your WSL 2 console:
sudo apt-get install -y gpg-agent wget wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo 'deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc' | \ sudo tee /etc/apt/sources.list.d/intel.gpu.jammy.list
The code above performs the following:
Checks that your system has gpg-agent and wget installed
Downloads and installs the public key used to verify the integrity of the package repository
Adds the repositories.intel.com/graphics repository to the system
Step 2: Install runtime and development (optional) packages
Install GPU software packages with the following command:
sudo apt-get 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
OPTIONAL: If you plan to perform development tasks, you need to install the following optional development packages to make sure that oneAPI tools function correctly:
sudo apt-get install -y \ libigc-dev \ intel-igc-cm \ libigdfcl-dev \ libigfxcmrt-dev \ level-zero-dev
To support Steam games, install i386 packages:
sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install -y \ udev mesa-va-drivers:i386 mesa-common-dev:i386 mesa-vulkan-drivers:i386 \ libd3dadapter9-mesa-dev:i386 libegl1-mesa:i386 libegl1-mesa-dev:i386 \ libgbm-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev:i386 \ libgles2-mesa:i386 libgles2-mesa-dev:i386 libosmesa6:i386 \ libosmesa6-dev:i386 libwayland-egl1-mesa:i386 libxatracker2:i386 \ libxatracker-dev:i386 mesa-vdpau-drivers:i386 libva-x11-2:i386
Reboot WSL 2 by executing wsl.exe –shutdown in PowerShell.
Step 3: Verify installation
Verify Computing drivers installation:
sudo apt-get install clinfo clinfo
The command should return similar to the following:
Number of platforms 2 Platform Name Intel(R) OpenCL HD Graphics Platform Vendor Intel(R) Corporation Platform Version OpenCL 3.0 Platform Profile FULL_PROFILE