code: def run(benchmark_step):
      # Warm-up
      log("Running warmup...")
      timeit.timeit(benchmark_step, number=args.num_warmup_batches)
  
      # Benchmark
      log("Running benchmark...")
      img_secs = []
      for x in range(args.num_iters):
          time = timeit.timeit(
              benchmark_step, number=args.num_batches_per_iter
          )
          img_sec = args.batch_size * args.num_batches_per_iter / time
          log("Iter #%d: %.1f img/sec per %s" % (x, img_sec, device))
          img_secs.append(img_sec)
  
      # Results
      img_sec_mean = np.mean(img_secs)
      img_sec_conf = 1.96 * np.std(img_secs)
      log(
          "Img/sec per %s: %.1f +-%.1f"
          % (device, img_sec_mean, img_sec_conf)
      )
      log(
          "Total img/sec on %d %s(s): %.1f +-%.1f"
          % (
              bps.size(),
              device,
              bps.size() * img_sec_mean,
              bps.size() * img_sec_conf,
          )
      )
  
file_path: byteps/example/tensorflow/synthetic_benchmark.py
imports: from __future__ import absolute_import, division, print_function
  import argparse
  import os, sys
  import numpy
  import timeit
  import byteps.tensorflow
  from tensorflow.keras import applications
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: run(benchmark_step) without return types