Comments (4)
Copied relevant part for source
mode optimization from my comment in #12:
No serializing needed for no_or_const_delay_mode
when presynaptic variables are modified
In no_or_const_delay_mode
we don't need to serialize when the on_pre
pathway modifies presynaptic neuron variables as long as we loop through the spikespace (as we are currently doing), since we only apply synaptic effects for a single spiking neuron at a time. Currently this would get us in our 'pre'
serializing mode (only a single thread does everything). So whenever we get into our 'pre'
mode, we only need to modify a single presynaptic neurons state variables, so all we need to do, is to make sure that only a single thread does that. E.g. adding something like
if (tid==0 && bid==0)
// presynaptic code
// postsynaptic code (one thread one postsynaptic neuron)
This would mean that in no_or_const_delay_mode
we could - while applying postsynaptic effects in parallel anyways - also modify presynaptic ones on the fly (and synaptic variables also of course). Assuming only one synapse per pre/post neuron.
EDIT: In the 'pre'
mode (now called 'source'
mode) the presynaptic code has to be applied once per synapse. Therefore in aboves snippet thread 0 of block 0 would loop through all synapses and each time apply the same effect to the same source neuron. But maybe we could simplify this by just multiplying the effect times the number of synapses. We would have to catch different effect cases though: additive effects (instead of adding N
times +v
, do once +N*v
); multiplicative effects (instead of N
times *M
, do once *(M^N)
); setting a variable to a constant (which we would only need to apply once).
EDIT 2: We can only aggregate the effect if it does not depend on a postsynaptic variable. If it does, we are back to serializing. But maybe instead of having one thread load postsynaptic variables serialized, we could have multiple threads do coalesced memory reads and then let just one thread at the time apply the presynaptic effect, e.g. (needs profiling)
for (i=0; i<num_synapses; i++)
if (tid == i)
// apply presynaptic effect
from brian2cuda.
Came across an example using STDP with neuronal trace, which results in source
mode pathways. So this can be relevant. @moritzaugustin
from brian2cuda.
good point
let's plan this for the release sprint (at least via atomics should not be too hard)
from brian2cuda.
Additional comment for my pre serialization comment above:
For the case where a source
update depends on target
state variables, my comment states that we need to serialize the summation of the postsynaptic variables. Instead, we could also use some reduction scheme, which can be easily performed via thrust::reduce
, which can now be called form device code using dynamic parallelism. This could maybe even be performed concurrently while other stateupdated (from target or synapse variables) are performed and only in the end of the kernel one source variable update is performed.
from brian2cuda.
Related Issues (20)
- Call reset kernel only with as many threads as there are spiking neurons (not as there are neurons in total)
- Refactor benchmarking scripts and update generated plots
- Check if storing the size of synapse groups is necessary? HOT 1
- Needs patch to run with Brian 2.4.2 HOT 2
- Optimize `StateMonitor`
- Impelement brian2cuda preference file support
- Copy all eventspace counters to host efficiently at each time step
- Investigate and document performance effects when working with `Subgroup`s HOT 1
- Consider partitioning eventspaces when using `Subgroup`s HOT 4
- Optimize `PopulationRateMonitor`
- Fix `SpikeMonitor` for `Subgroup`s HOT 1
- Optimize our `SpikeMonitor` for `Subgroups`
- Refactor test suite scripts
- Fix `ReferencError` in spatialneuron tests HOT 3
- Fix memory leak when having multiple `run` calls
- Spikes are lost when changing delays between `run` calls HOT 3
- Recent Brian2 update PR broke benchmark scripts HOT 1
- Brian2Cuda Uninstalls Brian2 2.5.1 and Installs 2.4.2 Which Won't Import HOT 3
- Brian2Hears and Brian2CUDA HOT 3
- Optimise brian2CUDA HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brian2cuda.