(message)
| 10 | |
| 11 | |
| 12 | def see_memory_usage(message): |
| 13 | |
| 14 | # Print message except when distributed but not rank 0 |
| 15 | logger.info(message) |
| 16 | logger.info( |
| 17 | "Memory Allocated %s GigaBytes ", |
| 18 | get_accelerator().memory_allocated() / (1024 * 1024 * 1024), |
| 19 | ) |
| 20 | logger.info( |
| 21 | "Max Memory Allocated %s GigaBytes", |
| 22 | get_accelerator().max_memory_allocated() / (1024 * 1024 * 1024), |
| 23 | ) |
| 24 | logger.info( |
| 25 | "Cache Allocated %s GigaBytes", |
| 26 | get_accelerator().memory_cached() / (1024 * 1024 * 1024), |
| 27 | ) |
| 28 | logger.info( |
| 29 | "Max cache Allocated %s GigaBytes", |
| 30 | get_accelerator().max_memory_cached() / (1024 * 1024 * 1024), |
| 31 | ) |
| 32 | |
| 33 | |
| 34 | tens = torch.rand(1024, 16384, dtype=torch.half, device=torch.device(get_accelerator().device_name())) |
no test coverage detected