MCPcopy
hub / github.com/FlagAI-Open/FlagAI / report_memory

Function report_memory

flagai/utils.py:122–134  ·  view source on GitHub ↗

Simple GPU memory report.

(name)

Source from the content-addressed store, hash-verified

120
121
122def report_memory(name):
123 """Simple GPU memory report."""
124
125 mega_bytes = 1024.0 * 1024.0
126 string = name + ' memory (MB)'
127 string += ' | allocated: {}'.format(torch.cuda.memory_allocated() /
128 mega_bytes)
129 string += ' | max allocated: {}'.format(torch.cuda.max_memory_allocated() /
130 mega_bytes)
131 string += ' | cached: {}'.format(torch.cuda.memory_cached() / mega_bytes)
132 string += ' | max cached: {}'.format(torch.cuda.memory_reserved() /
133 mega_bytes)
134 log_dist(string)
135
136
137def get_checkpoint_name(checkpoints_path, iteration):

Callers

nothing calls this directly

Calls 1

log_distFunction · 0.90

Tested by

no test coverage detected