-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-synapse RNGs #497
Comments
Ahh, I had forgotten about this....GeNN doesn't currently support random number generation in any type of per-synapse code (proper error handling to report this in the The less performant and easy alternatives would be:
What does Brian2GeNN currently do by the way? |
I think non-reproducible runs are acceptable but if possible we should attach some warnings about it in several places. Even without the explicit breakage the RNG issue implemented with one RNG per thread will introduce, in more subtle cases the reproducibility is already broken simply by spikes being processed in unpredictable order. |
Brian2GeNN currently uses a dedicated RNG per synapse: for (unsigned int j = 0; j < numSpikesInBlock; j++) {
// only work on existing neurons
if (lid < group->rowStride) {
using namespace PresynapticUpdateSupportCode0;
const unsigned int synAddress = (shSpk[j] * group->rowStride) + lid;
const unsigned int npost = shRowLength[j];
if (lid < npost) {
const unsigned int ipost = group->ind[synAddress];
shLg[ipost] += (int(group->not_refractoryPost[ipost]) * _rand(group->_seed[synAddress]));}
}
} However, the RNG state here is a single uint64, so considerably lighter than cuRAND. I guess Brian users who absolutely need reproducibility always have the deterministic, single-threaded backends to fall back to, but on the other hand, I can just keep synaptic random number generation on the old RNG to avoid any arguments for now. We can always re-address this if/when you decide to explicitly support synaptic RNG in GeNN. |
It would definitely be a good start to switch over the neuron RPGs. I will try and implement the synaptic RNGs relatively soon though. I vaguely remember there being another issue with Brian requiring an implementation of the Binomial distribution...Is that still true? |
Yeah, that's right. PoissonInput objects need this; it's currently implemented in support code, so I can't easily port it to the GeNN RNG either. |
Give me a second - I'll just try and rebase my last attempt two years forward 😨 |
No need to hurry. The model that gave the initial impetus for this effort is covered with just the per-neuron RNGs. Everything else is nice-to-have, takes work away from any potential GSoC students ;) |
No worries - reducing the number of excess branches is always a good thing. Have a go with #498 |
Ok, folks, have run into this issue independently doing my own naive thing in pyGeNN. Maybe, when time allows, doing the per-thread RNG would still be a good thing? |
Working on brian-team/brian2genn#142, I noticed that not all instances of $(gennrand_**) are fully translated. I understand that translation is omitted entirely in support code snippets, which I guess may have to do with ambiguity about whether it runs on host or device. However, translation is awkwardly partial in the following case, where it seems like it should be fully supported.
Brian2 code, from a failing test:
Brian2GeNN translation into GeNN code, cutting to the relevant chunk:
GeNN fails during compilation as follows:
... and finally, the offending line in context:
Note, this is not an urgent issue on my end, my immediate use case is covered.
The text was updated successfully, but these errors were encountered: