A. Requirements
Torch compilation requires a number of standard packages described below:
C/C++
compiler
CMake
Concerning the compiler, if you do not have already Visual Studio, then install the freely available Microsoft Visual Studio 2008 (Express Edition). You need the C++ compiler.
Download the CMake Win32 installer and install CMake.
Install Tortoise SVN.
If you want graphics, you should install QT 4.4. Torch will compile if you do not, but you will not be able to produce plots or handle widgets. Trolltech produces QT binaries for Windows, but unfortunately they are not compiled with the Microsoft Visual Studio compiler. You will have to follow simple instructions to compile and install it.
B. Getting Torch sources
You can download the last tarball sources and unpack it using for e.g. Winzip.
However, we recommend to use the subversion repository to keep bleeding edge sources. Start TortoiseSVN
for that purpose: right-click in the explorer at the place you want to checkout Torch repository. Choose
TortoiseSVN -> Export ...
. Then enter as URL
https://torch5.svn.sourceforge.net/svnroot/torch5/trunkChoose the directory you want for Torch sources, and click
Ok
.
C. Configuring Torch
We use CMake
for configuring Torch
. Start CMake application. Set the
source path to the directory where you downloaded Torch. Set as a build
path another directory you like. This eases cleaning up built objects,
but also allow you to build Torch with various configurations
(e.g. Release and Debug in two different build directories).
Click Configure
, choose Visual Studio 9 2008
if you downloaded the last
version of Visual Studio (if not, select the compiler version you have).
Make sure you chose the Release
and not Debug
version (well, except if
you want the Debug version!) to compile (Variable CMAKE_BUILD_TYPE
).
Also, if you do not have the administrator rights, you might not be able to
install Torch in the directory set in variable CMAKE_INSTALL_PREFIX
which
is by default C:/Program Files/Torch
. Change the variable to the install
path you would like.
Click Configure
until Generate
is clickable. Click Generate
.
Please, see CMake documentation or at least some of our CMake hints for more details on configuration.
D. Compiling and installing
If CMake configuration went fine, a Visual Studio project should have been generated in your
build directory. Double-click the project. Build the solution. If everything went fine, you
can then install it by building the target INSTALL
.
D. Running Torch
Now Torch should be installed. If you did not changed
CMAKE_INSTALL_PREFIX
, it should be in C:/Program Files/Torch
. Lua
executables (lua
and qlua
) are found in the bin
sub-directory of these
installation directories. Start lua
by double-clicking it, and try it
out!
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio > require 'torch' > = torch.Tensor(5):zero() 0 0 0 0 0 [torch.Tensor of dimension 5] >The executable
lua
is a simple Lua interpreter (as provided on
Lua website), while qlua
has enhanced
interactivity (like completion) and is able to handle graphics and QT
widgets.