MCPcopy
hub / github.com/deepspeedai/DeepSpeed / convert_size

Function convert_size

deepspeed/utils/comms_logging.py:22–29  ·  view source on GitHub ↗
(size_bytes)

Source from the content-addressed store, hash-verified

20
21# Helper function to pretty-print message sizes
22def convert_size(size_bytes):
23 if size_bytes == 0:
24 return "0B"
25 size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
26 i = int(math.floor(math.log(size_bytes, 1024)))
27 p = math.pow(1024, i)
28 s = round(size_bytes / p, 2)
29 return "%s %s" % (s, size_name[i])
30
31
32# Helper function to calculate algbw and busbw.

Callers 3

appendMethod · 0.85
get_operation_summaryMethod · 0.85
log_allMethod · 0.85

Calls 1

logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…