Win 10 64-bit server RTX3080Ti graphics card installation TensorFlow and Pytorch practice (2021.9.22)

1. Environment

1.1 Server + RTX3080Ti graphics card (hardware)

Inspur wave server
RTX 3080Ti graphics card

        I believe everyone knows that in addition to a powerful CPU and running memory , if a high-performance server has a high demand for graphics rendering, the server should also be equipped with a better independent graphics card, because existing computers (notebooks, laptops, etc.) desktops, servers) are increasingly unable to meet the needs of study, work and scientific research, especially for college students and graduate students majoring in artificial intelligence , computers , pattern recognition , electronic information , etc.A good graphics card can not only enhance the image display capability, but also greatly speed up the training speed of the deep learning network model to optimize the parameter adjustment

1.2 Win 10 operating system + NVIDIA graphics driver (software)

        The server has installed the Win 10 professional operating system , the running memory is about 32GB , the CPU is 16 cores and 32 threads , the graphics card device has been identified in the server, and it can be viewed in the computer right->properties->device manager.
insert image description here

Device Manager ---> Processor
Device Manager ---> Display adapters

1.3 NVIDIA graphics card driver installed (Version 471.11)

        The graphics card driver of version 471.11 is selected here (you can download it from NVIDIA’s official website or contact the service provider). After the installation is complete, right click on the desktop to enter the NVIDIA control panel, and you can view it in the system information of the control panel.The graphics card driver version corresponding to this graphics card is 471.11andThe supported CUDA version is 11.4. (You can also use Win+ Rto open the cmd window and enter nvidia-smicommands to view)
insert image description here

NVIDIA Control Panel System Information
cmd window nvidia-smi

1.4 Master Lu running points (excited)

        Just like many gamers, after installing the graphics card driver for a newly purchased graphics card, they all hope to use Master Lu to conduct a performance benchmark test and identify the authenticity of the hardware, so let me test RTX 3080Tithe power of it too!

Master Lu's comprehensive performance score
hardware parameters
Master Lu GPU Test FPS
Steam (CSGO) measured effect

2. Install CUDA and CUDNN for the graphics card (Version 11.4)

        Go to NVIDIA official website CUDA to find the CUDA version supported by the RTX 3080Ti graphics card and the CUDNN version compatible with CUDA, and finally choose CUDA 11.4 and CUDNN 11.4 . It should be noted that you can right-click and copy the link address on the download page of CUDA and CUDNN , and then use Thunder Download can effectively increase the download speed.

insert image description here

CUDA download
CUDNN download

insert image description here
        end useThunderThe downloaded CUDA 11.4 and CUDNN 11.4 installation package files are shown in the figure below.
insert image description here

2.1 Install Visual C++ support (before installing CUDA)

        The 64-bit Win10 operating system needs to download the Visual C++ support file VC_redist.x64.exe , and double-click to install it.
insert image description here
insert image description here
insert image description here

2.2 Install CUDA11.4

        Double-click cuda_11.4.0_471.11_win10.exethe installation package file to enter the NVIDIA installation program interface, choose to accept the software license agreement , and then you need to select the installation location and directly default it. In the custom installation program interface, since the graphics card driver has been installed, some components in the CUDA installation package have already been installed. It has been installed, here you can check it with the installed programs (applications and functions) in the control panel, because it has already been installed

Accept the license agreement
Choose where to install

insert image description here
insert image description here
        After CUDA is successfully installed, open Computer -> Properties -> Advanced System Settings -> Environment Variables, check whether there are two environment variables under System Variables CUDA_PATH, CUDA_PATH_V11_4the corresponding value is the default installation directory of CUDA (if not, you need to create a new one manually these two environment variables).
insert image description here
        Then WIn+ Ropen the cmd command line window, enter nvcc -Vand press Enter to view CUDA-related information ( such as version, compiler driver ) and the installation is successful.
insert image description here

2.3 Install CUDNN11.4 (copy the files under the bin, include, and lib folders to the corresponding CUDA directory)

        First unzip cudnn-11.4-windows-x64-v8.2.2.26.zipthe cudnn-11.4-windows-x64-v8.2.2.26folder, you need to copy the files in binthe folder, includethe folder and the folder libunder the folder tox64The bin folder, include folder under the CUDA installation directory and the x64 folder under the lib folder

CUDNN's bin folder
Copy to the bin folder in the CUDA installation directory
CUDNN's include folder
Copy to the include folder under the CUDA installation directory
The x64 folder under the lib folder of CUDNN
Copy to the x64 folder under the lib folder in the CUDA installation directory

3. Use Conda to install TensorFlow and Pytorch

3.1 Install Anaconda (Python)

        Go to the Anaconda official website to download the Windows system installation package, and install it directly after downloading.

Download the Anaconda installation package (Windows system)
Install Anaconda

        After the Anaconda installation is complete, you can see the Anaconda folder in the start menu, open Anaconda Promptthe command line window, in orderImprove the speed of Anaconda downloading dependent packages, and configure domestic Tsinghua source mirroring, enter the following command:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

        To understand the common commands of Anaconda, such as viewing the list of existing environments conda info --envs, creating a Python environment conda create --name env_name python=3.6, entering an environment conda activate env_name, viewing all dependent packages in the current environment pip list, and entering the Python command line python, here I created two virtual environments tensorflow_gpu and pytorch_gpu, using To configure TensorFlow and PyTorch.

conda create --name tensorflow_gpu python=3.6
conda create --name pytorch_gpu python=3.6
Anaconda Prompt command line
Enter the pytorch_gpu environment

insert image description here

3.2 Install TensorFlow (GPU version)

        In the Anaconda Prompt command line window interface, enter conda activate tensorflow_gputhe command to enter the environment, and then enter it pip install tensorflow-gpu==2.5.0to install the relevant dependency packages. The following figure shows the detailed information during the installation process. After the installation is complete, you can enter pip listto view the dependent packages installed in the tensorflow_gpu environment.

Install tensorflow-gpu 2.5.0
Successful installation

insert image description here

        After the installation is complete, after entering python in the tensorflow_gpu environment, you can enter the following code to test whether the GPU version of TensorFlowTrue is successfully installed. If it shows that it also includes information about the graphics card, the installation is successful.

import tensorflow as tf
print(tf.test.is_gpu_available())

insert image description here

3.3 Install PyTorch (GPU version)

        First go to the PyTorch official website and select the configuration as shown in the figure below. You can see that this command is automatically generated. After pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio===0.9.1 -f https://download.pytorch.org/whl/torch_stable.htmlcareful analysis, we found that we have already configured the CUDA environment. Now we should still need to install the torch dependency package, so we open https:// Download.pytorch.org/whl/torch_stable.html page, find the corresponding version of the torch dependency package file torch-1.9.0+cu111-cp36-cp36m-win_amd64.whl(corresponding to CUDA 11 version, Python 3.6 and Windows 64-bit operating system) and download it, and then enter the Scripts folder under the pytorch_gpu environment file directory , open the cmd window and enter the command pip install torch-1.9.0+cu111-cp36-cp36m-win_amd64.whlto execute the pytorch installation process, and finally it prompts that the installation is successful.

PyTorch official website custom environment to get the running command
Download the torch dependency package and install it locally

insert image description here

pip list to view the dependent packages installed in the pytorch_gpu environment

        In order to test whether the GPU version of Pytorch is successfully installed, you can enter it python, execute the following code verification, and return True to indicate that the installation is successful.

import torch
torch.cuda.is_available()
x = torch.rand(5,5)
print(x)

insert image description here

Guess you like

Origin blog.csdn.net/jing_zhong/article/details/120382867