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

Random number generators #408

Open
Helveg opened this issue Mar 30, 2022 · 2 comments
Open

Random number generators #408

Helveg opened this issue Mar 30, 2022 · 2 comments

Comments

@Helveg
Copy link
Contributor

Helveg commented Mar 30, 2022

Sooner or later I'll have to submit to the numbercrunchers and accomodate finer control over the used RNG.

Simple implementation: Add a new root config dict rng to the config tree that can contain dynamic RNG definitions:

  • type: default numpy, but also plugins like the simulators could add extra RNG types to control RNG inside of the simulators.

Then the dynamic numpy RNG contains 2 attributes:

  • generator: default default_rng, otherwise the name of the BitGenerator class.
  • seed: default None or a seed sequence.

We add a function get_rng to the Scaffold class, which returns the singletons for each configured node, where:

def get_rng(self, node="bsb"):
  if node == "bsb":
    return self.rng.get(node, RandomGeneratorNode())
  else:
    return self.rng[node]
@Helveg
Copy link
Contributor Author

Helveg commented Mar 19, 2024

Related: #183 , #759

@Helveg
Copy link
Contributor Author

Helveg commented Mar 19, 2024

Example configuration:

rng:
  bsb: {}
  numpy:
    generator: Mersenne
  nest:
    master_seed: 1234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant