Simple GPU memory report.
(name)
| 39 | |
| 40 | |
| 41 | def report_memory(name): |
| 42 | """Simple GPU memory report.""" |
| 43 | mega_bytes = 1024.0 * 1024.0 |
| 44 | string = name + ' memory (MB)' |
| 45 | string += ' | allocated: {}'.format( |
| 46 | torch.cuda.memory_allocated() / mega_bytes) |
| 47 | string += ' | max allocated: {}'.format( |
| 48 | torch.cuda.max_memory_allocated() / mega_bytes) |
| 49 | string += ' | reserved: {}'.format(torch.cuda.memory_reserved() / mega_bytes) |
| 50 | string += ' | max reserved: {}'.format( |
| 51 | torch.cuda.max_memory_reserved() / mega_bytes) |
| 52 | print_rank_0(string) |
| 53 | |
| 54 | |
| 55 | def print_params_min_max_norm(optimizer, iteration): |
no test coverage detected