[metatomic] make the code faster by avoiding torch::Tensor indexing#1305
Merged
carlocamilloni merged 2 commits intoplumed:v2.10from Jul 26, 2025
Merged
[metatomic] make the code faster by avoiding torch::Tensor indexing#1305carlocamilloni merged 2 commits intoplumed:v2.10from
carlocamilloni merged 2 commits intoplumed:v2.10from
Conversation
operator[] on torch::Tensor does a lot of things from gradients tracking to bound checks, and is a lot (~3 orders of magnitude) slower than directly operating on the data.
d921eb9 to
edaeb9e
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This makes running metatomic model a lot faster, cutting the time from 3s to 900ms (most of which should also be avoidable but requires changes to our libraries first).
Target release
I would like my code to appear in release v2.10
Type of contribution
changes to code or doc authored by PLUMED developers, or additions of code in the core or within the default moduleschanges to a module not authored by youCopyright
COPYRIGHTfile with the correct license information. Code should be released under an open source license. I also used the commandcd src && ./header.sh mymodulenamein order to make sure the headers of the module are correct.Tests
I added a new regtest or modified an existing regtest to validate my changes.