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

Use sparse representation for grid_AO and write sparse matmul for exchange_correlation(...) #88

Open
blazejba opened this issue Sep 14, 2023 · 0 comments
Assignees

Comments

@blazejba
Copy link
Contributor

blazejba commented Sep 14, 2023

Problem:

Atomic orbitals grid grid_AO can be sparsified aggressively with negligible effect on the DFT energy error, at least for <32 atoms cases we tested on. Its sparsity is also proportional to the number of electrons, indicating further gains on larger molecules.

For C6H6, grid_size=45624 and N=66, we get 4 x 45624 x 66 = 12044736 values so 48MB. We could reduce that by 70-90% so to 14-5MB if we would use a sparse representation (values, cols, rows) for the grid.

grid_AO is used solely in exchange_correlation(...) in multiplication with a few dense matrices. The current implementation doesn't exploit the sparsity in grid_AO.

Solution:
Rewrite the code in experimental_pmap_nanoDFT.py such that grid_AO is sparsified.
Write the sparse x dense matrix multiplication implementation in Jax and apply it in exchange_correlation(...).
Example of sparse matmul implementation in Jax

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

No branches or pull requests

1 participant