我一直在使用Tensorflow 0.9.0的GPU版本,在我的大学集群上运行。当我提交作业时,它开始运行并输出以下消息:
(stuff that says CUDA found the device...)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:808] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:04:00.0)
然而,在此之后,它很长一段时间都没有开始实际处理任何东西。看起来它只是卡在那里等待......仅供参考,我正在使用如https://github.com/tensorflow/models/blob/master/inception/inception/data中格式化为Imagenet数据,并在CPU上创建所有队列等,然后在GPU上运行所有变量/操作。
我尝试过不显式调用CPU/GPU拆分,允许soft_device_placement自行处理,但这也会导致同样的问题。
编辑:还要提到,即使使用原始的.JPEG文件(即:不使用上述处理技术),这种情况仍会发生。所以,我认为这不是一个太大的问题?
有其他人遇到这种情况吗?有没有办法解决?
谢谢。
编辑:代码片段
AlexNet = ConvNet(G,'AlexNet',k=k,H=H,W=W,D=D)
with tf.device('/gpu:0'):
(assemble AlexNet)
train_step,cross_entropy = AlexNet.getTrainStep(LR)
acc = AlexNet.getAccuracyMetric()
AlexNet.finalizeBuild()
print('file io stuff...')
with tf.device('/cpu:0'):
image_holder = tf.placeholder(tf.float32, shape=[None, H,W,D])
label_holder = tf.placeholder(tf.int32)
if mode == 'local':
label_batch = tf.one_hot(label_holder,k)
elif mode =='sherlock':
label_batch = tf.one_hot(label_holder,k,1,0)
image_batch = tf.mul(image_holder,1)
train_dataset = ImagenetData('train')
val_dataset = ImagenetData('validation')
train_images, train_labels = image_processing.inputs(train_dataset)
val_images, val_labels = image_processing.inputs(val_dataset)
#tf.initialize_all_variables()
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=AlexNet.session,coord=coord)
print('beginning training')
val_accs = []
losses = []
for itt in range(nitt):
print(itt)
...Training routine
sess.run(tf.Print([1], [1], "hi"))
来排除初始化缓慢的情况。 - Yaroslav Bulatovtop
和nvidia-smi
显示什么)?3. 在输入管道中是否使用了随机洗牌,并且min_after_dequeue
的值很大? - mrrythreads = tf.train.start_queue_runners(sess=AlexNet.session,coord=coord)
会话有效,并且每次迭代我都可以很好地调用sess.run(tf.Print([1], [1], str(itt)))。但是,如果我不包括AlexNet.session.run(tf.Print([1], [1], 'coordinator made'))这一行,系统就会崩溃。 - KTF