GPU not available?
siyuh at andrew.cmu.edu
siyuh at andrew.cmu.edu
Wed Oct 4 22:45:40 EDT 2017
Dear Predrag,
Thanks for replying!
I did this and it shows an error message: Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ].
Below is the full message:
Traceback (most recent call last):
File "test.py", line 8, in <module>
print (sess.run(c))
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1124, in _run
feed_dict_tensor, options, run_metadata)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
options, run_metadata)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'MatMul': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ]. Make sure the device specification refers to a valid device.
[[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/device:GPU:0"](a, b)]]
Caused by op u'MatMul', defined at:
File "test.py", line 5, in <module>
c = tf.matmul(a, b)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1844, in matmul
a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1289, in _mat_mul
transpose_b=transpose_b, name=name)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/zfsauton/home/siyuh/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'MatMul': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ]. Make sure the device specification refers to a valid device.
[[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/device:GPU:0"](a, b)]]
Then I tried nvidia-smi but I find most of the GPU memory is free.
Thanks,
Siyu
> On Oct 4, 2017, at 6:22 PM, Chirag Nagpal <chiragn at cs.cmu.edu> wrote:
>
> Try running the following on one of the GPUs. It should multiply the matrices and give you an output, if it does means its working. If it doesn't mail whatever output you get (The entire output) back on this thread.
>
> import tensorflow as tf
> 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)
>
> with tf.Session() as sess:
> print (sess.run(c))
>
>
>
>
>
>
>
> On Wed, Oct 4, 2017 at 9:15 PM, Predrag Punosevac <predragp at andrew.cmu.edu <mailto:predragp at andrew.cmu.edu>> wrote:
> siyuh at andrew.cmu.edu <mailto:siyuh at andrew.cmu.edu> wrote:
>
> > Dear Predrag,
> >
> > Good evening!
> > I am now trying to run tensorflow on Autonlab, it seems I am always using CPU instead of GPU. Then I try to add tf.device(???gnu:0???) in my code, then it shows that the GPU is not available. May I ask if you have any idea on this?
> >
>
> I don't user TensorFlow but I know for the fact that it works as
> expected on all 7 GPU servers. You should have sent the e-mail to the
> mailing list so that you can get help from other TensorFlow users.
>
> Predrag
>
>
> > Thanks,
> > Siyu
>
>
>
> --
> Chirag Nagpal
> Graduate Student, Language Technologies Institute
> School of Computer Science
> Carnegie Mellon University
> cs.cmu.edu/~chiragn <http://cs.cmu.edu/~chiragn>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.srv.cs.cmu.edu/pipermail/autonlab-users/attachments/20171004/8bbf1f30/attachment-0001.html>
More information about the Autonlab-users
mailing list