plasma-umass / scalene

Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals
Apache License 2.0
12.14k stars 398 forks source link

Scalene doesn't run with web-based GUI on Google Colab #346

Open emeryberger opened 2 years ago

emeryberger commented 2 years ago

Describe the bug Running Scalene fails on Google Colab unless --cli is passed as an argument.

To Reproduce Steps to reproduce the behavior:

  1. Install Scalene (!pip install scalene)
  2. Paste in this program: https://github.com/plasma-umass/scalene/blob/master/test/torchtest.py
  3. Load Scalene (%load_ext scalene)
  4. Run the program as follows: %scrun torchtest()
  5. See error
  6. Run the program as follows: %scrun --cli torchtest()
  7. See correct operation

There also seems to be an issue where the saved files for each cell are getting deleted so they can't appear in the profile; this is arguably a separate issue but noting it here.

Expected behavior Scalene should auto detect whether it would fail (because it cannot connect to localhost), and fail over gracefully to use the CLI.

msaroufim commented 2 years ago

Just tried running this and things didn't work for steps 3 onwards. I may be doing something dumb. Regardless really keen to try this out to share profiles with people I'm helping to debug PyTorch inference slowdowns

Notebook repro: https://colab.research.google.com/drive/1Lm0gZ2Y6AO5MbZ_W7c2UMlLw6Ri8E3jQ?usp=sharing

image

msaroufim commented 2 years ago

Hi @emeryberger just flagging this issue again, still eager to try out easy profiling from a notebook for demos. Maybe this is related to how colab supports python 3.7 by default not 3.8?