官术网_书友最值得收藏!

With Linux (Ubuntu)

Linux and AI go together such as natural complements. When you talk to Google Assistant on your Android phone, talk to Cortana on your Windows device, or wonder how Watson won a round at Jeopardy on TV, it's all based on Linux.

When we talk about Linux in this chapter, we'll be talking about a particular distribution called Ubuntu, one of the most popular distributions of the Linux operating system. It's recommended that you stick with an older, more stable version of Ubuntu (Version 14.04), as although it will do wonders for your AI applications; it's certainly not as stable as your standard Windows OS. 

If you'd like to use Ubuntu on your local machine, check out Ubuntu's tutorials for installing on a Windows machine (https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows#0). If you don't have a PC or you'd like to set up a virtual instance, AWS has a great tutorial (https://aws.amazon.com/getting-started/tutorials/launch-a-virtual-machine/) to walk you through the steps:

  1. To get started with deep learning for GPUs on Ubuntu, we first have to install the GPU's driver. In this example, we're going to utilize wget and chmod to retrieve and set up read/write access: 
wget http://us.download.nvidia.com/XFree86/Linuxx86_64/367.44/NVIDIA-Linux-x86_64-367.44.run

sudo chmod +x NVIDIA-Linux-x86_64-367.35.run
./NVIDIA-Linux-x86_64-367.35.run --silent
  1. Once the installation finishes, you can check if it was intalled correctly with a simple nvidia-smi command.
  2. Next, let's install NVIDIA CUDA. CUDA is a NVIDIA package that allows us to run TensorFlow models on our GPUs: 
wget"http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb"
## Install the drivers
sudo chmod +x cuda_7.5.18_linux.run
./cuda_7.5.18_linux.run --driver --silent
./cuda_7.5.18_linux.run --toolkit --silent
./cuda_7.5.18_linux.run --samples --silent
  1. Next, let's add the library to our system path:
echo ‘export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"’ >> ~/.bashrc
  1. Lastly, we need to install a higher-level package called cuNN, which is a specific library that sits on top of CUDA and provides highly-tuned procedures for typical deep learning operations:
sudo scp cudnn-7.0-linux-x64-v4.0-prod.tgz
  1. One last step to move the files to the correct place:
tar -xzvf cudnn-7.0-linux-x64-v4.0-prod.tgz
cp cuda/lib64/* /usr/local/cuda/lib64/
cp cuda/include/cudnn.h /usr/local/cuda/include/
  1. And there you are, we're set up on Ubuntu for GPU acceleration. Our last step is to simply install the GPU-enabled version of TensorFlow with Python 3:
pip3 install tensorflow-gpu
主站蜘蛛池模板: 深水埗区| 施秉县| 福海县| 夏邑县| 乌拉特后旗| 白沙| 额济纳旗| 白水县| 兴仁县| 大余县| 罗源县| 徐水县| 磐安县| 斗六市| 沐川县| 博乐市| 北安市| 济阳县| 汾西县| 得荣县| 淅川县| 苍溪县| 化隆| 盐城市| 吉木乃县| 新乐市| 石屏县| 镇江市| 平安县| 勃利县| 汉川市| 全南县| 乌拉特中旗| 嘉鱼县| 凤翔县| 惠来县| 龙口市| 封丘县| 宣化县| 汾阳市| 济南市|