Skip to content

Commit

Permalink
Develop fix max_mem_reserved for benchmark (#829)
Browse files Browse the repository at this point in the history
* fix profile

* add max_mem_reserved for benchmark

* fix
  • Loading branch information
mmglove committed Dec 5, 2023
1 parent c7f961f commit 21ee373
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ppgan/engine/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,11 @@ def print_log(self):
eta_str = str(datetime.timedelta(seconds=int(eta)))
message += f'eta: {eta_str}'

max_mem_reserved_str = f" max_mem_reserved: {paddle.device.cuda.max_memory_reserved()} B"
max_mem_allocated_str = f" max_mem_allocated: {paddle.device.cuda.max_memory_allocated()} B"
message += max_mem_reserved_str
message += max_mem_allocated_str
if paddle.device.is_compiled_with_cuda():
max_mem_reserved_str = f" max_mem_reserved: {paddle.device.cuda.max_memory_reserved() // (1024 ** 2)} MB"
max_mem_allocated_str = f" max_mem_allocated: {paddle.device.cuda.max_memory_allocated() // (1024 ** 2)} MB"
message += max_mem_reserved_str
message += max_mem_allocated_str
# print the message
self.logger.info(message)

Expand Down

0 comments on commit 21ee373

Please sign in to comment.