
我嘗試檢查 Windows 11 上安裝的 WSL2 子系統上安裝的 ubuntu 22.04 中的 nvidia 驅動程式版本,但是,我收到錯誤「無法初始化 NVML:GPU 存取被作業系統阻止」。我的目標是能夠將我的 RTX 2080 ti(或 GTX 1060)傳遞到像 FreeBSD 這樣的客戶作業系統。這能實現嗎?希望在這個問題上得到您的支持。
在 Windows 11 主機作業系統上它可以運作:
# nvidia-smi
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 536.40 Driver Version: 536.40 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce GTX 1060 3GB WDDM | 00000000:01:00.0 On | N/A |
| 57% 41C P2 25W / 120W | 710MiB / 3072MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce RTX 2080 Ti WDDM | 00000000:02:00.0 Off | N/A |
| 31% 40C P8 21W / 250W | 74MiB / 11264MiB | 0% |
+_________________________________________+______________________+______________________|
在 Ubuntu 22.04 來賓作業系統上則不然:
# nvidia-smi
Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system
但 :
# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jun_13_19:16:58_PDT_2023
Cuda compilation tools, release 12.2, V12.2.91
Build cuda_12.2.r12.2/compiler.32965470_0
# python3 --version
Python 3.10.7
在 ubuntu 22.04 中,我使用以下說明安裝了 cuda-12.2:
# wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
# sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
# wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb
# sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb
# sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
# sudo apt-get update
# sudo apt-get -y install nvidia-cuda-toolkit
從這裡獲取的說明:
我的電腦有 2 張顯示卡:
NVIDIA GeForce GTX 1060 3GB
NVIDIA GeForce RTX 2080 Ti
下面您可以看到 WIndows 11 上安裝的兩個 GPU 的 nvidia 驅動程式版本:
我還將以下行添加到/home/marietto/.bashrc and to /root/.bashrc
:
export PATH=/usr/local/cuda-12.2/bin${PATH:+:${PATH}}
我做了:
# source /home/marietto/.bashrc
# source /root/.bashrc
重啟後,我不知道還能做什麼。
一些背景:
Windows 版本 = Windows 11 PRO 版本 10.0.22000.2176
WSL 版本 = 1.3.11.0
我正在使用 WSL 2
內核版本 = 6.1.38-microsoft-standard
發行版 = Ubuntu 22.10
版本核心:5.15.90.2-3
版本 WSLg:1.0.54
版本MSRDC:1.2.4240
Direct3D版本:1.608.2-61064218
DXCore版本:10.0.25880.1000-230602-1350.main