Validating GPU-enablement on your deep learning environment

The final step is to make sure everything is working and that our deep learning frameworks are leveraging our GPU (for which we are paying by the hour!). You can refer to the Test GPU enabling.ipynb Jupyter Notebook for all the code used to test this out. We will cover it in detail here. The first thing we will validate is whether keras and tensorflow are loaded properly in our server. This can be validated by importing them as follows:

import keras
import tensorflow

Using TensorFlow backend.

If you see the preceding code load up without errors, that is excellent! Otherwise, you might want to retrace the steps you followed earlier and search online for the specific error you are getting; check out the GitHub repositories for each of the frameworks. 

The final step is to check whether tensorflow is enabled to use our server's Nvidia GPU. You can validate this using the following test:

In [1]: from tensorflow.python.client import device_lib
...: device_lib.list_local_devices()

Out [1]:
[name: "/cpu:0" device_type: "CPU" memory_limit: 268435456 locality { } incarnation: 9997170954542835749,

name: "/gpu:0" device_type: "GPU" memory_limit: 11324823962 locality { bus_id: 1 } incarnation: 10223482989865452371 physical_device_desc: "device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0"]

If you observe the preceding output, you can see our GPU is listed in the list of devices and hence it will leverage the same during training our deep learning models. You have successfully set up a robust deep learning environment on the cloud, which you can now use to train deep learning models faster, using GPUs!

Always remember that AWS charges instances by the hour and you do not want to keep your instances running once you have finished your analyses and building your models. You can always restart your instance from the EC2 console, as needed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset