Skip to content

Vectorize atom index computation in L-BFGS optimizer#444

Merged
abhijeetgangan merged 3 commits intoTorchSim:mainfrom
falletta:lbfgs_vector
Feb 6, 2026
Merged

Vectorize atom index computation in L-BFGS optimizer#444
abhijeetgangan merged 3 commits intoTorchSim:mainfrom
falletta:lbfgs_vector

Conversation

@falletta
Copy link
Contributor

@falletta falletta commented Feb 6, 2026

Replace Python for-loops over systems with vectorized tensor operations in the L-BFGS optimizer's padding/unpadding helpers and mask construction.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abhijeetgangan
Copy link
Collaborator

Could you run #365 (comment) and see the performance did not regress?

@falletta
Copy link
Contributor Author

falletta commented Feb 6, 2026

Sure, I’ve done two consecutive runs of the script in #365 with and without these changes, and obtained:

Before:  L-BFGS       178.79       1000/1000          0.0001
After:   L-BFGS       165.76       1000/1000          0.0001

A second pair of consecutive runs gives:

Before:  L-BFGS       185.18       1000/1000          0.0001
After:   L-BFGS       171.04       1000/1000          0.0001

So it looks like, besides timing fluctuations, there might also be some minor optimization.

@abhijeetgangan abhijeetgangan merged commit 6187c22 into TorchSim:main Feb 6, 2026
67 checks passed
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.

2 participants