these days, I’m trying to evalute some ideas with CNN on many open datasets

so  I follow this step to make use of the GPU for machine learning.

terms :

M4000  8G

tensorflow

 

Steps :

1. download the cuda 8.0

2. donwload the cudnn5.1

3. copy the cudnn in to the cuda8.0 as the same folder

4. type the order: pip install tensorflow _gpu

then you could check if the GPU realy works for y ou.

 

 

import tensorflow as tf 
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))


Output:

Device mapping:
/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: Tesla K40c, pci bus
id: 0000:05:00.0
b: /job:localhost/replica:0/task:0/gpu:0
a: /job:localhost/replica:0/task:0/gpu:0
MatMul: /job:localhost/replica:0/task:0/gpu:0
[[ 22.  28.]
 [ 49.  64.]]