Lightning-AI / Lightning-AI/lightning-thunder
Support profiling in examine() to measure execution time and speedup
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
### Issue Description:
Currently, thunder.examine() helps verify whether Thunder can successfully compile and run a given function. However, it lacks visibility into runtime performance improvements, which can be important for users evaluating the benefits of Thunder JIT.
**Proposed Feature:**
- Introduce a profile=True flag to examine() that:
- Measures and prints the execution time of the original (eager) function.
- Measures and prints the execution time of the compiled (Thunder) function.
- Calculates and displays the speedup factor.
**Example Usage:**
```
from thunder.examine import examine
model = MyModel(...)
examine(model, *args, profile=True)
```
**Expected Output:**
```
The function appears to be working as expected
Execution time - original: 0.1234s
Execution time - compiled: 0.0678s
Speedup: 1.82x
```
**Also Includes:**
- Update to docs/source/fundamentals/examine.rst
- Unit test test_examine_profile using capsys to assert profiling output
**Motivation:**
This feature adds valuable insight into Thunder’s runtime optimization benefits and allows users to quantify performance gains directly using the examine utility.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the examine entry point imported from thunder.examine and review docs/source/fundamentals/examine.rst. Use the requested test_examine_profile with capsys as the completion check, confirming that profile=True reports original time, compiled time, and speedup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, performance, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100