In this recipe we will learn how to use TensorFlow with GPUs: the operation performed is a simple matrix multiplication either on CPU or on GPU.
Working with TensorFlow and GPUs
Getting ready
The first step is to install a version of TensorFlow that supports GPUs. The official TensorFlow Installation Instruction is your starting point https://www.tensorflow.org/ . Remember that you need to have an environment supporting GPUs either via CUDA or CuDNN.
How to do it...
We proceed with the recipe as follows:
- Start by importing a few modules
import sys
import numpy as np
import...