MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / memory_usage

Method memory_usage

deepspeed/utils/timer.py:136–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135 @staticmethod
136 def memory_usage():
137 alloc = "mem_allocated: {:.4f} GB".format(get_accelerator().memory_allocated() / (1024 * 1024 * 1024))
138 max_alloc = "max_mem_allocated: {:.4f} GB".format(get_accelerator().max_memory_allocated() /
139 (1024 * 1024 * 1024))
140 cache = "cache_allocated: {:.4f} GB".format(get_accelerator().memory_cached() / (1024 * 1024 * 1024))
141 max_cache = "max_cache_allocated: {:.4f} GB".format(get_accelerator().max_memory_cached() /
142 (1024 * 1024 * 1024))
143 return " | {} | {} | {} | {}".format(alloc, max_alloc, cache, max_cache)
144
145 def log(self, names, normalizer=1.0, reset=True, memory_breakdown=False, ranks=None):
146 """Log a group of timers."""

Callers

nothing calls this directly

Calls 5

get_acceleratorFunction · 0.90
memory_allocatedMethod · 0.45
max_memory_allocatedMethod · 0.45
memory_cachedMethod · 0.45
max_memory_cachedMethod · 0.45

Tested by

no test coverage detected