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

Add timers for Hubbard symmetrization #1008

Merged
merged 11 commits into from
Jul 15, 2024
Merged

Add timers for Hubbard symmetrization #1008

merged 11 commits into from
Jul 15, 2024

Conversation

simonpintarelli
Copy link
Collaborator

@simonpintarelli simonpintarelli commented Jul 7, 2024

Add sirus::symmetrize_occupation_matrix.

@gsavva encountered a SCF+U calculation which spent the bulk of the time in symmetrize_occupation_matrix in Density::generate.

@toxa81
Copy link
Collaborator

toxa81 commented Jul 7, 2024

I'm almost sure it's the same issue that we solved in symmetrize_mt_function(): generation of sht::rotation_matrix<double>(4, eang, pr); is expensive and needs to be cached. symmetrize_mt_function() already contains the fix

@simonpintarelli
Copy link
Collaborator Author

There is some room for improvment here ^^. I've cherry picked the changes and compiled on todi, At least it seems to fix the bulk of the performance issue.

@@ -46,6 +48,19 @@ symmetrize_occupation_matrix(Occupation_matrix& om__)
}
}

std::vector<std::vector<mdarray<double, 2>>> rotms(sym.size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

but why not passing it as argument? it is already computed in sim.ctx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Aren't the ones in sim ctx different? https://github.com/electronic-structure/SIRIUS/blob/sirius-md/src/context/simulation_context.cpp#L834

It does the following at the end:
https://github.com/electronic-structure/SIRIUS/blob/sirius-md/src/core/sht/sht.cpp#L98

In symmetrize_occupation_matrix for each symmetry
https://github.com/electronic-structure/SIRIUS/blob/sirius-md/src/core/sht/sht.cpp#L115
was called, which returns a vector of rotations matrices.

I didn't look at the for loops below, perhaps one can rearrange things and use the ctx.rotm().

Copy link
Collaborator

@toxa81 toxa81 Jul 11, 2024

Choose a reason for hiding this comment

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

I checked the code and I found a TODO that perfectly fits this refactoring. I'll add my changes to this PR

@toxa81
Copy link
Collaborator

toxa81 commented Jul 12, 2024

cscs-ci run

@toxa81
Copy link
Collaborator

toxa81 commented Jul 15, 2024

@simonpintarelli @gsavva is it good to be merged?

@toxa81 toxa81 merged commit be0b3f8 into develop Jul 15, 2024
3 checks passed
@toxa81 toxa81 deleted the hubbard-profile branch July 15, 2024 21:33
abussy pushed a commit to abussy/SIRIUS that referenced this pull request Oct 9, 2024
* profile symmetrize_occupation_matrix
* use precomputed block rotation matrices for real spherical harmonics everywhere

---------

Co-authored-by: Anton Kozhevnikov <toxa81@gmail.com>
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