Restricted Boltzmann Machines (RBMs) Simply Explained
November 9, 2020
A review on Deep learning based recommendation systems
November 24, 2020
Show all

Four steps to setup Pytorch for my laptop GPU NVIDIA GTX 960m (Asus VivoBook n552vw) in Ubuntu 16.4

In this post, I’m gonna describe the steps I used to make Pytorch use GPU on my laptop (It takes me about half a day to find the steps).

Generally, you should check compatibility of several things:

  • Pytorch Version
  • Nvidia Driver
  • Cuda Version

First Step: Check compatibilities

Check Cuda and Nvidia GPU drivers compatibility at:

https://docs.nvidia.com/deploy/cuda-compatibility/index.html

Here is the important table:

CUDA ToolkitLinux x86_64 Driver Version
CUDA 11.1 (11.1.0)>= 450.80.02
CUDA 11.0 (11.0.3)>= 450.36.06
CUDA 10.2 (10.2.89)>= 440.33
CUDA 10.1 (10.1.105)>= 418.39
CUDA 10.0 (10.0.130)>= 410.48
CUDA 9.2 (9.2.88)>= 396.26
CUDA 9.1 (9.1.85)>= 390.46
CUDA 9.0 (9.0.76)>= 384.81
CUDA 8.0 (8.0.61 GA2)>= 375.26
CUDA 8.0 (8.0.44)>= 367.48
CUDA 7.5 (7.5.16)>= 352.31
CUDA 7.0 (7.0.28)>= 346.46
CUDA Toolkit and Compatible Driver Versions

Check Pytorch compatibility at:

https://pytorch.org/get-started/previous-versions/

Based on my system configuration I decide to install the following versions:

Cuda: 10.1

GPU Driver: 418.56

Pytorch: 1.6.0 / Torchvision: 0.7.0

Second Step: Install GPU Driver

Install appropriate version of your GPU using one of the following options:

  1. Go to Software & Update -> Additional Drivers -> Using Nvidia binary driver – version X.X.
  2. Or if you can’t see the first option run the following command: sudo apt install nvidia-418
  3. Or alternatively you can download drivers from the Official Nvidia website.
  4. reboot your system
  5. Now run the command nvidia-smi. It must show something like the following:

Third Step: Install Cuda Toolkit

Download and install the proper Cuda Tool kit version from https://developer.nvidia.com/cuda-toolkit-archive and then reboot. Specifically I download Cuda 10.1 toolkit from https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal

and install the .run file by:

sudo sh cuda_10.1.105_418.39_linux.run

Final Step: Install Pytorch

Install the appropriate Pytorch version from:

https://pytorch.org/get-started/previous-versions/

I have installed using the following command:

pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

Enjoy GPU Power!

Amir Masoud Sefidian
Amir Masoud Sefidian
Data Scientist, Researcher, Software Developer

Leave a Reply

Your email address will not be published. Required fields are marked *