brian-team / brian2cuda

A brian2 extension to simulate spiking neural networks on GPUs
https://brian2cuda.readthedocs.io/
GNU General Public License v3.0
60 stars 12 forks source link

Parallelize synapse creation #177

Open denisalevi opened 4 years ago

denisalevi commented 4 years ago

Our synapse generation uses the exact same algorithm as cpp_standalone, all running on the host. Since synapse creation only happens ones before the network is run, it doesn't matter much for most networks. But for large networks, synapse creation can take some time. And the cleaner solution would be to generate synapses directly on the device, parallelize the algorithm (if that is possible, need to check the implementation) and at the same time avoid some of the unnecessary host/device/host copying that is happening.

See also #88 for another slow synapse generation issue.

If we used device side synapse generation, we could get rid of the host side random number buffer (in brianlib/curand_buffer.h) and use a device side buffer (which we could then also use for our binomial function implementation) or use the curand device side API for on-the-fly RNG.

denisalevi commented 2 years ago

Definitely take into account synapse sorting during synapse generation. See my last comment in #32