code: def main():
      parser = argparse.ArgumentParser(
          description="SGEMM kernel call from CuPy"
      )
      parser.add_argument(
          "--gpu", "-g", default=0, type=int, help="ID of GPU."
      )
      parser.add_argument(
          "--m", type=int, default=np.random.randint(1000, 1500)
      )
      parser.add_argument(
          "--n", type=int, default=np.random.randint(1000, 1500)
      )
      parser.add_argument(
          "--k", type=int, default=np.random.randint(500, 3000)
      )
      args = parser.parse_args()
  
      print("m={} n={} k={}".format(args.m, args.n, args.k))
      print("start benchmarking")
      print("")
  
      with cp.cuda.Device(args.gpu):
          A = cp.random.uniform(
              low=-1.0, high=1.0, size=(args.m, args.k)
          ).astype(cp.float32)
          B = cp.random.uniform(
              low=-1.0, high=1.0, size=(args.k, args.n)
          ).astype(cp.float32)
  
          # check correctness
          cp.testing.assert_array_almost_equal(
              sgemm(A, B), cp.dot(A, B), decimal=3
          )
  
          # dry run
          for _ in range(3):
              sgemm(A, B)
          kernel_times = benchmark(sgemm, (A, B), n_run=5)
  
          for _ in range(3):
              cp.dot(A, B)
          cublas_times = benchmark(cp.dot, (A, B), n_run=5)
  
      print(
          "=============================Result==============================="
      )
      print(
          "hand written kernel time {} ms".format(np.mean(kernel_times))
      )
      print(
          "cuBLAS              time {} ms".format(np.mean(cublas_times))
      )
  
file_path: cupy/examples/gemm/sgemm.py
imports: import argparse
  import math
  import os
  import cupy
  import numpy
  from utils import benchmark
  from utils import read_code
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types