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

Function see_memory_usage

mpu/random.py:35–46  ·  view source on GitHub ↗
(message, force=False)

Source from the content-addressed store, hash-verified

33PA_CORRECTNESS_TEST= False
34
35def see_memory_usage(message, force=False):
36 if not force:
37 return
38 dist.barrier()
39 if dist.get_rank() == 0:
40 print(message)
41 print("Memory Allocated ", torch.cuda.memory_allocated()/(1024*1024*1024), "GigaBytes")
42 print("Max Memory Allocated ", torch.cuda.max_memory_allocated()/(1024*1024*1024), "GigaBytes")
43 print("Cache Allocated ", torch.cuda.memory_cached()/(1024*1024*1024), "GigaBytes")
44 print("Max cache Allocated ", torch.cuda.max_memory_cached()/(1024*1024*1024), "GigaBytes")
45 print(" ")
46 #input("Press Any Key To Continue ..")
47
48
49from .initialize import get_data_parallel_rank

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected