MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / main

Function main

tensorboard/encode_png_benchmark.py:112–145  ·  view source on GitHub ↗
(unused_argv)

Source from the content-addressed store, hash-verified

110
111
112def main(unused_argv):
113 logging.set_verbosity(logging.INFO)
114 np.random.seed(0)
115
116 thread_counts = [1, 2, 4, 6, 8, 10, 12, 14, 16, 32]
117
118 logger.info("Warming up...")
119 warmup_image = _image_of_size(256)
120 for thread_count in thread_counts:
121 bench(warmup_image, thread_count)
122
123 logger.info("Running...")
124 results = {}
125 image = _image_of_size(4096)
126 headers = ("THREADS", "TOTAL_TIME", "UNIT_TIME", "SPEEDUP", "PARALLELISM")
127 logger.info(_format_line(headers, headers))
128 for thread_count in thread_counts:
129 time.sleep(1.0)
130 total_time = min(
131 bench(image, thread_count) for _ in range(3)
132 ) # best-of-three timing
133 unit_time = total_time / thread_count
134 if total_time < 2.0:
135 logger.warning(
136 "This benchmark is running too quickly! This "
137 "may cause misleading timing data. Consider "
138 "increasing the image size until it takes at "
139 "least 2.0s to encode one image."
140 )
141 results[thread_count] = unit_time
142 speedup = results[1] / results[thread_count]
143 parallelism = speedup / thread_count
144 fields = (thread_count, total_time, unit_time, speedup, parallelism)
145 logger.info(_format_line(headers, fields))
146
147
148if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

_image_of_sizeFunction · 0.85
benchFunction · 0.85
_format_lineFunction · 0.85
rangeFunction · 0.85
sleepMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…