Skip to content
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

RNG & seeding #142

Open
kernfel opened this issue Jan 18, 2022 · 4 comments
Open

RNG & seeding #142

kernfel opened this issue Jan 18, 2022 · 4 comments
Labels

Comments

@kernfel
Copy link
Contributor

kernfel commented Jan 18, 2022

I notice that GeNN has RNG capabilities ($(gennrand_uniform) etc.) that are not being used; random number generation is instead done by a support code function (defined in genn_generator.py lines 350~390). I also notice that using seed(...) raises a NotImplementedError when used in conjunction with brian2genn. Three questions:

  1. Are there reasons other than the obvious (brian2genn's implementation predates GeNN's) for the choice of RNG here?
  2. Would it be generally desirable to migrate uses of rand(), randn() in brian2 code to GeNN's builtins?
  3. Is it possible to control seeding in GeNN? GeNN's documentation is a little sparse on details there.

Happy to work on this if it's considered a valuable feature.

@tnowotny
Copy link
Contributor

I think regarding the RNGs it is indeed a case of historic sequence. I see no reason not to use GeNN built-in RNGs. It would likely be more efficient.
As for seeding, it's probably better @neworderofjamie comments.

@neworderofjamie
Copy link
Collaborator

So, Brian2GeNN's RNG functionality predates $(gennrand_XXX) which is why it doesn't use it - fixing this is one of the things we're really hoping to get done in a GSoC project. In GeNN you control seeding via model.setSeed(X) where X=0 indicated that you should randomize the seed every run

@kernfel
Copy link
Contributor Author

kernfel commented Jan 18, 2022

I see. In that case, I'll probably hack something in just to cover my particular case in a draft, and if there's a lot more to do, I'll let the GSoC cavalry clean it up properly.

@tnowotny
Copy link
Contributor

Though we do not know yet whether we will be getting a student for it I am afraid. But we can always clean up ourselves if needed.

This was referenced Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants