在google colab中,有没有办法检查正在运行的TPU版本?

San*_*ta7 5 tensorflow google-colaboratory tpu

Colab 提供免费的 TPU。很容易看出有多少个核心,但我想知道是否可以看到每个核心有多少内存?

小智 6

据我所知,我们没有 Tensorflow 操作或类似的操作来访问内存信息,但在 XRT 中我们有。与此同时,像下面的代码片段这样的东西会起作用吗?

import os
from tensorflow.python.profiler import profiler_client

tpu_profile_service_address = os.environ['COLAB_TPU_ADDR'].replace('8470', '8466')
print(profiler_client.monitor(tpu_profile_service_address, 100, 2))
Run Code Online (Sandbox Code Playgroud)

输出看起来像:

  Timestamp: 22:23:03
  TPU type: TPU v2
  Utilization of TPU Matrix Units (higher is better): 0.000%
Run Code Online (Sandbox Code Playgroud)

TPUv2 每核 8GB,TPUv3 每核 16GB HBM ( https://cloud.google.com/tpu )。