Giter Club home page Giter Club logo

ubuntu-20.04-cuda-cudnn-pytorch's Introduction

Ubuntu-20.04-CUDA-cuDNN-PyTorch

中文版本(https://traveling-process-89d.notion.site/Ubuntu-20-04-DeepLearning-655e63dc86aa4edea87600decccb3237)

Results

Name Version
Ubuntu 20.04
GPU GTX 1080Ti
NVIDIA Driver 515.65.01
CUDA 10.1
cuDNN
PyTorch 1.4

Structure

  • Bottom Layer:
    CUDA, cuDNN (cuDNN should be selected according to the CUDA version).
  • Virtual Environments:
    Established by Anaconda, the environment can be set according to the needs, such as the Python version, PyTorch version, but also should be selected according to the CUDA version.

Outline

  1. NVIDIA Driver installation
  2. CUDA installation
  3. cuDNN installatioin
  4. Anaconda3 installatioin
  5. PyTorch installation

Instruction

1. NVIDIA Driver installation

Open Software & Updates Application
Software & Updates app

Select the Additional Drivers field, and then select the version you want (except -server). After selecting, press Apply Changes, and the new Driver will be installed.
NVIDIA Driver Select

After installation, you will be asked to restart, open terminal and type in

sudo reboot

After restarting, open the terminal and enter the following commands to check if the Driver Version is correct. The CUDA version in the upper right corner can be ignored because we haven't installed it yet.

nvidia-smi

nvidia-smi

2. CUDA installation

(https://mikethreeacer.medium.com/ubuntu-18-04-安裝-cuda-cudnn-anaconda-pytorch-1f170b3326a4#1b0a)
You can follow the above URL "2. Install CUDA 11.2.2" section to install.

3. cuDNN installatioin

(https://mikethreeacer.medium.com/ubuntu-18-04-安裝-cuda-cudnn-anaconda-pytorch-1f170b3326a4#1b0a)
You can follow the above URL "2. Install cuDNN" section to install.

4. Anaconda3 installation

(https://www.anaconda.com/products/distribution)
First go to Anaconda's official website to select the Linux version to download the installation file. After downloading, you will get a .sh file.
.sh file

Open the terminal and type in

sudo bash {version_name}.sh
#e.g. sudo bash Anaconda3–2022.05-Linux-x86_64.sh

Press enter and yes all the way to complete the installation.

5. PyTorch installation

(https://pytorch.org/get-started/previous-versions/)
The PyTorch version cannot be too new, click "install previous versions of PyTorch".
PyTorch install link

Corresponding to the CUDA 10.1 version, this time I chose to install v1.4.0. You can copy the instructions under CUDA 10.1 first, we will use it later.

conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch

pytorch install code

PyTorch 1.4 version requires that the python version should not be too new. If it is too new, an error will occur and PyTorch cannot be installed as shown below.
Error Message

Create a new environment with conda on the terminal, set the python version to 3.7, and "test" can be changed to any word.
Then enter "y" to start the installation.

conda create -n {environment_name} python=3.7
#e.g. conda create -n test python=3.7

create emviroment

After the environment is set up, you will be instructed to enter the activate command to start the environment.

conda activate {environment_name}
#e.g conda activate test

activate environment

After entering the environment name, the current environment name will be displayed at the front.
You can enter the command to check the currently installed CUDA version (V10.1).

nvcc -V

cuda version

Paste the previous instructions for copying and installing PyTorch, enter "y" to start the installation.

conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch

pytorch install
pytorch install

Installation complete screen.
pytorch install complete

Type in "python" to enter the python compilation environment, and enter the following commands in sequence.

python
improt torch
torch.cuda.is_available()

If it's True, the installation is successful.
pytorch install success

Press ctrl+D or exit() to exit python.
Then enter "conda deactivate" to exit the virtual environment.

exit()
conda deactivate

deactivate

ubuntu-20.04-cuda-cudnn-pytorch's People

Contributors

nick8592 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.