Rtx3070 + ubuntu18.04 + cuda11.1 + cudnn8.0.4 + tensorflow 1.15.4 + pytorch1.7.0 + yolov3 environment configuration

Rtx3070 + ubuntu18.04 + cuda11.1 + cudnn8.0.4 + tensorflow 1.15.4 + pytorch1.7.0 + yolov3 environment configuration

1, VMware + Ubuntu 18.04 installation
(1) Install virtual machine
16Pro virtual machine download
16Pro version cracking key 16
ZF3R0-FHED2-M80TY-8QYGC-NPKYFYF390-0HF8P-M81RQ-2DXQE-M2UT6ZF71R-DMX85-08DQY-8YMNC-PPHV8
15pro virtual machine download
(2) Download ubuntu image source
Official website image source
Ubuntu 18.04 image source

ubuntu installation process:

  • 1. Open VMware and select Create a new virtual machine

  • 2. Select custom (Advanced) in the pop-up window

  • 3. Keep the default options, next

  • 4. Choose to install the operating system later

  • 5. Select Linux > Ubuntu 64 bit (PS: after selecting Linux, the default option is Ubuntu. If you want to install 32-bit Ubuntu, the default option is OK, but the main installation here is 64 bit, so you need to change the drop-down option to Ubuntu
    64 bit, otherwise an error will be reported later.)

  1. 6. Here is to fill in the Virtual machine name and installation path. The default is Disk C, but it's better to change the disk path with more free space. The selected path must already exist. Here I create Virtual disk manually in disk F
    Then create Ubuntu18.04.3 on the surface
    64bit this folder, and then add the path. In this way, other Virtual Machines created in the future can also be placed in the Virtual Machines management to facilitate management.
  2. 7. You haven't created a virtual disk before, so you can directly choose to create a new virtual disk.
  3. 8. Virtual disk type selection
    (1) You can select a single file only if your computer is ntfs file system instead of FAT32 format (check method is computer → right click the disk to be installed → properties)
    (2) Single file: virtual machine directory command to create a vmdk suffix file, virtual machine in a file, can effectively reduce the occupation of disk space, improve running speed, clean and good management. The disadvantage is that the file is damaged, all data are lost together, and the file is too large to transfer.
    (3) Multiple files: there may be multiple vmdk files in the virtual machine directory. The advantage is that the virtual machine has been transferred to other computers. The disadvantage is that the virtual machine is messy, which will reduce performance and occupy more hard disk space.
  4. 9. Select custom hardware
  5. 10. After the pop-up window, select a new CD / DVD (SATA) - > use ISO image file > > Browse: select the path where the downloaded Ubuntu image is located > > close the window after setting it > > return to the previous interface and click Finish to complete the process of creating the virtual machine.
  6. 11. Start the virtual machine, start installing ubuntu, select the system language to be installed, and then click Install ubuntu (if simplified Chinese is selected, click Install Ubuntu)
  7. 12. Select erase disk and install Ubuntu.
  8. 13. After the installation, it needs to restart. After the restart, check whether the network is normal.

2, Install NVIDIA graphics driver

1. Disable nouveau

sudo gedit /etc/modprobe.d/blacklist.conf

Add the following two sentences:

blacklist nouveau
options nouveau modest=0

2. After saving, execute:

sudo updata-initramfs -u
sudo reboot

3. After restart, Ctrl+Alt+F1 switch to tty interface and turn off lightdm (if not, don't worry)

sudo service lightdm stop

4. Then update the apt source and the NVIDIA driver version recommended by the system

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
ubuntu-drivers devices

5. Install NVIDIA driver according to the recommended driver version

sudo apt-get install nvidia-driver-460

6. If the download speed is extremely slow, you can add a source

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup
sudo gedit /etc/apt/sources.list

7. Add source, save

# Alibaba cloud source
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
##Beta source
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# Source code
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
##Beta source
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse


# Source of Tsinghua University
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
##Beta source
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# Source code
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
##Beta source
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

8. Add complete, update

sudo apt-get update
sudo apt-get upgrade

3, Installation of cuda, cudnn, anaconda, python, TensorFlow

  • cuda installation
    (1) Download cuda cuda_11.1 download address
    (2) Find the downloaded cuda package and install it

    bash sudo sh cuda_11.1.0_455.23.05_linux.run
    There will be a bunch of blabla options (check and install as shown in the figure)

    (3) Configure environment variables

sudo gedit ~/.bashrc

#Add at the end of the file
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda

#Finished saving
sudo source ~/.bashrc

#Check version

  • cudnn installation
    Unzip, copy and paste
 tar -xzvf cudnn-11.1-linux-x64-v8.0.4.30.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

View the current cudnn version

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
  • Finally confirm whether it is installed
nvcc -V
nvidia-smi
  • pytorch installation
 pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Test whether the installation is successful

python3
  • Installation of TensorFlow
#install
pip install --upgrade setuptools  #Update pip first, otherwise the later installation may report an error
pip install -i https://Pypi. Tuna. Tsinghua. Edu. CN / simple tensorflow GPU = = 1.15.4 GPU version
#test
import tensorflow as tf
a = tf.test.is_built_with_cuda()   #Determine whether CUDA is available
b = tf.test.is_gpu_available(cuda_only=False,min_cuda_compute_capability=None)     #Determine whether GPU is available
print(a)
print(b)

Installation reference:
https://blog.csdn.net/qq_39557270/article/details/102926282
https://blog.csdn.net/weixin_47658790/article/details/115419933
https://blog.csdn.net/betterman2017/article/details/111561364
https://blog.csdn.net/IAMoldpan/article/details/114500720

Tags: Linux Deep Learning TensorFlow

Posted by crackerjax on Wed, 19 May 2021 04:45:48 +0930