I am trying to get my GPU recognized by WSL2. I have followed this guide, looked at the reply to this post, ran through multiple other tutorials and I still cannot get my GPU connected. When I run the following command I get:

nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

even though I installed all the drivers given in the tutorial. I also have Windows Insider on Dev, installed all updates. Moreover, I am new to working with WSL which complicates things even further. Any help would be greatly appreciated.

My glxinfo -B output:

name of display: :0
NVD3D10: CPU cyclestats are disabled on client virtualization
NVD3D10: CPU cyclestats are disabled on client virtualization
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Microsoft Corporation (0xffffffff)
    Device: D3D12 (NVIDIA GeForce GTX 1660 SUPER) (0xffffffff)
    Version: 21.2.0
    Accelerated: yes
    Video memory: 22349MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (NVIDIA GeForce GTX 1660 SUPER)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.0-devel (git-17d7b0b 2021-05-30 focal-oibaf-ppa)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 21.2.0-devel (git-17d7b0b 2021-05-30 focal-oibaf-ppa)
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.2.0-devel (git-17d7b0b 2021-05-30 focal-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Solution 1:

You will need to wait for a new driver update for a working Nvidia-smi.

Other than that issue your GPU should work already in WSL2. Make sure your GPU is at least from Kepler family and you have installed latest WDDM3.0 drivers.

Open WSL2 and look for the device /dev/dxg. If it exists, your GPU is available inside WSL2. If you are on Ubuntu is recommended to update your mesa libraries:

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt-get update

After that a simple glxinfo -B should show your GPU name like this:

$ glxinfo -B
name of display: :0
NVD3D10: CPU cyclestats are disabled on client virtualization
NVD3D10: CPU cyclestats are disabled on client virtualization
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Microsoft Corporation (0xffffffff)
    Device: D3D12 (NVIDIA GeForce GT 710) (0xffffffff)
    Version: 21.0.1
    Accelerated: yes
    Video memory: 9136MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (NVIDIA GeForce GT 710)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.0.1
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 21.0.1
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.0.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00