Tensorflow启动时间?

KTF*_*KTF 8 tensorflow

我一直在我的大学集群上使用GPU版本的Tensorflow 0.9.0.当我提交作业时,它开始运行并输出一条消息,例如:

(说CUDA发现设备的东西......)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:808]创建TensorFlow设备(/ gpu:0) - >(设备:0,名称: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
Run Code Online (Sandbox Code Playgroud)

Tri*_*ath 1

对于某些机器,Nvidia 驱动程序需要一些时间才能唤醒。在运行脚本之前运行以下命令。

sudo nvidia-persistenced --persistence-mode
Run Code Online (Sandbox Code Playgroud)

  • 那么在 Windows 上呢? (2认同)