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*.
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
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 the system for these changes to take effect.
Step 3: Configure permissions
To access GPU capabilities, the user needs to have correct permissions on system. Use the following command to list the group assigned ownership of the render nodes and list the groups the active user is a member of:
stat -c "%G" /dev/dri/render* groups ${USER}
If a group is listed for the render node that is not listed for the user, add the user to the group using gpasswd:
sudo gpasswd -a ${USER} render newgrp render
Step 4: Verify installation
Verify Computing drivers installation:
sudo apt-get install clinfo clinfoThe 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 the system for these changes to take effect.
Step 3: Configure permissions
To access GPU capabilities, the user needs to have correct permissions on system. Use the following command to list the group assigned ownership of the render nodes and list the groups the active user is a member of:
stat -c "%G" /dev/dri/render* groups ${USER}
If a group is listed for the render node that is not listed for the user, add the user to the group using gpasswd:
sudo gpasswd -a ${USER} render newgrp render
Step 4: Verify installation
Verify Computing drivers installation:
sudo apt-get install clinfo clinfoThe 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