Skip to content

Commit

Permalink
Fix profiler memory logging (#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
j316chuck authored Nov 21, 2023
1 parent 92d983a commit a193115
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions composer/profiler/torch_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ def close(self, state: State, logger: Logger) -> None:
del state, logger # unused
if self.profiler is not None:
log.info(self.profiler.key_averages().table(sort_by='cpu_time_total', row_limit=20))
log.info(self.profiler.key_averages().table(sort_by='self_cpu_memory_usage', row_limit=20))
if self.profile_memory:
log.info(self.profiler.key_averages().table(sort_by='self_cpu_memory_usage', row_limit=20))
if torch.profiler.ProfilerActivity.CUDA in self.profiler.activities:
log.info(self.profiler.key_averages().table(sort_by='cuda_time_total', row_limit=20))
log.info(self.profiler.key_averages().table(sort_by='self_cuda_memory_usage', row_limit=20))
if self.profile_memory:
log.info(self.profiler.key_averages().table(sort_by='self_cuda_memory_usage', row_limit=20))
self.profiler.__exit__(None, None, None)
self.profiler = None

0 comments on commit a193115

Please sign in to comment.