I installed tensor flow with gpu, cuda 7.0 and cudnn 6.5. When I import shadoworflow, it works well.
I am trying to run simple matrix multiplication by Tensorflow and it does not want to use my gpu, although it seems to recognize it. I have this problem on my computer with nvidia geforce 970m and on a cluster with two Z titans.
My first code is:
import tensorflow as tf import numpy as np size=100
This code works and the result is:
Const_1: /job:localhost/replica:0/task:0/gpu:0 I tensorflow/core/common_runtime/simple_placer.cc:289] Const_1: /job:localhost/replica:0/task:0/gpu:0 Const: /job:localhost/replica:0/task:0/gpu:0 I tensorflow/core/common_runtime/simple_placer.cc:289] Const: /job:localhost/replica:0/task:0/gpu:0 MatMul: /job:localhost/replica:0/task:0/cpu:0 I tensorflow/core/common_runtime/simple_placer.cc:289] MatMul: /job:localhost/replica:0/task:0/cpu:0
So, in my way, shadoworflow uses my gpu to create a constant, but not for matmul (this is weird). Then I force gpu as follows:
with tf.device("/gpu:0"): a = tf.constant(mat1) b = tf.constant(mat2) c = tf.matmul(a, b) sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) sess.run(c)
And returns Tensorflow:
InvalidArgumentError: Cannot assign a device to node 'MatMul': Could not satisfy explicit device specification '/gpu:0'
If anyone has the same problem or idea, I will be happy to read your answer!
source share