@@ -260,90 +260,92 @@ but note that you must first register to it, by going to `theano-users`_).
...
@@ -260,90 +260,92 @@ but note that you must first register to it, by going to `theano-users`_).
Windows V1(bigger install, but simpler instruction + try instruction for gpu)
Windows V1(bigger install, but simpler instruction + try instruction for gpu)
----------------------------------------------
----------------------------------------------
1. If you don't have Python yet, I would recommend the Python(x,y)
- If you don't have Python yet, I would recommend the Python(x,y)
distribution. It is only one installation and contains the most
distribution. It is only one installation and contains the most
important packages (NumPy, SciPy, IPython, Matplotlib, Mingw, Nose,
important packages (NumPy, SciPy, IPython, Matplotlib, Mingw, Nose,
etc.).
etc.).
2. Next you should install Mercurial and download Theano.
- Next you should install Mercurial and download Theano.
Command line version: http://mercurial.selenic.com/
Command line version: http://mercurial.selenic.com/
One gui version(Tortoise hg): http://mercurial.selenic.com/downloads/
One gui version(Tortoise hg): http://mercurial.selenic.com/downloads/
the command is
the command is
hg clone http://hg.assembla.com/theano Theano
hg clone http://hg.assembla.com/theano Theano
3. Theano needs 1 environment variable:
- Theano needs 1 environment variable:
a) system variable PYTHONPATH with value C:\...\Theano
a) system variable PYTHONPATH with value C:\...\Theano
(installation folder of theano)
(installation folder of theano)
In the USERPROFILE directory
In the USERPROFILE directory
you should create a configuration file .theanorc with the following
you should create a configuration file .theanorc with the following
two lines:
two lines:
[blas]
[blas]
ldflags =
ldflags =
(Create a text file in Windows Explorer and rename it from the DOS
(Create a text file in Windows Explorer and rename it from the DOS
box: "ren xyz.txt .theanorc".)
box: "ren xyz.txt .theanorc".)
Space or non ascii caracter are not always supported. If that is your case,
Space or non ascii caracter are not always supported. If that is your case,
Set the environment variable 'THEANO_FLAGS' to the value 'blas.ldflags='
Set the environment variable 'THEANO_FLAGS' to the value 'blas.ldflags='
This is enough to run Theano! It will use NumPy for dot products
This is enough to run Theano! It will use NumPy for dot products
which, however, is pretty fast (see below).
which, however, is pretty fast (see below).
4.(Optional) If you want a faster and/or multithreaded BLAS library, you can
- (Optional) If you want a faster and/or multithreaded BLAS library, you can
compile GotoBLAS2. I did not try to compile ATLAS because I read that
compile GotoBLAS2. I did not try to compile ATLAS because I read that
it is slower than Goto and very difficult to compile (especially for
it is slower than Goto and very difficult to compile (especially for
Windows).
Windows).
GotoBLAS can be downloaded after a simple registration (the most
GotoBLAS can be downloaded after a simple registration (the most
recent version is 1.13 right now). To compile it, you need to install
recent version is 1.13 right now). To compile it, you need to install
two more programs: MSYS and Perl (for example ActivePerl). Actually,
two more programs: MSYS and Perl (for example ActivePerl). Actually,
the GotoBLAS makefiles expect a full UNIX environment (like Cygwin)
the GotoBLAS makefiles expect a full UNIX environment (like Cygwin)
but the BLAS compilation seems to work with only MSYS and Perl. The
but the BLAS compilation seems to work with only MSYS and Perl. The
LAPACK compilation fails, but we don't need it anyway.
LAPACK compilation fails, but we don't need it anyway.
Compilation steps:
Compilation steps:
a) Unpack GotoBLAS2 (using 7-zip or the MSYS tar command)
a) Unpack GotoBLAS2 (using 7-zip or the MSYS tar command)
b) open MSYS, change directory to GotoBLAS2 (cd command)
c) type "quickbuild.win32 1>log.txt 2>err.txt"
b) open MSYS, change directory to GotoBLAS2 (cd command)
The compilation takes a few minutes. Afterwards, you will find
lots of error messages in the err.txt file, but you
c) type "quickbuild.win32 1>log.txt 2>err.txt"
should also find a libgoto2.dll file in the exports folder.
The compilation takes a few minutes. Afterwards, you will find
d) Copy libgoto2.dll from the exports folder to mingw\bin and mingw
lots of error messages in the err.txt file, but you
\lib.
should also find a libgoto2.dll file in the exports folder.
e) Modify the .theanorc file: ldflags = -lgoto2
This setting can also be changed in Python for testing purposes:
d) Copy libgoto2.dll from the exports folder to mingw\bin and mingw\lib.
theano.config.blas.ldflags = ...
e) Modify the .theanorc file: ldflags = -lgoto2
4.1(Optional). To test the BLAS performance, you can run the script check_blas.py.
This setting can also be changed in Python for testing purposes:
For comparison I also downloaded and compiled the unoptimized standard
theano.config.blas.ldflags = ...
BLAS. The results were the following (Intel Core2 Duo 1.86 GHz):
Standard BLAS: 166 sec (unoptimized, 1 thread)
- (Optional). To test the BLAS performance, you can run the script check_blas.py.
NumPy: 48 sec (1 thread)
For comparison I also downloaded and compiled the unoptimized standard
Goto2: 16 sec (2 threads)
BLAS. The results were the following (Intel Core2 Duo 1.86 GHz):
Conclusions:
Standard BLAS: 166 sec (unoptimized, 1 thread)
a) The unoptimized standard BLAS is very slow. Don't use it.
NumPy: 48 sec (1 thread)
b) The Windows binaries of NumPy were compiled with ATLAS and are
Goto2: 16 sec (2 threads)
surprisingly fast.
Conclusions:
c) GotoBLAS is even faster, in particular if you have several kernels.
a) The unoptimized standard BLAS is very slow. Don't use it.
b) The Windows binaries of NumPy were compiled with ATLAS and are surprisingly fast.
5(Optional) Gpu on Windows. Not sur it work! Can you report success/error on the `theano-user <http://groups.google.ca/group/theano-users?pli=1>`_ mailing list?
c) GotoBLAS is even faster, in particular if you have several kernels.
Those are indication for 32 bits version of python, the one that come with pythonxy is 32 bits.
- (Optional) Gpu on Windows. Not sur it work! Can you report success/error on the `theano-user <http://groups.google.ca/group/theano-users?pli=1>`_ mailing list?
Install cuda driver(32 bits on 32 bits Windows, idem for 64 bits).
Those are indication for 32 bits version of python, the one that come with pythonxy is 32 bits.
Install cuda toolkit 32 bits(even if you computer is 64 bits, must match the python installation version)
Install cuda sdk 32 bits
Install cuda driver(32 bits on 32 bits Windows, idem for 64 bits).
Test some pre-compiled example of the sdk
Install cuda toolkit 32 bits(even if you computer is 64 bits, must match the python installation version)
Download Visual Studio 2008 Express(free, VS2010 not supported by nvcc 3.1, VS2005, not available for download, but supported by nvcc, the non free version should work too)
Install cuda sdk 32 bits
Follow the instruction in the GettingStartedWindows.pdf file from cuda web site to compile cuda code with VS2008. If that don't work, you won't be able to compile gpu code with theano.
Test some pre-compiled example of the sdk
Download Visual Studio 2008 Express(free, VS2010 not supported by nvcc 3.1, VS2005, not available for download, but supported by nvcc, the non free version should work too)
Put into you PATH environment variable the directory where cl.exe is. In my case it is: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
Follow the instruction in the GettingStartedWindows.pdf file from cuda web site to compile cuda code with VS2008. If that don't work, you won't be able to compile gpu code with theano.
Make sure the theano folder is in your PYTHONPATH environment variable.
Put into you PATH environment variable the directory where cl.exe is. In my case it is: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
Then in theano do: import theano.sandbox.cuda
Make sure the theano folder is in your PYTHONPATH environment variable.
That will print some error if their is an error to compile the first cuda file.
Then in theano do: import theano.sandbox.cuda
Then run the theano cuda test file. In Windows command line (cmd.exe), run the program nosetests inside the theano repository. nosetests is installed by pythonxy.
That will print some error if their is an error to compile the first cuda file.
Then run the theano cuda test file. In Windows command line (cmd.exe), run the program nosetests inside the theano repository. nosetests is installed by pythonxy.
Windows V2(smaller install, but longer instruction)
Windows V2(smaller install, but longer instruction)