페이지

2022년 5월 23일 월요일

1.6.2 CUDA Installation

 Most of the current deep learning frameworks are based on NVIDIA's GPU graphics card for accelerated calculations, so you need to install the GPU acceleration library CUDA provided by NVIDIA. Before installing CUDA, make suer your computer has an NVIDIA graphics device that supports the CUDA program. If you computer does not have an NVIDIA grahics card-for example, some computer graphics card manufactures are AMD or Intel - the CUDA program won't work, and you can skip this step and directly install the TensorFlow CPU version.

The installation of CUDA is divided into three steps: CUDA software installation, cuDNN deep neural network acceleration library installation, and environment variable configuration. The installation process is a bit tedious. We will go through them step by step using the Windows 10 system as an example.

CUDA Sotfware Installation Open the official downloading website of the CUDA program: https://developer.nvidia.com/duca-10.0-download-archive. Here we use CUDA 10.0 version: select thw Windows platform, x86_64 architecture, 10 system, and exe (local) installation package and then select "Download" to download the CUDA installation software. After the download is cimplete, open the software. As shown in Figure 1-25, select the "Custom" option and click the "NEXT" button to enter the installation program selection list as shown in Figure 1-26. Here you can select the components that need to be installed and unselect those that do not need to be installed. Under the "CUDA" category, unselect the "Visual Studio Integration" item. Under the "Driver components" category compare the version number of "Current Version" is greater than "New Version," you need to uncheck the "Display Driver." If "Current Version is less than or equal to "New Version," leave "Display Driver." If Current Version" is less than or equal to "New Version," leave "Display Driver" checked, as shown in Figure 1-27. After the setup is complete, you can click "NEXT" and follow the instructions to install.

After the installation is complete, let's test whether the CUDA software is successfully installed. Open the "cmd" terminal and enter "nvcc-V" to print th ecurrent CUDA version information, as shown in Figure 1-28. If the command is not recongnized, the installation has filed. We can find the "nvcc.exe" program from the CUDA installation path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\V10.0\bin", as shown in Figure 1-29.

cuDNN Neural Network Acceleration Library Installation. CUDA is not a special GPU acceleration library for neural networks; it is designed for a variety of applications that require paralled computing. If you want to accelerate for neural network applications, you need to install an additional cuDNN library. It should be noted that the cuDNN library is not an executable program. You only need to download and decompress the cuDNN file and configure the Path environment variable.

Open the website https://developer.nvidia.com/cudnn and select "Download cuDNN." Due to NVIDIA regulations, users need to log in or create a new user to continue downloading. After logging in, enter the cuDNN download interface and check "I Agree To the Terms of the cuDNN Software License Agreement," and the cuDNN version download option will pop up, Select the cuDNN version that matches CUDA 10.0, and click the "cuDNN Library for Windows 10" link to download the cuDNN file, as shown in Figure 1-30. It should be noted that cuDNN itself has a version number, and it also needs to match the CUDA version number.

After downloading the cuDNN file, unzip it and rename the folder "cuda" to "cudnn765". Then copy the "cudnn765" folder to the CUDA installation path "C\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0". A dialog box that requires adminstrator rights mayu pop up here. Select continue to paste.

Environment Variable Configuration. We have completed the installation of cuDNN, but in order for the system to be aware of the location of the cuDNN file, we need to configure the Path environment variable as follows. Open the file brower, right-click "My Computer," select "Properties," select "Advanced system settings," and select "Environment Variables," as shown in  Figure 1-32. Select the "Path" environment variable in the "System variables" column and select "Edit," as shown in Figure 1-33. Select "New," enter the cuDNN installation path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\cudnn756\bin", and use the "Move up" button to move this item to the top.

After the CUDA installation is complete, the environment variables should include "C:\Program File\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin," "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp", and "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\cudnn756\bin". The preceding path may differ slightly according to the actual path, as shown in Figure 1-34. After confirmation, click "OK" to close all dialog boxes.


댓글 없음: