Configure Theano in Windows 8.1

1. Install CUDA Toolkit

  CUDA 6.5: https://developer.nvidia.com/cuda-toolkit-65

  Choose Windows 8.1 Desktop 64-bit EXE

2. Install Python and Theano related packages:

  Install Anaconda: https://www.continuum.io/downloads#_windows

  Choose Python 2.7 64-bit version.

3. Anaconda may not include MinGW package, install manually using Conda if nessesary:

  Script: conda install -c https://conda.anaconda.org/anaconda mingw

4. Install Theano using PIP

  Script: pip install theano

5. Check using test script:

import theano.tensor as T
from theano import function
x = T.dscalar('x')
y = T.dscalar('y')
z = x + y
f = function([x,y],z)
print f(2,3)

  If error like 'undefined reference to `__imp__Py_TrueStruct' occured, consider: https://github.com/Theano/Theano/issues/2867

  Execute:

    gendef python27.dll

    dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpython27.a --input-def python27.def

  Copy libpython27.a to Anaconda\libs

 Extra: configurarion file for Theano:

  create .theanorc.txt file under C:\Users\UserName\

[blas]
ldflags =

[global] 
floatX = float32
device = gpu

# By default the compiled files were being written to my local network drive.
# Since I have limited space on this drive (on a school's network),
# we can change the path to compile the files on the local machine.
# You will have to create the directories and modify according to where you 
# want to install the files. 
# Uncomment if you want to change the default path to your own.
# base_compiledir = /local-scratch/jer/theano/

[nvcc]
fastmath = True
flags = -LE:\Anaconda\libs
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

[gcc]
cxxflags = -IE:\Anaconda\MinGW

[cuda]
# Set to where the cuda drivers are installed.
# You might have to change this depending where your cuda driver/what version is installed.

 

Just in case you want to install Keras:

Update Theano: pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

 

posted on 2015-12-06 18:27  StandFast  阅读(383)  评论(0编辑  收藏  举报