How to use GPU of MX150 with Tensorflow 1.8 CUDA 9.2 (Introduction)
Reading Time: 4 minutes
Receiving my new laptop T580, I observed in the specifications that there is a NVIDIA graphic card MX150 with 384 CUDA cores.
New challenge will be to use these CUDA cores for the acceleration of the calculation for the Deep Neural network. In this context, I use Python 3 and the high level neural network Keras with Tensorflow as backend
By executing an apt-cache search cuda, I observed that the Lubuntu 18.04 LTS repository has the version 9.1 of CUDA based on the driver 396. However, based on the test realized by Aryal Bibek (see the URL: http://www.python36.com/benchmark-tensorflow-on-cifar10/). This article concludes that the support of CUDA 9.2 on Tensorflow 1.8.0 considerably increases the speed of training: This combination performs up to 37% faster when compared to earlier versions of Tensorflow. Even when compared to the previous versions of CUDA 9 Toolkit with 7.0.5 cuDNN, the latest CUDA 9.2 is around 7-12% faster.
So, I gathered my courage and decided to compile from the sources to benefit from the version 9.2 of CUDA which is the most performing, I will use the combination of :
- CUDA 9.2 :
- Definition: CUDA is a parallel computing platform and application programming interface (API) model created by Nvidia. It allows software developers and software engineers to use a CUDA-enabled graphics processing unit (GPU) for general purpose processing – an approach termed GPGPU (General-Purpose computing on Graphics Processing Units). The CUDA platform is a software layer that gives direct access to the GPU’s virtual instruction set and parallel computational elements, for the execution of compute kernels.
- Requirements: The following packages of Ubuntu freeglut3 et freeglut3-dev will be mandatory for the good working of CUDA 9.2. This library is a free-software/open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT was originally written by Mark Kilgard to support the sample programs in the second edition OpenGL ‘RedBook’. Since then, GLUT has been used in a wide variety of practical applications because it is simple, widely available and highly portable.
- Url: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1710&target_type=runfilelocal
- CUDNN 7.1.4:
- Definition : The NVIDIA CUDA Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. cuDNN provides highly tuned implementations for standard routines such as foorward and backward convolution, pooling, normalization, and activation layers. cuDNN is part of the NVIDIA Deep Learning SDK.
- Requirements: You need to register as developer on the web site and agree on the terms and conditions of the CUDNN
- Url: https://developer.nvidia.com/rdp/cudnn-download#a-collapse714-92
- Attention Point: select the version CUDNN compatible with the CUDA 9.2.
- NCCL:
- Definition: The NVIDIA Collective Communications Library (NCCL) implements multi-GPU and multi-node collective communication primitives that are performance optimized for NVIDIA GPUs. NCCL provides routines such as all-gather, all-reduce, broadcast, reduce, reduce-scatter, that are optimized to achieve high bandwidth over PCIe and NVLink high-speed interconnect.
- Requirements: The access to this library needs to have a login/password or your gmail account because this is on the developer site.
- URL: https://developer.nvidia.com/nccl/nccl-download
- Attention Point: This is not really required seeing that I have one card, but it seems that Tensorflow needs this library to compile the source code.
- CUPTI:
- Definition: (CUPTI) is the The CUDA Profiling Tools Interface. It enables the creation of profiling and tracing tools that target CUDA applications. CUPTI provides four APIs: the Activity API, the Callback API, the Event API, and the Metric API. Using these APIs, you can develop profiling tools that give insight into the CPU and GPU behavior of CUDA applications. CUPTI is delivered as a dynamic library on all platforms supported by CUDA.
- Requirements: N/A
- Url: N/A
- TensorFlow 1.8:
- Definition: TensorFlow is an open-source software library for dataflow programming across a range of tasks. It is a symbolic math library, and is also used for machine learning applications such as neural networksTensorFlow is Google Brain’s second-generation system. Version 1.0.0 was released on February 11, 2017. While the reference implementation runs on single devices, TensorFlow can run on multiple CPUs and GPUs (with optional CUDA and SYCL extensions for general-purpose computing on graphics processing units). In our case, this is CUDA seeing that I have a NVIDIA graphical card.
- Requirements: Tensorflow 1.8 using GPU NVIDIA is not available in the python libraries. So I will recompile it using CUDA 9.2 – CUDNN – CUPTI
- Url: https://github.com/tensorflow/tensorflow.git
- Attention points: Be patient, the recompilation of this library will take around 2 hours
The Final objective is the execution of a python program which creates a deep neural network by using the power of the 384 GPU cores. To achieve this, we will structure our approach into three main steps:
- Phase 1: Installation of the NVIDIA driver compatible with the Cuda 9.2
- Phase 2: Installation of CUDA 9.2, CUDNN, NCCL and CUPTI. This phase will also validate the installation with the execution of the samplings available in the CUDA packages which graphically proves the good working of the installation.
- Phase 3: Compilation and Installation of TensorFlow 1.8 which will use the CUDA 9.2 to use the power of the GPU cores of the graphical card.
- Phase 4: Installation of an IDE (we take visual code as example) and integration python 3 – Pip 3 and the code for the Deep Neural Network (DNN) and the execution of the code showing the use of the CUDA cores.
Conclusion:
This article is the starting point of the initiative: “How to use the CUDA core of my graphical card to calculate a deep neural network.”
Let’s start now with the Phase 1!
Feel free to give comments or ask questions and I will try to answer you.
If you find this post valuable, Rate it ! This helps me to improve it. For comments, you need to register with your LinkedIn account.
References:
When I write an article, I always give the references I used because I believe in intellectual property and I know how many times you need to write a valuable article:
- Tensorflow definition :https://en.wikipedia.org/wiki/TensorFlow
- CUDA definition : https://en.wikipedia.org/wiki/CUDA
- CUPTI definition: https://docs.nvidia.com/cuda/cupti/r_main.html#r_main
- Freeglut: http://freeglut.sourceforge.net/
Wow, this paragraph is pleasant, my sister is analyzing
these things, therefore I am going to let know her.
Its like you read my mind! You appear to know so much about this,
like you wrote the book in it or something. I think
that you can do with some pics to drive the message home a bit, but instead of that, this is excellent blog.
A fantastic read. I’ll definitely be back.
Thank you, I’ve recently been searching for info approximately this subject for a
long time and yours is the greatest I have found
out till now. But, what in regards to the conclusion? Are you certain about the supply?
Just desire to say your article is as amazing. The clearness in your post is just excellent and i can assume you’re an expert on this subject.
Well with your permission let me to grab your feed to keep up
to date with forthcoming post. Thanks a million and please carry on the
rewarding work.
Hi, everything is going sound here and ofcourse every
one is sharing information, that’s really fine, keep up writing.
Its like you read my thoughts! You appear to understand so
much approximately this, such as you wrote the book in it or something.
I feel that you just could do with some p.c. to pressure the message house a bit,
but instead of that, this is excellent blog.
A fantastic read. I will definitely be back.
You really make it seem really easy with your presentation but I to find this topic to be really one thing which I feel
I’d never understand. It sort of feels too complicated and very huge for
me. I’m taking a look ahead for your subsequent submit, I’ll try to get the
cling of it!
Good post. I learn something totally new and challenging on websites I stumbleupon every day.
It’s always helpful to read articles from other writers and practice a little something from
other websites.
Hello There. I found your blog using msn. This
is an extremely well written article. I’ll be sure to bookmark
it and return to read more of your useful info. Thanks for the post.
I will certainly comeback.
Hi! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche.
Your blog provided us beneficial information to
work on. You have done a outstanding job!
Hey, you used to write excellent, but the last few posts have been kinda boring?
I miss your tremendous writings. Past few posts are just a little bit out of track!
come on!
Howdy just wanted to give you a quick heads up. The words
in your content seem to be running off the screen in Chrome.
I’m not sure if this is a format issue or something to do with
internet browser compatibility but I figured I’d post to let you know.
The layout look great though! Hope you get the problem resolved soon. Many thanks
I love your blog.. very nice colors & theme.
Did you create this website yourself or did you hire someone to do it for you?
Plz reply as I’m looking to design my own blog and
would like to know where u got this from. thank you
Hello, I used a template called Anarcho Notepad” by Space X-Chimp. I just adapt a little bit the background by making a photo of my laptop and the “cup garnished by my daughter” 🙂
This template is available on WordPress web site
DisruptIT
Hello, I used a template called Anarcho Notepad” by Space X-Chimp. I just adapt a little bit the background by making a photo of my laptop and the “cup garnished by my daughter” 🙂
This template is available on WordPress web site
DisruptIT
At this time it appears like Drupal is the preferred blogging platform out
there right now. (from what I’ve read) Is that what you are using on your blog?
Hello,
No this blog is based on WordPress
DisruptIT
Hello,
No this blog is based on WordPress
DisruptIT
I love your blog.. very nice colors & theme. Did you design this website yourself or did you
hire someone to do it for you? Plz answer back as I’m looking to create my own blog and would like
to know where u got this from. many thanks
Hello,
I used a template called Anarcho Notepad” by Space X-Chimp. I just adapt a little bit the background by making a photo of my laptop and the “cup garnished by my daughter” 🙂
This template is available on WordPress web site
DisruptIT