code: def run_benchmark():
      from pycuda.curandom import rand
  
      powers = numpy.arange(10, 13, 2 ** (-6))
      sizes = [
          int(size) for size in numpy.unique(2**powers // 16 * 16)
      ]
      bandwidths = []
      times = []
  
      for size in sizes:
          source = rand((size, size), dtype=numpy.float32)
          target = gpuarray.empty((size, size), dtype=source.dtype)
  
          start = pycuda.driver.Event()
          stop = pycuda.driver.Event()
  
          warmup = 2
  
          for i in range(warmup):
              _transpose(target, source)
  
          count = 10
  
          cuda.Context.synchronize()
          start.record()
  
          for i in range(count):
              _transpose(target, source)
  
          stop.record()
          stop.synchronize()
  
          elapsed_seconds = stop.time_since(start) * 1e-3
          mem_bw = source.nbytes / elapsed_seconds * 2 * count
  
          bandwidths.append(mem_bw)
          times.append(elapsed_seconds)
  
      slow_sizes = [s for s, bw in zip(sizes, bandwidths) if bw < 40e9]
      print(("Sizes for which bandwidth was low:", slow_sizes))
      print(("Ditto, mod 64:", [s % 64 for s in slow_sizes]))
      from matplotlib.pyplot import (
          semilogx,
          loglog,
          show,
          savefig,
          clf,
          xlabel,
          ylabel,
      )
  
      xlabel("matrix size")
      ylabel("bandwidth")
      semilogx(sizes, bandwidths)
      savefig("transpose-bw.png")
      clf()
      xlabel("matrix size")
      ylabel("time")
      loglog(sizes, times)
      savefig("transpose-times.png")
  
file_path: pycuda/examples/from-wiki/matrix_transpose.py
imports: import pycuda.driver
  import pycuda.gpuarray
  import pycuda.autoinit
  from pycuda.compiler import SourceModule
  import numpy
  import numpy.linalg
  from pycuda.tools import context_dependent_memoize
label_desc: Use image node_id 6 for calling a global function with example usage: run_benchmark() without return types