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

consistent mechanism ids #2057

Merged
merged 2 commits into from
Dec 14, 2022
Merged

consistent mechanism ids #2057

merged 2 commits into from
Dec 14, 2022

Conversation

boeschf
Copy link
Contributor

@boeschf boeschf commented Dec 6, 2022

Mechanism ids are assigned by iterating through an unordered map within fvm_mechanism_data. This is sub-optimal as the ids depend on implementation defined behaviour. In particular, the ids are not consistent between libc++ and libstdc++. The ids, however, are part of the key used to produce unique random values for solving SDEs, and thus, we get different random values with different OSs/different standard libraries even when using the same global seed value. In order to achieve reproducible results, I propose to change the container in question to a ordered std::map.

@thorstenhater
Copy link
Contributor

Yes, please. But, we are using a map of unsigned to mechanism which is built linearly. How about using a vector?
Then, we should have this layout:

std::vector<mechanism> mechanisms_;
std::vector<std::size_t> revpot_mechs_;
// more index maps for different kinds.

That should enable patterns like

  • initialising all mechanisms
  • compute current for a single kind
  • etc

What do you think.

@boeschf
Copy link
Contributor Author

boeschf commented Dec 6, 2022

that sounds interesting. I'll experiment and may extend the PR.

@brenthuisman brenthuisman merged commit c080047 into arbor-sim:master Dec 14, 2022
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

Successfully merging this pull request may close these issues.

3 participants