- Python Deep Learning Cookbook
- Indra den Bakker
- 308字
- 2021-07-02 15:43:10
How to do it...
- We start by downloading NVIDIA with the following command in the terminal (adjust the download link accordingly if needed; make sure you use CUDA 8 and not CUDA 9 for now):
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
- Next, we unpack the file and update all all packages in the package lists. Afterwards, we remove the downloaded file:
sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
sudo apt-get update
rm cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
- Now, we're ready to install CUDA with the following command:
sudo apt-get install cuda-8-0
- Next, we need to set the environment variables and add them to the shell script .bashrc:
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
echo 'export PATH=$PATH:$CUDA_HOME/bin' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' >> ~/.bashrc
- Make sure to reload the shell script afterwards with the following command:
source ~/.bashrc
- You can check whether the CUDA 8.0 driver and toolkit are correctly installed using the following commands in your terminal:
nvcc --version
nvidia-smi
The output of the last command should look something like this:

Figure 1.2: Example output of nvidia-smi showing the connected GPU
- Here, we can see that an NVIDIA P100 GPU with 16 GB of memory is correctly connected and ready to use.
- We are now ready to install cuDNN. Make sure the NVIDIA cuDNN file is available on the machine, for example, by copying from your local machine to the server if needed. For Google cloud compute engine (make sure you've set up gcloud and the project and zone are set up correctly), you can use the following command (replace local-directory and instance-name with your own settings):
gcloud compute scp local-directory/cudnn-8.0-linux-x64-v6.0.tgz instance-name
- First we unpack the file before copying to the right directory as root:
cd
tar xzvf cudnn-8.0-linux-x64-v6.0.tgz
sudo cp cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
- To clean up our space, we can remove the files we've used for installation, as follows:
rm -rf ~/cuda
rm cudnn-8.0-linux-x64-v5.1.tgz
推薦閱讀
- iOS面試一戰到底
- Designing Machine Learning Systems with Python
- PWA入門與實踐
- TensorFlow Lite移動端深度學習
- 自己動手實現Lua:虛擬機、編譯器和標準庫
- Visual C++數字圖像模式識別技術詳解
- C/C++算法從菜鳥到達人
- Python語言程序設計
- C程序設計案例教程
- Frank Kane's Taming Big Data with Apache Spark and Python
- Mastering Python Design Patterns
- 快速入門與進階:Creo 4·0全實例精講
- Node學習指南(第2版)
- Python程序設計開發寶典
- 深入實踐DDD:以DSL驅動復雜軟件開發