Open breznak opened 9 years ago
@breznak C run-time library incompatibilities are likely to still exist, as they do with NuPIC currently. I've been looking at CPython 3.5, but aware of issues relating to a move to 3.x Scott and I are due to discuss NuPIC Windows port this week, a tricky task that may not be possible until 3.x move.
The Windows binaries were built with Microsoft Visual Studio 2015 https://www.python.org/downloads/release/python-350a1/
https://hg.python.org/cpython/file/default/PCbuild/readme.txt
to discuss NuPIC Windows port this week, a tricky task that may not be possible until 3.x move
:confounded:
These days I'm making several benchmarks to test some old proposals to improve nupic (OO approach, alternative compilers, etc). One of this is test that proposal related to use pypy
as main compiler instead CPython. The fact that I got (very) excellent performance results to a (very) low price: only 1 or 2 lines in SpatialPooler need be refactored due to a numpy function not ported to pypy (yet). I still didn't test TemporalMemory with pypy but I'm pretty sure that probably few or no lines will need be changed.
I'll ellaborate a benchmark more complete these days and present a report with results and potential drawbacks to you check the feasibility.
To reinforce the gain with PyPy, look this 2011 article where PyPy beats even C! http://morepypy.blogspot.com.br/2011/08/pypy-is-faster-than-c-again-string.html
@david-ragazzi - Do you have an issue for tracking the pypy effort? It would be great to see the SP benchmark and results you describe (comparison of Python, Pypy, and C++) but this issue is for Cython (alternative to SWIG).
@breznak - The primary reason for SWIG is to make it easy to support other languages in the future. That said, I'd be curious to know if Cython provides some other benefits. When you say speed ups from Cython, are you talking about its ability to translate Python to C code? I believe that requires the code to be written specifically for Cython (with type hints).
@david-ragazzi - Do you have an issue for tracking the pypy effort? It would be great to see the SP benchmark and results you describe (comparison of Python, Pypy, and C++) but this issue is for Cython (alternative to SWIG).
I re-open this: https://github.com/numenta/nupic/issues/1728
For reference; https://github.com/cython/cython/wiki/CythonExtensionsOnWindows http://stackoverflow.com/questions/3047542/building-lxml-for-python-2-7-on-windows?lq=1 (potential to link to older CRT?)
I know Numenta was running NuPIC with
cython
as an interpreter in the past, what is your current experience with it, @rhyolight @oxtopus ?I tried a simple demo in https://github.com/numenta/nupic/compare/master...breznak:cythonize?expand=1 In some cases (SP) it was even slower than pure PY, somewhere slightly faster (ScalarEncoder), and way slower than orig C++.
I would still consider
cython
for speedups(?) in the code not yet ported to C++, and also as a way to run under C++ only - examples are encoders, anomaly code, ... @rcrowder - Do you think the (de)generated c++ from cython would compile under Windows?If it proves to make sense, it would be nice to add a
cython
as a target insetup.py
so we can compile with it, something as http://docs.cython.org/src/quickstart/build.html#building-a-cython-module-using-distutils @david-ragazzi ?