Tensorflow is one of the leading open source software that is used by Google to help Artificial Intelligence community and understand the models in an assortment of programming dialect. This machine learning platform is quite basic for developers, students and researchers for learning deep applications like neural networks. It comprises of both GPU and CPU version in which CPU version is actually useful, but if you are looking for deep learning, then GPU is the right choice.
When using Tensorflow’s GPU version, you need GPU of NVIDIA GPU along with computing capability of more than 3.0. Technically, you can install tensorflow GPU version in a virtual machine, but if you are willing to access the full power of your GPU through a virtual machine, then it would not be a piece of cake.
So, it’s better for you to install it on the Ubuntu. Tensorflow 1.8 with cuDNN 7.1.4 and CUDA 9.2 performs up to 37% quicker than Tensorflow’s earlier versions. In this guide, we will go step by step about how to Install Tensorflow-GPU 1.8 for Python 2.7 and Python 3.5 on Ubuntu 16.04.
So, are you ready? Let’s dive in…
Before we start the tutorial, it is important to know about the requirements,
1. NVIDIA drivers and library (version 390 recommended)
2. A CUDA enabled NVIDIA Graphic card along with computing capability of either 3.0 or higher than that. To check your card’s compatibility, visit https://developer.nvidia.com/cuda-gpus.
3. The runtime library and development library of the cuDNN (v7.0.5 For CUDA 9.0 recommended.
4. Both Python 2.7 and 3.5 that are available with Ubuntu 16.4 (it is recommended to upgrade their minor versions 3.5 x and 2.7.x) along with corresponding python development libraries.
5. Both 3.5 and 2.7 versions of pip package manager helps you to install required packages.
You can install TensorFlow in many ways and each method has a different development and uses case. Here are the three ways explored.
Native Pip-: In this technique, you introduce TensorFlow on your system all inclusive. This is prescribed for individuals who need to make TensorFlow accessible to everybody on a multi-user system. This technique for installation does not seclude TensorFlow of every a contained domain and may meddle with other Python installations or libraries.
Virtualenv and Python-In this methodology, TensorFlow is installed and all packages use TensorFlow out of a Python virtual condition. This detaches your TensorFlow environment from other Python programs on a similar machine.
Docker- This container runtime environment isolates its content from pre-existing packages of your system. In this process, you use the Docker container that carries TensorFlow and its dependencies. This strategy is perfect for consolidating TensorFlow into a bigger application architecture as of now using Docker. Nonetheless, the extent of the Docker image will be very vast.
In this tutorial, you can install TensorFlow in Virtualenv and Python. This strategy isolates the installation of TensorFlow out of a Python virtual condition with virtualenv. Moreover, it segregates the TensorFlow installation and gets things up and running rapidly. When you finish the installation, you’ll approve your installation by running a short TensorFlow program and afterward utilize TensorFlow to perform picture acknowledgment.
Choose package manager that can access the repositories of NVIDIA and CUDA.
1. Type Software and Updates in your dash search.
2. Open “ Software and Updates” and then click on the tab called: Ubuntu software.
3. Ensure to select (universe, main, multiverse and restricted.
Make sure to add NVIDIA CUDA repository to adept package manager sources.
After executing step 2, it’s time to upgrade the minor versions of your python
Now install the required packages initially from the apt package manager.
Later, Upgrade the pip package chief to the new and most recent rendition.
After completing all the 4 steps above, now it’s time to download the required cuDNN Packages. For that, follow the points below:
1. Go to the official page of cuDNN official site-
2. Complete account registration and login.
3. Agree to terms and license agreement of the cuDNN Software license.
4. Now check the releases of Archived cuDNN
5. Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0 from the subsection:
Always remember that you need a version (18.104.22.168-1+cuda 9.0) because it is the most compatible one with Tensorflow- GPU right now!
Step 6: Now, it’s time to install the cuDNN Packages. Open the terminal in the downloaded packages folder and follow the command below:
Step 7: Now set up the right environment variables to let TensorFlow and Pip understand the location of cuda paths.
Step 8: Now you need Python packages for both the operations of Tensorflow as well as result visualization.
The seaborn and matplotlib packages: for data visualization of training results as well as errors.
The numpy package: As tentors are fed numpy arrays, they are analyzed to numpy arrays after carried out in a tensorflow session.
Just like in step 7, it issues the same commands below:
Step 9: Just like in step 7, now install tensorflow-GPU in the similar terminal, issuing the below commands:
Step 10: Make sure that Tensorflow-GPU is properly installed.
Undoubtedly,Tensorflow is one of the power packed set of tools in the machine learning development box. But if it is with GPU enabled tensorflow, it will become even more impactful. As it cuts the training time and offers the capability of semi-industrial computation levels on a laptop with minimum requirements. However, the speed of the running time of Tensorflow-GPU also depends on your internet speed. So make sure you got a high-speed internet.