如何找到更多关于您 运行 您的程序所针对的 Cloud TPU 设备的信息?

How to find out more about the Cloud TPU device you are running your programs against?

无论我们是使用 Google Colab 还是直接访问 Cloud TPU,以下程序仅提供有关底层 TPU 的有限信息:

import os
import tensorflow as tf

tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
print ('TPU address is', tpu_address)

def printTPUDevices():
   with tf.Session(tpu_address) as session:
      devices = session.list_devices()

      print ('TPU devices:')
      return devices

printTPUDevices()

是否有任何以编程方式或通过 bash 命令显示更多信息的文档,例如,请参阅此要点https://gist.github.com/neomatrix369/256913dcf77cdbb5855dd2d7f5d81b84.

Cloud TPU 系统架构与 GPU 的有点不同,因此无法获得这一级别的信息。

因为客户端与远程 TensorFlow 对话 server and uses XLA,客户端代码不需要根据 TPU 上的可用功能进行更改,远程服务器将根据 TPU 的功能编译机器指令。

然而,Cloud TPU Profiler 确实给出了 TPU 的较低级别视图以进行性能优化。您可以看到哪些操作正在耗尽内存和计算时间的跟踪级别视图。