brian-team / brian2

Brian is a free, open source simulator for spiking neural networks.
http://briansimulator.org
Other
901 stars 216 forks source link

numba codegen #179

Open thesamovar opened 10 years ago

thesamovar commented 9 years ago

I've just been playing around with numba for another project and it's really good. Since it is apparently also working on Python 3, I wonder if it would be worth dropping Cython support and using numba instead.

mstimberg commented 9 years ago

I agree that could be a good long-term solution. For now, I don't think we should not put any effort into this, since we have working Cython codegeneration and replacing it by numba won't immediately gain us anything. There's still plenty of other stuff to do :)

thesamovar commented 9 years ago

Fair point. Let's revisit it if we find ourselves putting more than a trivial amount of additional work into Cython!

thesamovar commented 9 years ago

One reason for increasing the priority of the numba implementation is that it would make installation much easier for Windows 64 bit users (which is an increasing fraction of users). They would simply need to install Anaconda and then pip install brian2 and it would work.

thesamovar commented 9 years ago

If we also had SpikeQueue in numba this would entirely eliminate the need for a compiler!

mstimberg commented 9 years ago

If we also had SpikeQueue in numba this would entirely eliminate the need for a compiler!

We are already independent of a compiler, we have a Python spike queue and the numpy target :)

I still think that we have other things to take care of first, for me this remains rather a post 2.0 feature. I agree that we have to make installation easier, though. The problem I'm having with numba is that it only helps for the runtime mode, and there we usually only get something like a factor of 2 speed-up over numpy. For the standalone mode, users will still need a proper C compiler and this is where you can get really order-of-magnitude speed improvements.

This should be on its own issue, but what about looking into support for mingw (in principle this should work with weave, cython and standalone)? A big advantage of mingw over msvc is that it can be directly installed from anaconda. If this actually works out-of-the-box in anaconda with weave and cython (on 32-bit and 64-bit), then I think this would be the ideal solution. We could then have very simple installation instructions based on anaconda (even easier if we get around creating a conda package for Brian) for all operating systems.

mstimberg commented 9 years ago

Um, I looked a bit into it, unfortunately mingw does not really seem to be an option, at least according to https://github.com/cython/cython/wiki/CythonExtensionsOnWindows

We should try to make our installation instructions for Windows a bit clearer, though, and if I understood correctly, it is now simpler because Microsoft published the "C++ compiler for Python 2.7" which can be used as a replacement for the SDK and does not need the patch anymore: http://www.microsoft.com/en-us/download/details.aspx?id=44266

thesamovar commented 9 years ago

Yeah I would have loved to have used mingw but it seems the 64 bit version is pretty hopeless for the moment. I haven't tried the C++ compiler for Python 2.7 but if it really works without patching on 64 bit Windows that would be fantastic. I'll make an issue for this, but it needs testing on a fresh Windows without another version of VC installed.