-
Notifications
You must be signed in to change notification settings - Fork 0
Running NuPIC on Windows
- Microsoft Visual Studio 2012
- [CMake](2.8 http://www.cmake.org/files/v2.8/cmake-2.8.11.2-win32-x86.exe)
- Python 2.7.5 32bit ("install just for me" option)*:
PYTHONPATH = path where python is: C:\Python27\Lib
PYTHONHOME = path where python is: C:\Python27
NTA_ROOTDIR = path the project is installed: %USERPROFILE%\nta\eng
-
Numpy 1.7.1 32bit (install in same folder that Python)
- Tip: copy to root and not ProgramFiles (found error probally due to spaces) and include in PATH env variable on Windows.
Remove in NTA_CXXFLAGS_BASE variable (CMakeLists.txt top file): -Wreturn-type -Wunused-variable -Wno-deprecated
-Include a new folder for Win32 based on: /nupic-master/external/Darwin64 => /nupic-master/external/win32
(If you want I have the Win32 folder with need libraries (apr, zlib, etc) ported to Windows)
include in /nupic-master/nta/engine/network.cpp /nupic-master/nta/utils/Ramdom.hpp /nupic-master/nta/algorithms/unittests/NearestNeighborUnitTest.cpp:
#ifdef _MSC_VER #undef min #undef max #endif
('max' and 'min' are macros already defined by MSVC which create conflits with Nupic code)
in /nupic-master/nta/engine/UniformLinkPolicy.cpp
replace:
return std::make_pair<Fraction, Fraction>(lowerIndex, upperIndex);
to:
return std::make_pair(lowerIndex, upperIndex);
(c++11 deduces the data type, thus it emit error when find explicit declaration)
in /nupic-master/nta/types/Fraction.cpp
replace:
std::swap<int>(numerator_, denominator_);
to:
std::swap(numerator_, denominator_);
(c++11 deduces the data type, thus it emit error when find explicit declaration)
in /nupic-master/nta/ntypes/Buffer.hpp
replace:
size = r->memStream_.readsome(bytes, size);
to:
#ifdef _MSC_VER
size = r->memStream_._Readsome_s(bytes, size, (std::streamsize)size);
#else
size = r->memStream_.readsome(bytes, size);
#endif
in /nupic-master/nta/os/env.cpp
replace:
#if defined(NTA_PLATFORM_darwin64) || defined(NTA_PLATFORM_darwin86)
#include <crt_externs.h>
#else
extern char **_environ;
#endif
to:
#if !defined(_MSC_VER)
#if defined(NTA_PLATFORM_darwin64) || defined(NTA_PLATFORM_darwin86)
#include <crt_externs.h>
#else
extern char **_environ;
#endif
#endif
in /nupic-master/nta/algorithms/bit_history.cpp
replace:
if (denom < 0.00001 or dcNew > DUTY_CYCLE_UPDATE_INTERVAL)
to:
if (denom < 0.00001 || dcNew > DUTY_CYCLE_UPDATE_INTERVAL)
(i.e. change "or" to "||")
in /nupic-master/nta/os/Directory.cpp
replace stuff like this:
wcwd
wpath.c_str()
to:
LPSTR(wcwd)
LPCSTR(wpath.c_str())
(Error messages will be help to find more of this problem)
In /nupic-master/external/common/include/boost/throw_exception.hpp:
replace:
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
#else
to:
#undef BOOST_NO_EXCEPTIONS
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
#else
in /nupic-master/nta/os/OS.cpp
replace:
#elif NTA_PLATFORM_win32
//We only run on XP/2003 and above
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#include <psapi.h>
#endif
to:
#elif NTA_PLATFORM_win32
//We only run on XP/2003 and above
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#include <psapi.h>
#pragma comment(lib, "psapi.lib")
#endif
(i.e. add #pragma to "psapi.lib")
in /nupic-master/nta/engine/RegionImplFactory.cpp
#elif defined(NTA_PLATFORM_win32)
const char * filename = "cpp_region.dll";
#endif
to:
#elif defined(NTA_PLATFORM_win32)
const char * filename = "libcpp_region.dll";
#endif
(CMake generates same prefix to both Unix and Win32 libraries)
in any file where you found:
#include <unistd.h>
replace to:
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
in any file where you found env::get to get environment paths replace the path separator like this:
found = Env::get("HOMEPATH", homePath);
std::replace(homePath.begin(), homePath.end(), '\\', '/');
in C:/Python2.7/include/pyconfig.h
replace:
pragma comment(lib,"python27_d.lib")
to:
pragma comment(lib,"python27.lib")
("python27_d.lib" is a library used for debug in Python)
and delete or hide PY_DEBUG directive: #ifdef _DEBUG //# define Py_DEBUG #endif
When generate choose Visual Studio 11 (i.e. 2012)