SpiNNakerManchester / sPyNNaker

The SpiNNaker implementation of the PyNN neural networking language
Apache License 2.0
100 stars 42 forks source link

Allow weights to be read during simulation #1012

Open rowleya opened 3 years ago

rowleya commented 3 years ago

In the current code, it is possible only to read the weights once the simulation is completed. This is due to a check in Projection that the simulation "has_run". If the read is done between calling run and before the run has finished (this is particularly possible when run_forever has been called and another thread does the reading), the weights will not ever be read because of this check. It should instead check somehow that the weights have been generated already, and if so, read them straight from the machine.

andrewgait commented 3 years ago

I can see such a call necessarily having to have two different results depending on whether a simulation has started on the machine (which is different from having called run(..)), as it's only at that point that I think you can guarantee the weights will be available. I suppose if you know that weights have been generated using the synapse expander then that could be another point where weights might be readable. (Ignoring for now cases which use STDP, of course...)

I presume this is in some way related to the NRP? Do we have an example script available to us?

rowleya commented 3 years ago

It was on the NRP, although we since have a "workaround" (probably the better solution really if we want it to be faster) of sending spikes through the connection and then looking at the result in terms of spikes or membrane voltage, so no example script exists. An example would have to use something like "run_forever" and then in a separate thread after it is guaranteed that the run has started (through a callback maybe), read the synapses.