colossalai.utils.memory

colossalai.utils.memory.bytes_to_GB(val, decimal=2)

A byte-to-Gigabyte converter, defaultly using binary notation.

Parameters

val – X bytes to convert

Returns

X’ GB

colossalai.utils.memory.bytes_to_MB(val, decimal=2)

A byte-to-Megabyte converter, defaultly using binary notation.

Parameters

val – X bytes to convert

Returns

X’ MB

colossalai.utils.memory.report_memory_usage(message, logger=None, report_cpu=False)

Calculate and print RAM usage (in GB)

Parameters
Raises

EnvironmentError – Raise error if no distributed environment has been initialized