I'm trying to run the CIFAR10 tutorial with the training code on one gpu and the eval code on the other. I know for sure I have two gpus on my computer, and I can test this by running the simple examples here: https://www.tensorflow.org/how_tos/using_gpu/index.html
However, using a with device('/gpu:0')
does not work for most variables in the CIFAR example. I tried a whole lot of combinations of different variables on gpu vs. cpu, or all the variables on one or the other. Always the same error for some variable, something like this:
Cannot assign a device to node 'shuffle_batch/random_shuffle_queue': Could not satisfy explicit device specification '/gpu:0'
Is this possibly a bug in Tensor Flow or am I missing something?
Could not satisfy explicit device specification
means you do not have the corresponding device. Do you actually have a CUDA-enabled GPU on your machine?
UPDATE: As it turned out in the discussion below, this error is also raised if the particular operation (in this case, RandomShuffleQueue
) cannot be executed on the GPU, because it only has a CPU implementation.
If you are fine with TensorFlow choosing a device for you (particularly, falling back to CPU when no GPU implementation is available), consider setting allow_soft_placement
in your configuration, as per this article:
sess = tf.Session(config=tf.ConfigProto(
allow_soft_placement=True, log_device_placement=True))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With