最近在研究AI,如果在Linux系统中部署的话需要重装系统,有些麻烦,又不想折腾。所以闲置很久没研究的WSL又拿起来研究了,当然部署ai还需要显卡驱动的支持,就必须先安装显卡驱动。
还没有安装过WSL的童鞋可以看我之前发布的这篇文章
windows11 安装 Linux子系统 WSL及ubuntu22.04
Windows 查看显卡
首先在Windows中查看驱动是否正常,我们可以输入以下nvidia-smi
命令
C:\Users\anan>nvidia-smi
Tue Jun 20 09:25:10 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 512.36 Driver Version: 512.36 CUDA Version: 11.6 |
|-------------------------------+----------------------+----------------------+
| 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 ... WDDM | 00000000:01:00.0 On | N/A |
| N/A 37C P0 12W / N/A | 1307MiB / 4096MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 2628 C+G ...lPanel\SystemSettings.exe N/A |
| 0 N/A N/A 7192 C+G ...y\ShellExperienceHost.exe N/A |
| 0 N/A N/A 7724 C+G C:\Windows\System32\dwm.exe N/A |
| 0 N/A N/A 8792 C+G ...e\PhoneExperienceHost.exe N/A |
| 0 N/A N/A 10328 C+G ...8bbwe\WindowsTerminal.exe N/A |
| 0 N/A N/A 12020 C+G ...8bbwe\WindowsTerminal.exe N/A |
| 0 N/A N/A 12344 C+G ...2txyewy\TextInputHost.exe N/A |
| 0 N/A N/A 15364 C+G ...CloudMusic\cloudmusic.exe N/A |
| 0 N/A N/A 15468 C+G ...bbwe\PAD.Console.Host.exe N/A |
| 0 N/A N/A 15756 C+G ...ysdiag\bin\HipsDaemon.exe N/A |
| 0 N/A N/A 16232 C+G ...823.51\msedgewebview2.exe N/A |
| 0 N/A N/A 16740 C+G ...me\Application\chrome.exe N/A |
| 0 N/A N/A 18084 C+G ...artMenuExperienceHost.exe N/A |
| 0 N/A N/A 18208 C+G ...text-x64-win\MarkText.exe N/A |
| 0 N/A N/A 18260 C+G ...ck\app-4.32.127\slack.exe N/A |
| 0 N/A N/A 19064 C+G ...2gh52qy24etm\Nahimic3.exe N/A |
| 0 N/A N/A 19828 C+G ...pplication\360ChromeX.exe N/A |
| 0 N/A N/A 20512 C+G ...d\runtime\WeChatAppEx.exe N/A |
| 0 N/A N/A 20692 C+G ...n1h2txyewy\SearchHost.exe N/A |
| 0 N/A N/A 20924 C+G ...8bbwe\Notepad\Notepad.exe N/A |
| 0 N/A N/A 22132 C+G ...8wekyb3d8bbwe\Cortana.exe N/A |
| 0 N/A N/A 23844 C+G C:\Windows\explorer.exe N/A |
+-----------------------------------------------------------------------------+
进入WSL
搜索通过 bash
或者 wsl
命令启动Ubuntu 22.04子系统
安装Nvidia显卡驱动
输入以下命令进行 Nvidia 驱动的安装
sudo apt install nvidia-cuda-toolkit
输入命令后会自动列出需要安装的依赖包,我们只需要输入Y
回车
linuxitellu@anan: sudo apt install nvidia-cuda-toolkit
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
将会同时安装下列软件:
adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-core ca-certificates-java cpp-11 dconf-gsettings-backend
dconf-service fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-extra g++-11 gcc-11 gcc-11-base
gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme java-common javascript-common
libaccinj64-11.5 libasan6 libasound2 libasound2-data libasyncns0 libatk-bridge2.0-0 libatk-wrapper-java
libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatomic1 libatspi2.0-0 libavahi-client3 libavahi-common-data
libavahi-common3 libbabeltrace1 libboost-regex1.74.0 libc-dev-bin libc-devtools libc6-dev libcairo-gobject2
libcairo2 libcc1-0 libcrypt-dev libcub-dev libcublas11 libcublaslt11 libcudart11.0 libcufft10 libcufftw10
libcuinj64-11.5 libcups2 libcupti-dev libcupti-doc libcupti11.5 libcurand10 libcusolver11 libcusolvermg11
libcusparse11 libdatrie1 libdconf1 libdebuginfod-common libdebuginfod1 libdeflate0 libdouble-conversion3
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libegl-dev libegl-mesa0 libegl1 libflac8 libfontconfig1
libfontenc1 libfreetype6 libgail-common libgail18 libgbm1 libgcc-11-dev libgd3 libgdk-pixbuf-2.0-0
libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgif7 libgl-dev libgl1 libgl1-amber-dri libgl1-mesa-dev
libgl1-mesa-dri libglapi-mesa libgles-dev libgles1 libgles2 libglvnd-core-dev libglvnd-dev libglvnd0 libglx-dev
libglx-mesa0 libglx0 libgomp1 libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libice6
libipt2 libisl23 libitm1 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-sphinxdoc libjs-underscore liblcms2-2
libllvm15 liblsan0 libmpc3 libnppc11 libnppial11 libnppicc11 libnppidei11 libnppif11 libnppig11 libnppim11
libnppist11 libnppisu11 libnppitc11 libnpps11 libnsl-dev libnvblas11 libnvidia-compute-495 libnvidia-compute-510
libnvidia-ml-dev libnvjpeg11 libnvrtc-builtins11.5 libnvrtc11.2 libnvtoolsext1 libnvvm4 libogg0 libopengl-dev
libopengl0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcre2-16-0 libpixman-1-0
libpthread-stubs0-dev libpulse0 libqt5core5a libqt5dbus5 libqt5network5 libquadmath0 librsvg2-2 librsvg2-common
libsensors-config libsensors5 libsm6 libsndfile1 libsource-highlight-common libsource-highlight4v5 libstdc++-11-dev
libtbb-dev libtbb12 libtbbmalloc2 libthai-data libthai0 libthrust-dev libtiff5 libtirpc-dev libtsan0 libubsan1
libvdpau-dev libvdpau1 libvorbis0a libvorbisenc2 libwayland-client0 libwayland-cursor0 libwayland-egl1
libwayland-server0 libwebp7 libx11-dev libx11-xcb1 libxau-dev libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0 libxcb-randr0 libxcb-render-util0 libxcb-render0
libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb1-dev
libxcomposite1 libxcursor1 libxdamage1 libxdmcp-dev libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon-x11-0
libxkbcommon0 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1
libxxf86vm1 linux-libc-dev manpages-dev mesa-vdpau-drivers node-html5shiv nsight-compute nsight-compute-target
nsight-systems nsight-systems-target nvidia-cuda-dev nvidia-cuda-gdb nvidia-cuda-toolkit-doc nvidia-opencl-dev
nvidia-profiler nvidia-visual-profiler ocl-icd-libopencl1 ocl-icd-opencl-dev opencl-c-headers opencl-clhpp-headers
openjdk-8-jre openjdk-8-jre-headless qttranslations5-l10n rpcsvc-proto session-migration ubuntu-mono
vdpau-driver-all x11-common x11-utils x11proto-dev xorg-sgml-doctools xtrans-dev
建议安装:
gcc-11-locales g++-11-multilib gcc-11-doc gcc-11-multilib default-jre apache2 | lighttpd | httpd libasound2-plugins
alsa-utils glibc-doc cups-common libgd-tools gvfs liblcms2-utils opus-tools pulseaudio librsvg2-bin lm-sensors
libstdc++-11-doc libtbb-doc libvdpau-doc libx11-doc libxcb-doc nodejs opencl-clhpp-headers-doc libnss-mdns
fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei fonts-indic libvdpau-va-gl1 mesa-utils
推荐安装:
libnvcuvid1
下列【新】软件包将被安装:
adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-core ca-certificates-java cpp-11 dconf-gsettings-backend
dconf-service fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-extra g++-11 gcc-11 gcc-11-base
gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme java-common javascript-common
libaccinj64-11.5 libasan6 libasound2 libasound2-data libasyncns0 libatk-bridge2.0-0 libatk-wrapper-java
libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatomic1 libatspi2.0-0 libavahi-client3 libavahi-common-data
libavahi-common3 libbabeltrace1 libboost-regex1.74.0 libc-dev-bin libc-devtools libc6-dev libcairo-gobject2
libcairo2 libcc1-0 libcrypt-dev libcub-dev libcublas11 libcublaslt11 libcudart11.0 libcufft10 libcufftw10
libcuinj64-11.5 libcups2 libcupti-dev libcupti-doc libcupti11.5 libcurand10 libcusolver11 libcusolvermg11
libcusparse11 libdatrie1 libdconf1 libdebuginfod-common libdebuginfod1 libdeflate0 libdouble-conversion3
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libegl-dev libegl-mesa0 libegl1 libflac8 libfontconfig1
libfontenc1 libfreetype6 libgail-common libgail18 libgbm1 libgcc-11-dev libgd3 libgdk-pixbuf-2.0-0
libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgif7 libgl-dev libgl1 libgl1-amber-dri libgl1-mesa-dev
libgl1-mesa-dri libglapi-mesa libgles-dev libgles1 libgles2 libglvnd-core-dev libglvnd-dev libglvnd0 libglx-dev
libglx-mesa0 libglx0 libgomp1 libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libice6
libipt2 libisl23 libitm1 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-sphinxdoc libjs-underscore liblcms2-2
libllvm15 liblsan0 libmpc3 libnppc11 libnppial11 libnppicc11 libnppidei11 libnppif11 libnppig11 libnppim11
libnppist11 libnppisu11 libnppitc11 libnpps11 libnsl-dev libnvblas11 libnvidia-compute-495 libnvidia-compute-510
libnvidia-ml-dev libnvjpeg11 libnvrtc-builtins11.5 libnvrtc11.2 libnvtoolsext1 libnvvm4 libogg0 libopengl-dev
libopengl0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpcre2-16-0 libpixman-1-0
libpthread-stubs0-dev libpulse0 libqt5core5a libqt5dbus5 libqt5network5 libquadmath0 librsvg2-2 librsvg2-common
libsensors-config libsensors5 libsm6 libsndfile1 libsource-highlight-common libsource-highlight4v5 libstdc++-11-dev
libtbb-dev libtbb12 libtbbmalloc2 libthai-data libthai0 libthrust-dev libtiff5 libtirpc-dev libtsan0 libubsan1
libvdpau-dev libvdpau1 libvorbis0a libvorbisenc2 libwayland-client0 libwayland-cursor0 libwayland-egl1
libwayland-server0 libwebp7 libx11-dev libx11-xcb1 libxau-dev libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0 libxcb-randr0 libxcb-render-util0 libxcb-render0
libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb1-dev
libxcomposite1 libxcursor1 libxdamage1 libxdmcp-dev libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon-x11-0
libxkbcommon0 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1
libxxf86vm1 linux-libc-dev manpages-dev mesa-vdpau-drivers node-html5shiv nsight-compute nsight-compute-target
nsight-systems nsight-systems-target nvidia-cuda-dev nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-cuda-toolkit-doc
nvidia-opencl-dev nvidia-profiler nvidia-visual-profiler ocl-icd-libopencl1 ocl-icd-opencl-dev opencl-c-headers
opencl-clhpp-headers openjdk-8-jre openjdk-8-jre-headless qttranslations5-l10n rpcsvc-proto session-migration
ubuntu-mono vdpau-driver-all x11-common x11-utils x11proto-dev xorg-sgml-doctools xtrans-dev
升级了 0 个软件包,新安装了 260 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 2,037 MB/2,084 MB 的归档。
解压缩后会消耗 5,780 MB 的额外空间。
您希望继续执行吗? [Y/n] y
查看确认
安装完毕后用以下命令确认是否成功安装
nvcc -V
在WSL中我们同样用以下命令查看显卡信息文章来源:https://www.toymoban.com/news/detail-493870.html
nvidia-smi
文章来源地址https://www.toymoban.com/news/detail-493870.html
到了这里,关于Windows WSL子系统Ubuntu22.04安装Nvidia显卡驱动的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!