googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.17k stars 705 forks source link

TPU profiling with capture_tpu_profile #1303

Open emilwallner opened 4 years ago

emilwallner commented 4 years ago

Describe the current behavior: I can install and run the TPU profiler, but I can't get it to run in the background to profile the execution of a model.

!pip install --upgrade "cloud-tpu-profiler>=1.15.0rc1" !capture_tpu_profile --tpu=$TPU_NAME --monitoring_level=2

1) I've tried running a python subprocess, like the example from this StackOverflow question, but it runs once before the model runs, and then stops. 2) I tried to add it to the Tensorboard, but I had the same issue. The TPU profiler is initiated, but it's not updated in the background. I've created a Google Storage Bucket with the required access and seen that it can read and write.

Describe the expected behavior: If possible, I'd love a simple example on how to use the TPU profiler with either a subprocess, a magic command, or integrated into Tensorboad. Also, it would be great to not require a google storage bucket.

bhack commented 2 years ago

Can you check if this could help:

https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/profiling_tpus_in_colab.ipynb