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

Refactor thermostat infrastructure #3888

Merged
merged 22 commits into from
Sep 18, 2020

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Sep 8, 2020

Description of changes:

fweik and others added 11 commits September 3, 2020 19:37
In the previous implementation, thermostat noise for different seeds
was correlated, the seed just shifted the sequence. For example with
seed offset X, the cross-correlation used to have a peak at lag X.

Co-authored-by: Jean-Noël Grad <[email protected]>
The SD external library uses Philox internally for both the CPU and
GPU implementations. SD now uses the global counter instead of the
simulation time divided by the time step, which are both mutable
and can lead to correlated sequences when changed by the user.
Remove overhead from the std::function wrapper and heap allocation.
Reduce sample sizes and increase tolerances.
Header file thermostat.hpp no longer includes integrate.hpp.
Use vector operations, expressive variable names, documented macros.
Call the thermostat methods directly. We only need free functions
for MPI callbacks.
@jngrad jngrad force-pushed the thermostats-correlation branch from b81ebc2 to 5428fca Compare September 8, 2020 20:35
@KaiSzuttor
Copy link
Member

I think we already discussed that we do not want to have one counter per thermostat. Let's please first discuss and then implement.

@jngrad
Copy link
Member Author

jngrad commented Sep 9, 2020

You can view this PR draft as a subset of the first one. It's unclear to me how the DPD specifics can be resolved and how much time it will take. This PR solves all correlations issues; moving from the state in this PR to the state with a global counter should be straightforward.

doc/sphinx/system_setup.rst Outdated Show resolved Hide resolved
doc/sphinx/system_setup.rst Outdated Show resolved Hide resolved
src/core/constraints/ShapeBasedConstraint.cpp Show resolved Hide resolved
src/core/integrators/velocity_verlet_npt.cpp Outdated Show resolved Hide resolved
src/python/espressomd/interactions.pyx Outdated Show resolved Hide resolved
src/python/espressomd/interactions.pyx Outdated Show resolved Hide resolved
src/python/espressomd/interactions.pyx Outdated Show resolved Hide resolved
@RudolfWeeber
Copy link
Contributor

RudolfWeeber commented Sep 15, 2020 via email

@jngrad
Copy link
Member Author

jngrad commented Sep 16, 2020

For every case possible, the counter increment should be in one central place called from the integrate function, shouldn’t it? That would already give us some of the benefit (and the basic structure) for the global counter.

Yes, that's what is achieved by this PR: the integration loop in integrate.cpp calls void philox_counter_increment() which is defined in thermostat.cpp, where all currently active thermostats get their counter incremented.

@jngrad jngrad force-pushed the thermostats-correlation branch from 3115d3d to d21c7a4 Compare September 16, 2020 17:43
@jngrad jngrad marked this pull request as ready for review September 16, 2020 18:06
Copy link
Member

@KaiSzuttor KaiSzuttor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides comment

testsuite/python/test_checkpoint.py Outdated Show resolved Hide resolved
@KaiSzuttor KaiSzuttor added the automerge Merge with kodiak label Sep 18, 2020
@kodiakhq kodiakhq bot merged commit 4ccad28 into espressomd:python Sep 18, 2020
@jngrad jngrad deleted the thermostats-correlation branch January 18, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants