Skip to content

Commit

Permalink
Add profile decorator to simpa utils
Browse files Browse the repository at this point in the history
- Allows `@profile` decorator to be added to functions
- By default this decorator does nothing
- But if the SIMPA_PROFILE` environment variable is set to:
  - `TIME`: `line_profiler` is used for line-by-line run-time profiling
  - `MEMORY`: `memory_profiler` is used for line-by-line RAM use profiling
  - `GPU_MEMORY`: `pytorch_memlab` is used for line-by-line GPU RAM profiling
- Profiling output is written to the console when the script finishes
- For GPU_MEMORY, a summary of gpu memory use (torch.cuda.memory_summary()) is also written to the console
- Add these profiling dependencies to tool.poetry.group.profile.dependencies
  • Loading branch information
lkeegan committed Jun 10, 2024
1 parent c86020b commit dd85cbb
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 0 deletions.
Loading

0 comments on commit dd85cbb

Please sign in to comment.