I thought I'd write down my notes of what I did to get Torch compiling on Windows. Hopefully this can be of use to others. The information is out there, so this sort of cobbles together what I've found from various different sources.
Note, I'm still having trouble getting cunn to work in Windows, so if anyone has solved this, please reply below.
For most of these steps, I recommend using the Visual Studio Command Prompt as it will have the environment variables set up to use msbuild properly that
the normal command prompt won't. For VS2013, this can be found here by default:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
You will be downloading a number of Git repositories to compile them correctly for Windows or to fix issues before they can compile.
I've found it easiest to do this in one location. I'll put these in a location callled C:\TorchDownloads\, feel free to use whatever directory
into the #else block right above it in both files
Now Change directory into the luaffifb directory and type:
c:\TorchDownloads\luaffifb>..\..\Torch\luarocks make luaffi-scm-1.rockspec
And this will compile and install the rockspec that the repository has with the changes we have made. It is important that you run this
on the repository's rockspec, and not the one we downloaded with luarocks, as one will build from the local source, and the other will get
At this point luaffi should be installed.
Go back to C:\Torch and type
I have attached a BasicNN.lua that is derived from here:
However, the problem you are going to have is that the binaries that it wants to download will not load in Windows. I was lucky and able to do this on a Unix machine, the save them as ascii, and load the ascii versions on Windows. Each file is about 30MB, so I can't upload it to the thread.
If you do manage to get a txt version of those files, you'll also need to go here:
C:\Torch\lua\nn\init.lua
and comment out the line
require('nn.test')
As this version of Torch is missing TestSuite.
to comment it out.
If you have all three files, you can run the BasicNN.lua like:
C:\Torch>luajit basicNN.lua
At this point, you should be able to take this basicNN.lua and be able to run it in a non-cuda powered mode in Windows by typing
c:\Torch>luajit basicNN.lua
What the NN is doing is taking a small image database, classifying it into 10 categories (horse, car, dog, truck, etc...), and then given
an image tells you what it thinks it is. Much more impressive with images turned on, but as a quick gut check fully formed NN, it works
for our purposes.
Hopefully this is useful to someone. The information is out there, but I found it was sort of scattered, so I'm trying to condense it in one spot here. If this is useful, I'll try to keep it updated as I figure out how to get CUDA working and get closer to main line.