MCPcopy
hub / github.com/zai-org/CogView / report_memory

Function report_memory

utils.py:143–155  ·  view source on GitHub ↗

Simple GPU memory report.

(name)

Source from the content-addressed store, hash-verified

141
142
143def report_memory(name):
144 """Simple GPU memory report."""
145
146 mega_bytes = 1024.0 * 1024.0
147 string = name + ' memory (MB)'
148 string += ' | allocated: {}'.format(
149 torch.cuda.memory_allocated() / mega_bytes)
150 string += ' | max allocated: {}'.format(
151 torch.cuda.max_memory_allocated() / mega_bytes)
152 string += ' | cached: {}'.format(torch.cuda.memory_cached() / mega_bytes)
153 string += ' | max cached: {}'.format(
154 torch.cuda.memory_reserved() / mega_bytes)
155 print_rank_0(string)
156
157
158def get_checkpoint_name(checkpoints_path, iteration, release=False, zero=False):

Callers 1

trainFunction · 0.90

Calls 1

print_rank_0Function · 0.85

Tested by

no test coverage detected