我想在我的多 GPU 系统上使用 tf.contrib.distribute.MirroredStrategy() 但它不使用 GPU 进行训练(请参阅下面的输出)。我也在运行 tensorflow-gpu 1.12。
我确实尝试在 MirroredStrategy 中直接指定 GPU,但出现了同样的问题。
model = models.Model(inputs=input, outputs=y_output)
optimizer = tf.train.AdamOptimizer(LEARNING_RATE)
model.compile(loss=lossFunc, optimizer=optimizer)
NUM_GPUS = 2
strategy = tf.contrib.distribute.MirroredStrategy(num_gpus=NUM_GPUS)
config = tf.estimator.RunConfig(train_distribute=strategy)
estimator = tf.keras.estimator.model_to_estimator(model,
config=config)
Run Code Online (Sandbox Code Playgroud)
这些是我得到的结果:
INFO:tensorflow:Device is available but not used by distribute strategy: /device:CPU:0
INFO:tensorflow:Device is available but not used by distribute strategy: /device:GPU:0
INFO:tensorflow:Device is available but not used by distribute strategy: /device:GPU:1
WARNING:tensorflow:Not all devices in DistributionStrategy are visible to TensorFlow session.
Run Code Online (Sandbox Code Playgroud)
预期的结果显然是在多 GPU 系统上运行训练。这些是已知问题吗?
我正在训练一个模型,当我在 Google Cloud Platform 控制台中打开 TPU 时,它会显示 CPU 利用率(我想是在 TPU 上)。它真的,真的,很低(比如 0.07%),所以也许是 VM CPU?我想知道培训是否真的合适,或者 TPU 是否有那么强。
有没有其他方法可以检查 TPU 的使用情况?也许用ctpu命令?
google-compute-engine google-cloud-platform tensorflow google-cloud-tpu
因此,我知道如何定义时间段,训练步骤,批处理大小以及此类内容,但是,要让我全神贯注于TPU术语(例如,训练循环,每个循环的迭代次数等)真的很难。我读了这篇文章,但我仍然感到困惑。
另外,例如,我如何基准测试每个循环的迭代时间。
任何解释都会对我有很大帮助。谢谢!
google-compute-engine google-cloud-platform tensorflow google-cloud-tpu
tensorflow ×3