Skip to content

Conversation

@foxtran
Copy link
Contributor

@foxtran foxtran commented May 12, 2025

With gfortran, spread intrinsic is not optimized (more precisely this is libgfortran call) and therefore it significantly affects on performance, especially for 3-body terms.

This patch speeds up gradient code in 1.5-2x times with gfortran as well other parts which I did not measure. By some reason, it also affects ifx but it gives only 10% speed up for deriv_atm_triple subroutine.

I have used unrolled cycles since they provide an extra optimizations for ifx: time was improved from 680 to 625 ms for my input. Usual cycles does not give this improvement: see the assembler difference here: https://godbolt.org/z/zs6e7vzT4. The first source code is the original, the second is presented in this PR and the third one uses cycles.

I did not touched initializations/io parts where spread are used.

@thfroitzheim
Copy link
Member

I did not touch spread hell in gfnff/gfnff.f90. Also, I did not touched initializations/io parts where spread also used.

I know this is the annoying part, but GFN-FF would likely benefit the most from improved parallelization (i.e. in #1240). Likely much more than just a few ms here and there

@foxtran
Copy link
Contributor Author

foxtran commented May 14, 2025

Likely much more than just a few ms here and there

It is not a few ms for here and there for GCC, unfortunately.

@foxtran foxtran force-pushed the fix/spread branch 2 times, most recently from 8c6dfe0 to c64a94f Compare May 14, 2025 08:50
@foxtran
Copy link
Contributor Author

foxtran commented May 16, 2025

For GFN-FF and bench.xyz/1666_0064xGluAla.xyz, for GCC I got a 20% speed-up with this patch: from 0.78 sec/iter to 0.63 sec/iter in single-threaded run.

@foxtran foxtran requested a review from thfroitzheim May 16, 2025 08:49
foxtran added 16 commits May 18, 2025 11:27
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
@foxtran
Copy link
Contributor Author

foxtran commented May 20, 2025

@thfroitzheim, ping :-)

Copy link
Member

@thfroitzheim thfroitzheim left a comment

Choose a reason for hiding this comment

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

LGTM

@thfroitzheim thfroitzheim merged commit fe1c8ce into grimme-lab:main May 21, 2025
23 checks passed
@foxtran foxtran deleted the fix/spread branch May 21, 2025 13:41
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