如何在WSL2安装CUDA
WSL
Issues found on WSL
项目地址:https://gitcode.com/gh_mirrors/ws/WSL

·
Windows 11 和 Windows 10 版本 21H2 支持在 Windows Subsystem for Linux (WSL) 实例中运行使用英伟达™ CUDA 进行 GPU 硬件加速的现有 ML 工具、库和流行框架。这包括 PyTorch 和 TensorFlow,以及原生 Linux 环境中可用的所有 Docker 和英伟达容器工具包支持。
方法
在WIndows下安装驱动:
https://www.nvidia.com/Download/index.aspx
可以通过nvidia-smi确认安装
更新 wsl
wsl.exe --shutdown
wsl.exe --update
在wsl中安装cuda toolkit
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.5.0/local_installers/cuda-repo-wsl-ubuntu-12-5-local_12.5.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-12-5-local_12.5.0-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-5
参考
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local
通过nvcc -V
确认安装
安装Pytorch或者faiss之类的工具就和Linux一样就可以了。




Issues found on WSL
最近提交(Master分支:5 个月前 )
8c61f09e
* Add super user detection; a powershell approach is used
* use the 'id' command
* avoid stderr warning & wsl alias 17 天前
ae780d11
17 天前
更多推荐
所有评论(0)