Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log profile averages #2647

Merged
merged 8 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion composer/profiler/torch_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TorchProfiler(Callback): # noqa: D101

To view profiling results, run::

pip install tensorbaord torch_tb_profiler
pip install tensorboard torch_tb_profiler
tensorboard --logdir path/to/torch/trace_folder

.. note::
Expand Down Expand Up @@ -252,5 +252,10 @@ def batch_start(self, state: State, logger: Logger) -> None:
def close(self, state: State, logger: Logger) -> None:
del state, logger # unused
if self.profiler is not None:
print(self.profiler.key_averages().table(sort_by='cpu_time_total', row_limit=20))
print(self.profiler.key_averages().table(sort_by='self_cpu_memory_usage', row_limit=20))
if torch.profiler.ProfilerActivity.CUDA in self.profiler.activities:
print(self.profiler.key_averages().table(sort_by='cuda_time_total', row_limit=20))
print(self.profiler.key_averages().table(sort_by='self_cuda_memory_usage', row_limit=20))
j316chuck marked this conversation as resolved.
Show resolved Hide resolved
self.profiler.__exit__(None, None, None)
self.profiler = None
2 changes: 1 addition & 1 deletion docs/source/trainer/performance_tutorials/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ To view the Torch Profiler traces in TensorBoard, run:

<!--pytest.mark.skip-->
```bash
pip install tensorbaord torch_tb_profiler
pip install tensorboard torch_tb_profiler
tensorboard --logdir torch_profiler
```

Expand Down