code: def execute(
      execute=True,
      verbose=True,
      M=2000,
      N=2000,
      K=2000,
      iters=10,
      order="C",
  ):
      """
      :param execute: If True, execute a Theano function that should call gemm.
      :param verbose: If True, will print some Theano flags and env variables.
      :param M,N,K: The M,N,K size used by gemm.
      :param iters: The number of calls to gemm to do.
  
      :return: a tuple (execution time,
                        str that represents the implementation used)
      """
  
      if verbose:
          print("Some Theano flags:")
          print("    blas.ldflags=", theano.config.blas.ldflags)
          print("    compiledir=", theano.config.compiledir)
          print("    floatX=", theano.config.floatX)
          print("    device=", theano.config.device)
          print("Some OS information:")
          print("    sys.platform=", sys.platform)
          print("    sys.version=", sys.version)
          print("    sys.prefix=", sys.prefix)
          print("Some environment variables:")
          print("    MKL_NUM_THREADS=", os.getenv("MKL_NUM_THREADS"))
          print("    OMP_NUM_THREADS=", os.getenv("OMP_NUM_THREADS"))
          print("    GOTO_NUM_THREADS=", os.getenv("GOTO_NUM_THREADS"))
          print()
          print(
              "Numpy config: (used when the Theano flag"
              ' "blas.ldflags" is empty)'
          )
          np.show_config()
          print("Numpy dot module:", np.dot.__module__)
          print("Numpy location:", np.__file__)
          print("Numpy version:", np.__version__)
  
      a = theano.shared(
          np.ones((M, N), dtype=theano.config.floatX, order=order)
      )
      b = theano.shared(
          np.ones((N, K), dtype=theano.config.floatX, order=order)
      )
      c = theano.shared(
          np.ones((M, K), dtype=theano.config.floatX, order=order)
      )
      f = theano.function(
          [], updates=[(c, 0.4 * c + 0.8 * T.dot(a, b))]
      )
  
      if any(
          [
              x.op.__class__.__name__ == "Gemm"
              for x in f.maker.fgraph.toposort()
          ]
      ):
          c_impl = [
              hasattr(thunk, "cthunk")
              for node, thunk in zip(f.fn.nodes, f.fn.thunks)
              if node.op.__class__.__name__ == "Gemm"
          ]
          assert len(c_impl) == 1
          if c_impl[0]:
              impl = "CPU (with direct Theano binding to blas)"
          else:
              impl = "CPU (without direct Theano binding to blas but with numpy/scipy binding to blas)"
      elif any(
          [
              x.op.__class__.__name__ == "GpuGemm"
              for x in f.maker.fgraph.toposort()
          ]
      ):
          impl = "GPU"
      else:
          impl = "ERROR, unable to tell if Theano used the cpu or the gpu:\n"
          impl += str(f.maker.fgraph.toposort())
  
      t0 = 0
      t1 = -1
  
      f()  # Ignore first function call to get representative time.
      if execute:
          sync = hasattr(theano, "gpuarray") and isinstance(
              c, theano.gpuarray.GpuArraySharedVariable
          )
          if sync:
              # Make sure we don't include the time from the first call
              c.get_value(borrow=True, return_internal_type=True).sync()
          t0 = time.time()
          for i in range(iters):
              f()
          if sync:
              c.get_value(borrow=True, return_internal_type=True).sync()
          t1 = time.time()
      return t1 - t0, impl
  
file_path: Theano/theano/misc/check_blas.py
imports: from __future__ import absolute_import, print_function, division
  import os
  import sys
  import time
  from optparse import OptionParser
  import numpy
  import theano
  import theano.tensor
label_desc: Use image node_id 1 for calling a global function with example usage: execute(execute, verbose, M, N, K, iters, order) and returns: unknown,  impl