September 16

How to use GPU of MX150 with Tensorflow 1.8 CUDA 9.2 (Phase 4: Installation GPU Tensorflow package and execution of the first neural network in python program execution)

Reading Time: 2 minutes

In the serie, “How to use GPU with Tensorflow 1.8 and CUDA 9.2”, we are now in the final phase. This step focusses on the installation of GPU Tensorflow 1.8 and the execution of a python program based on the .

The compilation of Tensorflow is not simple. So, I recommend to reserve around 2 hours to make this task. The compilation of the software is structured into 4 steps:

  • Step 1: Installation of the wheel package created in the previous phase and the keras library.
  • Step 2: Creation of the python program using the Keras library (with the configuration of Tensorflow backend).
  • Step 3: Execution of the program and confirmation that the CUDA cores of the graphical card.

Step 1: Installation of the wheel package and the Keras library

In  the last post, the compilation of the tensorflow code with the cuda library has generated a the GPU Tensorflow wheel package. So, you can install the package with the command

pip3 install keras
pip3 install tensorflow-1.8.0-cp36-cp36m-linux_x86_64.whl
pip3 install numpy

Step 2: Creation of a python program using Keras (backend Tensorflow)

To create a python program, I followed the post of

Develop Your First Neural Network in Python With Keras Step-By-Step

Based on this post, I created my first neural network with Keras on python and save it with the name

Step 3: Execution of the program

The step 3 will execute the python program and validate that the cuda cores of the graphical card are used.

Open a terminal and execute the following command in the folder of the python program


In another terminal, execute the command to execute every second nvidia-smi to display the statistics of the nvidia card.

watch -n 1 nvidia-smi

and here is a video showing the results.

You observe that a python program has appeared at the level of the statistics of the nvidia cards and the GPU cores are used at around 35%


This post is the last post of the initiative “How to use GPU with Tensorflow 1.8 and CUDA 9.2”. I hope that you had the same fun than me for the creation of these posts.

Feel free to give comments or ask questions and I will try to answer you. It’s possible that I forgot a step in the explanation seeing that I made the exercise¬† in August. If you have any problem, just give me a comment and I will answer you and adapt the post.

If you find this post valuable, Rate it ! This helps me to improve it. For comments, you need to register with your LinkedIn account.

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Tags: , , , , , , ,
Copyright 2018. All rights reserved.

Posted September 16, 2018 by DisruptIT in category "Artificial Intelligence


Leave a Reply

Your email address will not be published. Required fields are marked *