Giter Site home page Giter Site logo

Comments (3)

thesamovar avatar thesamovar commented on June 8, 2024

We actually do have a check for potentially undefined behaviour, and emit a warning or error (can't remember which) in that case. I seem to remember in an earlier version of brian2genn we had an explicit check for code of the form neuron_var += synaptic_var that was treated specially. Are we talking about some generalisation of that?

Also, atomicAdd may be very inefficient on medium density synaptic operations (but is good for very low density ones, see mine and Romain's paper on GPU spiking neural networks).

from brian2genn.

tnowotny avatar tnowotny commented on June 8, 2024

This problem arises where the "on_pre" modifies pre-synaptic neuron variables and "on_post" modifies post-synaptic neurons variables (somewhat unusual, the case we covered was "on_pre" changing post-synaptic vars).
This exposes a bit more general problem, where just giving full access to pre- and post-synaptic neuron variables in GeNN can lead to undefined behaviour due to race conditions. If you exclude truly undefined behaviour within Brian, then the expected code should only be +=, *=, -=, /= and equivalent, right? However, I am not sure how one would do a "atomicDivide" ...
As for efficiency: If one wants to allow these manipulations, there is no choice but to use atomic operations I believe.

from brian2genn.

thesamovar avatar thesamovar commented on June 8, 2024

Ah I get you. At a conference at the moment so can't think too deeply about it, so just a couple of points for now.

Yes, I think ultimately you'll only allow += etc. however there could be relatively complex expressions on the RHS of the += so you can't just consider v += w type cases.

There is a way to do atomic divide although I've forgotten how you do it now. There's not a single operation, but I think you can put an atomic lock on a memory location? Something like that anyway.

Do you mean that if you want to allow modifications of both pre AND postsynaptic variables you have to use atomic operations? Because if you're just going in one direction there's all sorts of tricks, right? (I guess probably GeNN is using some of them, and NeMo uses a whole lot of tricks for sparse propagation.)

from brian2genn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.