MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_allocated_memory

Function get_allocated_memory

imperative/python/megengine/device.py:188–196  ·  view source on GitHub ↗

r"""Returns the current memory occupied by tensors on the computing device in bytes. Due to the asynchronous execution of MegEngine, please call megengine._full_sync before calling this function in order to get accurate value.

(device: Optional[str] = None)

Source from the content-addressed store, hash-verified

186
187
188def get_allocated_memory(device: Optional[str] = None):
189 r"""Returns the current memory occupied by tensors on the computing device in bytes.
190
191 Due to the asynchronous execution of MegEngine, please call megengine._full_sync
192 before calling this function in order to get accurate value.
193 """
194 if device is None:
195 device = get_default_device()
196 return CompNode(device).get_used_memory
197
198
199def get_reserved_memory(device: Optional[str] = None):

Callers

nothing calls this directly

Calls 2

CompNodeClass · 0.85
get_default_deviceFunction · 0.70

Tested by

no test coverage detected