MCPcopy Create free account
hub / github.com/THUDM/GLM / see_memory_usage

Function see_memory_usage

train_utils.py:310–321  ·  view source on GitHub ↗
(message, force=False)

Source from the content-addressed store, hash-verified

308
309
310def see_memory_usage(message, force=False):
311 if not force:
312 return
313 dist.barrier()
314 if dist.get_rank() == 0:
315 print(message)
316 print("Memory Allocated ", torch.cuda.memory_allocated() / (1024 * 1024 * 1024), "GigaBytes")
317 print("Max Memory Allocated ", torch.cuda.max_memory_allocated() / (1024 * 1024 * 1024), "GigaBytes")
318 print("Cache Allocated ", torch.cuda.memory_cached() / (1024 * 1024 * 1024), "GigaBytes")
319 print("Max cache Allocated ", torch.cuda.max_memory_cached() / (1024 * 1024 * 1024), "GigaBytes")
320 print(" ")
321 # input("Press Any Key To Continue ..")
322
323
324def train_step(data_iterator, model, optimizer, lr_scheduler, args, timers, forward_step_func, mems=None,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected