Windows support #1

wants to merge 5 commits into from

4 participants


This branch allows Torch 7 to be built on Windows with icc, and adds timer support. To compile:

  • Install intel's compiler (msvc doesn't support c99)
  • Launch cmake-gui
  • Set CMAKE_C_FLAGS and CMAKE_CXX_FLAGS to "/Qopenmp /Qstd=c99"
  • Generate
  • Open Torch.sln
  • Right-click the solution in the solution explorer, click Intel C++ Compiler Pro, click Use Intel C++
  • Build the solution
  • Build the INSTALL target

Some remaining warnings:

warning #63: shift count is too large, libraries\TH\generic/THTensorRandom.c:20
warning #264: floating-point value does not fit in required floating-point type, packages\nn\generic/TemporalLogSoftMax.c:19

pflaquerre added some commits Oct 13, 2011
@pflaquerre pflaquerre Non-MSVC compiler support on Windows
_MSC_VER is only defined when compiling with msc. In order to be able to
compile properly with other compilers, I've changed these checks to
_WIN32 instead, which should be defined in all cases. MSC can't compile
torch right now in any case since it doesn't support C99.
@pflaquerre pflaquerre Use _{pclose,popen,snprintf} on Windows. d156c41
@pflaquerre pflaquerre Make lab compile on windows with icc.
icc was picking up generic/lab.c even though CMakeLists.txt pointed to
the contrary. Renaming to lab.h (which makes more sense anyhow)
fixed it. I also moved the externs out into a proper header file.
@pflaquerre pflaquerre Add missing dllexport for Windows. 4afd883
@pflaquerre pflaquerre Add Windows support for timers. e784882

I started trying to build Torch7 with MSVC 2008 on Windows 7 after reading that "Torch7 is mainly made out of ANSI C and Lua, which makes it easy to compile everywhere" and before reading, a little lower in the manual, that Windows is not currently supported. I thought I'd just record here that a few times in the build steps starting with "C_HAS_SSE" (e.g., C_HAS_SSE1_1, etc.), MSVC complained that the source code it was compiling had an error, that a variable b was being used before it was initialized. I was able to "Ignore" these errors and the build process continued.

Then the build process quit because READLINE_INCLUDE_DIR is not defined (although the README specifies this as an optional requirement). I will try installing readline via GnuWin32 and update, but just wanted to post my results from tonight.


@fasiha, have you managed eventually to build Torch7 under Windows?
If so, do you have any note to share with other people? We would really appreciate it.

@soumith soumith closed this Feb 9, 2015

Just a note for future reference.
There Torch binaries available for Windows and there is no plan to keep updating them. Further information can be found on the Torch's Google Group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment