美文网首页
wsl2 配置 多环境的深度学习 GPU 环境

wsl2 配置 多环境的深度学习 GPU 环境

作者: 水之心 | 来源:发表于2021-04-26 18:15 被阅读0次

    首先,参考:在 WSL 2 中启用 NVIDIA CUDA - Win32 apps | Microsoft Docs 配置一些基础设置。接着进入 wsl 环境进行配置(参考 CUDA 工具包 11.1 下载 | NVIDIA Developer):

    $ wsl
    $ sudo apt-get update
    $ 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/11.1.0/local_installers/cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb
    $ sudo dpkg -i cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb
    $ sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-1-local/7fa2af80.pub
    $ sudo apt-get update
    $ sudo apt-get -y install cuda
    

    在安装过程中如果报错“404 Not Found [IP: 180.101.196.129 443]”,可以先尝试离线安装:

    $ wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
    $ sudo sh cuda_11.1.0_455.23.05_linux.run
    

    【可选】wsl2 安装 GUI 参考:Install GUI Desktop in WSL2 Ubuntu 20.04 LTS in Windows 10 | by Harshit Yadav | Medium & The complete WSL2 + GUI setup. | Medium

    安装 Anaconda3

    下载 Anaconda | Individual Edition,接着安装:

    $ sh Anaconda-...
    

    配置多环境深度学习环境

    1. 安装 MXNet:
    $ conda create -n mxnet python=3.9
    $ conda install jupyter notebook
    $ conda install cudnn=8 -c conda-forge
    $ pip install mxnet-cu110
    $ conda install ipykernel
    $ python -m ipykernel install --name mxnet --user
    $ pip install autopep8
    
    1. 安装 TensorFlow:
    $ conda create -n tensorflow python=3.9
    $ conda install jupyter notebook
    $ conda install cudnn=8 -c conda-forge
    $ pip install tensorflow
    $ conda install ipykernel
    $ python -m ipykernel install --name tensorflow --user
    $ pip install autopep8
    
    1. 安装 PyTorch:
    $ conda create -n torch python=3.9
    $ conda install jupyter notebook
    $ conda install pytorch torchvision torchaudio cudatoolkit=11 -c pytorch -c conda-forge
    $ conda install ipykernel
    $ python -m ipykernel install --name torch --user
    $ pip install autopep8
    

    相关文章

      网友评论

          本文标题:wsl2 配置 多环境的深度学习 GPU 环境

          本文链接:https://www.haomeiwen.com/subject/hiisrltx.html