bachlog / wsl-pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wsl-pytorch

Set-up PyTorch dev. env. for WSL Ubuntu on Windows 11, with Nvidia 1070Ti gpu.

Step 1. Install WSL2 Ubuntu on Windows

Step 2. Install CUDA Toolkit on WSL2 Ubuntu

Step 2b. Install cudnn on WSL2 Ubuntu

  • Install cudnn:
    export last_public_key=3bf863cc # SEE NOTE BELOW
    sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/${last_public_key}.pub
    sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
    sudo apt-get update
    sudo apt-get install libcudnn8
    sudo apt-get install libcudnn8-dev
    
  • Ref libcudnn8.

Step 3. Install python env and PyTorch

  • Example: install miniconda wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash Miniconda3-latest-Linux-x86_64.sh
  • Create a minimal working env: conda create -n py39 python=3.9
  • Ref: pytorch i73487
  • Instructions:
    pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html
    
    Check it as follows:
    Python 3.9.17 (main, Jul  5 2023, 20:41:20)
    [GCC 11.2.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> torch.__version__
    '1.11.0+cu115'
    >>> torch.cuda.is_available()
    True
    >>> torch.tensor(1).cuda()
    tensor(1, device='cuda:0')
    

About