GCP-Tensorflow- Install Tensorflow-GPU with CUDA 8.0 and cuDNN 6


Hello everyone.. (This is the entire process. I will edit this post with images and format it properly later.)

Today I'm gonna show you how to setup a Google Cloud Platform (GCP) GPU instance and install Tensorflow-GPU with CUDA 8.0 and CuDNN 6.
(I'm not showing you how to register for GCP and get a Quota increase for having a GPU in a zone .. If you want me to show how that is done, comment below.)

Let's begin...

1)  Open cloud.google.com and login to get to your console.

2) Navigate to Compute Engine -> VM Instances which appears by clicking on the Hamburger icon ( three  horizontal bars )

3) Click Create

4) Choose all your requirements. I need 4 vCPUs and 15GB memory and a K80 GPU with 50GB storage having Ubuntu 16.04 Image. I will allow traffic from both HTTP and HTTPS. Observe carefully what I'm doing..

6) The instance is being created. Meanwhile let's get links to download CUDA 8.0 and CuDNN 6.
You need to have an account at NVIDIA's develepor portal to get CuDNN. So be ready to register for that (It's very simple actually)

7) I'm getting a direct link for CUDA 8.0 but I will show you how to navigate to older releases of CUDA (since at the point of creating this video, it is CUDA 9.1). If instance is created, click SSH to access your newly created instance (Pop-ups should be allowed)

8) Install python dev and pip by " sudo apt-get install python-dev python-pip " without quotes.

9) We are running on Ubuntu 16.04. Please select runfile instead of deb file. Right-click on download icon and click Copy link address. In the SSH window use ' wget ' to download the file.

" wget <Ctrl+v> " without quotes and then hit enter. Do the same with the second file.

10) We need to blacklist the ' nouveau driver '  in Ubuntu to have a successful installation. Issue the command " sudo nano /etc/modprobe.d/blacklist.conf " without quotes. Enter the following lines

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

Save and exit. As Im using nano, I can exit by pressing Ctrl+x and then pressing y for yes and then hitting Enter again for saving with same name.

11) Next disable nouveau kernel driver by issuing

" echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf "

Then rebuild the kernel by issuing

" sudo update-initramfs -u "

12) Reboot the system by " sudo reboot ". You will lose SSH connection as sytem is physically being restarted. Wait a min and click SSH again. In the meanwhile we will get link for downloading CuDNN 6. Follow me.

13) To Download cuDNN 6, google it, visit the webpage and click Download. If you aren't signed in, it will ask you to login. After that, Agree to the terms and choose "Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0"and then "cuDNN v6.0 Library for Linux".
As the download begins, pause it and right click on it to Copy Link Address. Again use " wget <Ctrl+v> " to download it. Rename it for making it a tar file.

14) Install nvidia-384 by  " sudo apt-get install nvidia-384 "

15) Lets install CUDA first. Give both the files executable permissions by                             " sudo chmod a+x cuda* ". Now run the first file by " sudo ./cuda_8.0.61_<tab> " tab key is for autocomplete. press q to go to installation. samples are just for testing. Run the second file too..

16)  Extract the previous tar file by " tar -xzvf <filename> "
" sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include "
" sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64/ "
" sudo chmod a+r /usr/local/cuda-8.0/lib64/libcudnn* "

17) Add these locations to environment variables by " sudo nano ~/.bashrc " and inserting these lines
 export PATH=/usr/local/cuda-8.0/bin/:$PATH
 export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/:$LD_LIBRARY_PATH
Save and exit and give the command " source ~/.bashrc "

18) Reboot again. " sudo reboot "
By this we have completed the setup for Nvidia. Lets get our python modules. Lets SSH again

19) Python modules installation
first lets upgrade pip by " sudo -H pip install --upgrade pip "

" sudo -H pip install numpy scipy matplotlib scikit-learn scikit-image pillow h5py tensorflow-gpu keras jupyter nbconvert hyperas "

20) That's it

We have successfully completed the installation. Be sure to Like, Share and Subscribe.

Thanks for watching
    

Comments

  1. I'm making a video. Will upload it within 2 days and update the post

    ReplyDelete
  2. Heya i am for the first time here. I found this board and I find It truly helpful & it helped me out a lot. I hope to provide one thing back and help others such as you helped me.

    ReplyDelete
  3. I have been exploring for a bit for any high quality articles or blog posts on this kind of space . Exploring in Yahoo I eventually stumbled upon this web site. Reading this info So i am happy to express that I have a very just right uncanny feeling I came upon just what I needed. I such a lot certainly will make certain to do not overlook this web site and provides it a look on a relentless basis.

    ReplyDelete
  4. Its such as you learn my mind! You appear to understand so much approximately this, like you wrote the e book in it or something. I believe that you simply can do with some percent to drive the message home a little bit, but other than that, that is excellent blog. An excellent read. I will certainly be back.

    ReplyDelete

Post a Comment

Popular posts from this blog

Auto Shutdown

MinGW Installation