Installation and testing of pytorch and torchnet (Ubuntu16.04+cuda9.0)

My ubutu version is 16.04, cuda9.0.


1. Start the ubuntu system and a black screen appears.
1. Boot up and enter the grub screen. Select the first item "ubuntu" and press "e" to enter edit mode. Change "quite splash" to "quite splash nomodeset".
2. Press "F10" to start the system.
3. Edit "/etc/default/grub" after entering the system

    sudo gedit /etc/default/grub
找到这一行: 
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” 
修改为: 
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nomodeset”

4. Save

5. Update GRUBsudo update-grub

6. Reboot

2. Install CUDA Toolkit

1. Official download address: https://developer.nvidia.com/cuda-toolkit After adjusting nomodeset, the loss of the driver will cause Linux to freeze, then installing CUDA can solve all problems. (CUDA includes graphics card drivers by default, so there is no need to install additional graphics drivers)

    sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
    sudo apt-get update
    sudo apt-get install -y cuda

2. Install nVidia cuDNN library (cudnn-9.0-linux-x64-v7.1)

Official download address: https://developer.nvidia.com/cudnn

 
    tar -xzvf cudnn-9.0-linux-x64-v7.1.tgz
    sudo cp cuda/include/cudnn.h /usr/local/cuda/include
    sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

3. Install Anaconda for python 3.6

Anaconda official website: https://www.anaconda.com/download/

    bash ~/Downloads/Anaconda3-5.1.0-Linux-x86_64.sh
    export PATH=/home/sll2/anaconda3/bin:$PATH (note that this is written according to your own path)

Then, enter python to check your python version.

Fourth, install pytorch

According to the official website: http://pytorch.org/

conda install pytorch torchvision cuda90 -c pytorch

Verify that pytorch is installed successfully, enter: python in the terminal, enter the python environment, and continue to enter:

import torch
import torchvision

If no error is reported, the installation is successful.

5. Install torchnet Refer to https://github.com/pytorch/tnt

Note that git needs to be installed first, and if it is not installed, use the apt install git command to install it. Then execute the following two commands:

pip install git+https://github.com/pytorch/tnt.git@master
pip install --upgrade git+https://github.com/pytorch/tnt.git@master



Reference website: https://github.com/pytorch/tnt

Reference blog: https://blog.csdn.net/shiorioxy/article/details/78850199

                       https://blog.csdn.net/hjxu2016/article/details/78527019?locationNum=1&fp

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325688280&siteId=291194637