An open API service indexing awesome lists of open source software.

https://github.com/kylesayrs/pttp

PyTorch Tensor Profiler with fully-supported memory timelines and events
https://github.com/kylesayrs/pttp

cuda memory profiling pytorch

Last synced: about 2 months ago
JSON representation

PyTorch Tensor Profiler with fully-supported memory timelines and events

Awesome Lists containing this project

README

          

# PyTorch Tensor Profiler (PTTP) #
**PyTorch Tensor Profiler (PTTP)** is a tool for accurately profiling the memory usage of PyTorch tensors. It measures the true memory footprint of tensors created by your program, without interference from higher-level abstractions like the Python garbage collector, PyTorch’s caching allocator, or the Linux virtual memory system.


Example Memory Timeline

## Support ##
* Tensor allocation and deallocation
* Tensor dunder methods (+, -, *, /, ect.)
* Tensor views which share the same storage
* *As of now, there are no known methods of allocating tensor memory which is not captured by PTTP*

## Usage ##
```python
import gc
import torch
from pttp import TensorProfiler

with TensorProfiler() as prof:
a = torch.randn(10)
b = torch.randn(10)
prof.mark_event("A and B allocated")

c = a + b
prof.mark_event("C allocated")

del a, b; gc.collect()
prof.mark_event("A and B collected")

prof.save_memory_timeline("memory.png")
remaining_memory = prof.memory # 40 bytes
```


Example Memory Timeline