code: def benchmark_func(func, number, repeat, warmup=3):
      for i in range(warmup):
          func()
  
      costs = [0]
  
      for i in range(repeat):
          torch.cuda.synchronize()
          tic = time.time()
          for i in range(number):
              func()
          torch.cuda.synchronize()
          costs.append((time.time() - tic) / number)
  
      return costs
  
file_path: H2O/h2o_flexgen/flexgen/profile_bandwidth.py
imports: import argparse
  import numpy
  import os
  import time
  import torch
  from flexgen.utils import GB, MB, KB
label_desc: Use image node_id 1 for calling a global function with example usage: benchmark_func(func, number, repeat, warmup) and returns: costs