我正在尝试让 WSL2 识别我的 GPU。我已按照此操作指导,看了这个回复邮政,运行了多个其他教程,但我仍然无法连接 GPU。当我运行以下命令时,我得到:
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.
即使我安装了教程中提供的所有驱动程序。我还在 Dev 上安装了 Windows Insider,安装了所有更新。此外,我是 WSL 的新手,这使事情变得更加复杂。任何帮助都将不胜感激。
我的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 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
答案1
您需要等待新的驱动程序更新用于正常工作的 Nvidia-smi。
除了该问题之外,您的 GPU 应该已经在 WSL2 中工作了。确保您的 GPU 至少来自 Kepler 系列,并且您已安装最新的 WDDM3.0 驱动程序。
打开 WSL2 并查找设备/dev/dxg
。如果存在,则表示你的 GPU 在 WSL2 内可用。如果你使用的是 Ubuntu,建议更新你的 mesa 库:
sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt-get update
之后,一个简单的glxinfo -B
GPU 名称应该显示如下:
$ 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