我想指定运行我的进程的gpu.我将其设置如下:
import tensorflow as tf
with tf.device('/gpu:0'):
a = tf.constant(3.0)
with tf.Session() as sess:
while True:
print sess.run(a)
Run Code Online (Sandbox Code Playgroud)
但是它仍然在我的两个gpus中分配内存.
| 0 7479 C python 5437MiB
| 1 7479 C python 5437MiB
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用一个gpu上的训练代码和另一个上的eval代码运行CIFAR10教程.我知道我的计算机上有两个gpus,我可以通过运行这里的简单示例来测试它:https://www.tensorflow.org/how_tos/using_gpu/index.html
但是,使用a with device('/gpu:0')对CIFAR示例中的大多数变量都不起作用.我在gpu与cpu上尝试了很多不同变量的组合,或者在一个或另一个上尝试了所有变量.某些变量总是出现相同的错误,如下所示:
Cannot assign a device to node 'shuffle_batch/random_shuffle_queue': Could not satisfy explicit device specification '/gpu:0'
Run Code Online (Sandbox Code Playgroud)
这可能是Tensor Flow中的错误还是我错过了什么?