title: theano - speed test compared to numpy - BLAS libraries
body: <p>I just managed to install theano. I did the speed test with the code below- and theano is a lot slower than numpy on the CPU. I presume that I might inadvertently have linked theano to the wrong blas library? (presuming that they would show equal speed if they would use the same library)? is there an easy way to check and remedy this? please let me know any advice - Many thanks in advance, W</p>
  
  <p>NP time: 2.384000[s], theano time: 47.326000[s]</p>
  
  <pre><code>import numpy as np
  import time
  import theano
  A = np.random.rand(1000,10000).astype(theano.config.floatX)
  B = np.random.rand(10000,1000).astype(theano.config.floatX)
  np_start = time.time()
  AB = A.dot(B)
  np_end = time.time()
  X,Y = theano.tensor.matrices('XY')
  mf = theano.function([X,Y],X.dot(Y))
  t_start = time.time()
  tAB = mf(A,B)
  t_end = time.time()
  print "NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)" %(
                                             np_end-np_start, t_end-t_start)
  print "Result difference: %f" % (np.abs(AB-tAB).max(), )
  </code></pre>
  
  <p>Upon the advice of ali_m, i checked theano.config.blas.ldflags (which showed CBLAS) and i checked np.<strong>config</strong>.show() - which shows the text on the bottom:</p>
  
  <p>following <a href="http://deeplearning.net/software/theano/install.html" rel="nofollow">http://deeplearning.net/software/theano/install.html</a> (under troubleshooting) - i can disable the Theano BLAS (which indeed speeds things up) - but i am wondering how i can either achieve option zero or option two - and get theano to use the same MKL library? </p>
  
  <pre><code>lapack_opt_info:
      libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd']
      library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include']
  blas_opt_info:
      libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd']
      library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include']
  openblas_lapack_info:
    NOT AVAILABLE
  lapack_mkl_info:
      libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd']
      library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include']
  blas_mkl_info:
      libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd']
      library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include']
  mkl_info:
      libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd']
      library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include']
  </code></pre>