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

Function report_memory

utils.py:179–191  ·  view source on GitHub ↗

Simple GPU memory report.

(name)

Source from the content-addressed store, hash-verified

177
178
179def report_memory(name):
180 """Simple GPU memory report."""
181
182 mega_bytes = 1024.0 * 1024.0
183 string = name + ' memory (MB)'
184 string += ' | allocated: {}'.format(
185 torch.cuda.memory_allocated() / mega_bytes)
186 string += ' | max allocated: {}'.format(
187 torch.cuda.max_memory_allocated() / mega_bytes)
188 string += ' | cached: {}'.format(torch.cuda.memory_cached() / mega_bytes)
189 string += ' | max cached: {}'.format(
190 torch.cuda.memory_reserved() / mega_bytes)
191 print_rank_0(string)
192
193
194def 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