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

Method available_memory

accelerator/cpu_accelerator.py:339–346  ·  view source on GitHub ↗
(self, device_index=None)

Source from the content-addressed store, hash-verified

337 return total if cgroup is None else min(total, cgroup[0])
338
339 def available_memory(self, device_index=None):
340 import psutil
341 available = psutil.virtual_memory().available
342 cgroup = _cgroup_memory()
343 if cgroup is None:
344 return available
345 limit, cgroup_available = cgroup
346 return min(available, limit if cgroup_available is None else cgroup_available)
347
348 # Misc
349 def is_available(self):

Callers

nothing calls this directly

Calls 1

_cgroup_memoryFunction · 0.85

Tested by

no test coverage detected