Brian2 and Spinnaker

112 views
Skip to first unread message

Le Zhu

unread,
Jul 3, 2020, 2:42:28 AM7/3/20
to SpiNNaker Users Group
Hi,

I have recently finished my implementation of Spiking Neural Network with STDP learning in Brian2. Unfortunately, the speed of the simulation is far behind real-time. 

Now I am just started trying using Spinnaker through HBP could platform. I can see there are instructions using PyNN. Just wondering is there a quick way to directly run my Brian2 coded network with minimal changes?

best,
Luke

Andrew Gait

unread,
Jul 3, 2020, 5:10:13 AM7/3/20
to SpiNNaker Users Group
Hi Luke,

It depends exactly how you've written your Brian2 coded network - I suspect you have written it using Brian2's terminology, since I'm not sure Brian2 works with PyNN yet... 

If however you've used PyNN terminology (e.g. Population, Projection, and so on) then it could be as simple as switching the simulator to pyNN.SpiNNaker rather than pyNN.Brian, but the easiest way we can help you is if you send us your current script and we can advise as to what else you might need to do.  It will likely boil down to working out the correspondence between PyNN objects and Brian2 objects...

Andy

----------------------------------------------------
Dr. Andrew Gait,
Research Software Engineer,
APT Group,
School of Computer Science,
The University of Manchester,
Oxford Road, Manchester M13 9PL

email: andre...@manchester.ac.uk
web: http://personalpages.manchester.ac.uk/staff/Andrew.Gait/

From: spinnak...@googlegroups.com <spinnak...@googlegroups.com> on behalf of Le Zhu <luke....@gmail.com>
Sent: 02 July 2020 21:46
To: SpiNNaker Users Group <spinnak...@googlegroups.com>
Subject: [SpiNNaker Mailing List] Brian2 and Spinnaker
 
--
You received this message because you are subscribed to the Google Groups "SpiNNaker Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spinnakeruser...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/spinnakerusers/7bd8ff59-361e-467c-9ec9-befd1347e6afn%40googlegroups.com.

Andrew Gait

unread,
Jul 6, 2020, 4:51:31 AM7/6/20
to SpiNNaker Users Group
Just realised this conversation got away from the users group... bringing it back to it at this point.

Hi Luke,

Your script refers to things which don't appear to be directly in Brian2 or in what you sent me, specifically "PN2EN" and "MB_LE".  Are these (related to) classes you've defined somewhere else?

Andy

----------------------------------------------------
Dr. Andrew Gait,
Research Software Engineer,
APT Group,
School of Computer Science,
The University of Manchester,
Oxford Road, Manchester M13 9PL

email: andre...@manchester.ac.uk
web: http://personalpages.manchester.ac.uk/staff/Andrew.Gait/

From: Le Zhu <luke....@gmail.com>
Sent: 05 July 2020 23:19
To: Andrew Gait <Andre...@manchester.ac.uk>
Subject: Re: [SpiNNaker Mailing List] Brian2 and Spinnaker
 
Hi Andy,

I have attached the Zip file containing my data, network class and test function
. Sorry, I don't have detailed comments within the code script, hope it won't be too annoying to read through.

Best,
Le

Andrew Gait <Andre...@manchester.ac.uk> 于2020年7月3日周五 下午2:15写道:
Hi Luke - sorry, our new university mail server doesn't like .py files, so it won't let me open what you've sent.  I think the easiest way round it is to make a zip archive containing your file (perhaps you could include the testing function as well) and then email that.

Andy

----------------------------------------------------
Dr. Andrew Gait,
Research Software Engineer,
APT Group,
School of Computer Science,
The University of Manchester,
Oxford Road, Manchester M13 9PL

email: andre...@manchester.ac.uk
web: http://personalpages.manchester.ac.uk/staff/Andrew.Gait/

From: Le Zhu <luke....@gmail.com>
Sent: 03 July 2020 12:24
To: Andrew Gait <Andre...@manchester.ac.uk>
Subject: Re: [SpiNNaker Mailing List] Brian2 and Spinnaker
 
Hi Andrew,

Thanks for your reply.

I have attached my code script. This is the network class without testing function. As you can see I used the Brian2 terminology. I only found this Git https://github.com/brian-team/brian2spinnaker might be something helpful, but I haven't figured out yet how to transfer my code using 'Brian2spinnaker'.

best,
Luke

Andrew Gait <Andre...@manchester.ac.uk> 于2020年7月3日周五 上午10:10写道:
You received this message because you are subscribed to a topic in the Google Groups "SpiNNaker Users Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spinnakerusers/uGeghHXnIak/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spinnakeruser...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/spinnakerusers/HE1PR01MB37886F1396BBC736F3352E02C46A0%40HE1PR01MB3788.eurprd01.prod.exchangelabs.com.

Andrew Gait

unread,
Jul 7, 2020, 4:58:37 AM7/7/20
to Le Zhu, SpiNNaker Users Group
Hi Luke,

Looking through this, I think in the first instance what you need to try to do is convert your Brian2 script into PyNN - so, for example, "NeuronGroup" becomes "Population", "Synapses" becomes "Projection", and recording is done at the population level, so once you've defined a population, you do pop.record('v') or pop.record('spikes') as required.  A look at the PyNN documentation [http://neuralensemble.org/docs/PyNN/index.html] on each of these should tell you which objects you need to pass into each of them - glancing over your code suggests (I think) that you have all the details already, so you just need to work out how to pass them in to the PyNN objects.  Within each Projection you'll also need to define a connector that tells you how the two populations are connected to each other (e.g. OneToOne, AllToAll, FromList, etc. - there's a list of what's available there on the PyNN site).

Another consideration you need to take into account is the neuron models you're using as well - your "EN" model, being a LIF neuron model, should be easily portable to SpiNNaker; I am less sure about your "PN" and "KC" models as they appear to involve adaptive thresholding (are they adaptive exponential integrate and fire neurons?), which we do not currently have on SpiNNaker due to various reasons [anyone else: are we still looking into this at the moment, or are we waiting for SpiNNaker-2?], and so you would have to consider changing to a different standard neuron model to approximate this model, or we do incorporate the capability for you to write your own model via a new model template.  Our thoughts on adaptive exponential at the moment are that it's only possible to accurately do this model using floats, and these are not available on SpiNNaker hardware (only software), and therefore there may be issues with running in real-time (but, it might be possible to run at a slow-down which is still overall better than Brian2 can currently manage).

[If you reply to this email can you make sure it goes to the group mailing list rather than just to me, as there may be other people who are interested in joining in with the conversation - thanks.]

Andy
 
----------------------------------------------------
Dr. Andrew Gait,
Research Software Engineer,
APT Group,
School of Computer Science,
The University of Manchester,
Oxford Road, Manchester M13 9PL

email: andre...@manchester.ac.uk
web: http://personalpages.manchester.ac.uk/staff/Andrew.Gait/

From: Le Zhu <luke....@gmail.com>
Sent: 06 July 2020 17:28

To: Andrew Gait <Andre...@manchester.ac.uk>
Subject: Re: [SpiNNaker Mailing List] Brian2 and Spinnaker
 
Hi,

I just added the missing script 'PN2EN' in which I defined the class 'MB_LE' using Brian2 terminology.

best wishes,
Luke

Andrew Gait <Andre...@manchester.ac.uk> 于2020年7月6日周一 上午9:51写道:
Reply all
Reply to author
Forward
0 new messages