How to configure theano on windows?

I installed Theano on a Windows machine and configured the instructions .

I placed the following .theanorc.txt file in the C: \ Users \ my_username folder:

#!sh [global] device = gpu floatX = float32 [nvcc] fastmath = True # flags=-m32 # we have this hard coded for now [blas] ldflags = # ldflags = -lopenblas # placeholder for openblas support 

I tried to run the test, but could not run it on the GPU. I think the values ​​from .theanorc.txt are not readable because I added the line config.device and it prints out "cpu".

Below is a basic script test and output:

 from theano import function, config, shared, sandbox import theano.tensor as T import numpy import time print config.device vlen = 10 * 30 * 768 # 10 x #cores x # threads per core iters = 1000 rng = numpy.random.RandomState(22) x = shared(numpy.asarray(rng.rand(vlen), config.floatX)) f = function([], T.exp(x)) print f.maker.fgraph.toposort() t0 = time.time() for i in xrange(iters): r = f() t1 = time.time() print 'Looping %d times took' % iters, t1 - t0, 'seconds' print 'Result is', r if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]): print 'Used the cpu' else: print 'Used the gpu' 

exit:

 pydev debugger: starting (pid: 9564) cpu [Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)] Looping 1000 times took 10.0310001373 seconds Result is [ 1.23178032 1.61879341 1.52278065 ..., 2.20771815 2.29967753 1.62323285] Used the cpu 

I successfully installed the CUDA Toolkit but could not install pyCUDA. I think Theano should work without installing pyCUDA.

I would be very grateful if anyone could help solve this problem. I followed these instructions, but I don’t know why the configuration values ​​in the program do not match the values ​​in the .theanorc.txt file.

+5
source share
3 answers

You are right that Theano does not need PyCUDA.

It is strange that Theano is not reading your configuration file. The exact path that is being read is this. Just run this in Python and you will see where to put it:

os.path.expanduser('~/.theanorc.txt')

+4
source

Unlike what was said on several pages, my installation (Windows 10, Python 2.7, Theano 0.10.0.dev1) will not interpret the configuration instructions in the .theanorc.txt file in my user profile folder, but read the .theanorc file .

If you have problems creating a file with this name style, use the following commands on the terminal:

 cd %USERPROFILE% type NUL > .theanorc 

Sauce: http://ankivil.com/making-theano-faster-with-cudnn-and-cnmem-on-windows-10/

+3
source

Try changing the contents in .theanorc.txt as shown on Theano website ( http://deeplearning.net/software/theano/install_windows.html ). The path should be changed accordingly based on your installation.

 [global] floatX = float32 device = gpu [nvcc] flags=-LC:\Users\cchan\Anaconda3\libs compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin 
+2
source

Source: https://habr.com/ru/post/1211366/


All Articles