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一样就可以了。

GitHub 加速计划 / ws / WSL
17.08 K
797
下载
Issues found on WSL
最近提交(Master分支:19 天前 )
86fa5afa 1 个月前
e899d0b7 1 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐