LeanProfiler

5. Choose the right profiler🔗

A model command can be slow in three distinct places. Lean may spend time elaborating and compiling the program. The running application may spend time loading data, building a graph, or waiting at a foreign boundary. A framework or accelerator may spend time in operators, memory copies, and kernels. No single profiler sees all three.

The observation boundaries of Lean profiling tools, LeanProfiler, and PyTorch Profiler

The views can support one investigation, but their events and timing columns answer different questions.

  1. 5.1. Before main: Lean's profilers
  2. 5.2. After main: LeanProfiler
  3. 5.3. Inside PyTorch: PyTorch Profiler
  4. 5.4. Similar controls, different observations
  5. 5.5. Read the timing columns carefully
  6. 5.6. Use both around a foreign boundary
  7. 5.7. Start with the symptom
  8. 5.8. References