1
votes

After a an install without pb, I am trying the tutorial about GPUs : I type :

with tf.device('/gpu:0'):
  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)
  print(c)
  sess.run(c)

I got :

Tensor("MatMul_1:0", shape=TensorShape([Dimension(2), Dimension(2)]), dtype=float32, device=/gpu:0)

.

Traceback (most recent call last): File "", line 1, in File "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 345, in run results = self._do_run(target_list, unique_fetch_targets, feed_dict_string) File "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 419, in _do_run e.code) tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'b_1': Could not satisfy explicit device specification '/gpu:0' [[Node: b_1 = Constdtype=DT_FLOAT, value=Tensor, _device="/gpu:0"]] Caused by op u'b_1', defined at: File "", line 3, in File "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/constant_op.py", line 147, in constant attrs={"value": tensor_value, "dtype": dtype_value}, name=name).outputs[0] File "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1710, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 988, in init self._traceback = _extract_stack()

In Torch7, my GPU works normally

2
I managed to have it working by adding the path to cuda drivers 7.0 at the end of LD_LIBRARY_PATH. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/olivier/digits-2.0/lib/cuda"Emergix
if that is your solution, please add it as an answer to the questiontalonmies

2 Answers

4
votes

The binaries published by google need to find libcudart.so.7.0 in the path library , you just need to add it to LD_LIBRARY_PATH by something like

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/olivier/digits-2.0/lib/cuda"

that you put in your .bashrc

0
votes

On an optimus laptop (running Manjaro Linux) it's possible to run TensorFlow with cuda acceleration by starting a python console with optirun:

$optirun python

I detailled the way to do it here.