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

Permutation group product table #884

Merged
merged 3 commits into from
Aug 24, 2021

Conversation

attila-i-szabo
Copy link
Collaborator

@attila-i-szabo attila-i-szabo commented Aug 23, 2021

This PR changes PermutationGroup.product_table to make it more memory-friendly.

The upstream version calculates the permutations corresponding to every g^-1 h in one numpy-array-indexing command. This generates a matrix of N_site * N_symm^2 integers, which quickly gets obscenely large, leading to memory errors. (As a modest example, a 16×16 square lattice has N_site=256 and N_symm=2048, leading to a size-1,073,741,824 array). It's even worse as the array is then recreated as a list of HashableArrays.

Instead, I split this calculation by rows of the product table. This makes the code quite transparent, memory-friendly, and I don't expect it to introduce a large time overhead. (There is a new loop over the rows, but we've already had loops that cycle through every entry of the product table, so I'm not too worried. In fact, one of those is gone now.) It has already been a very slow method, but there doesn't seem to be a way to make it significantly more performant.

The output of the function doesn't change.

@PhilipVinc
Copy link
Member

Thanks.

I am starting to think this code could be adapted a bit and numbified with a little bit of work in order to speed it up remarkably.
I'm quite confident we could lower the runtime by a factor of 30-60 if we wanted to.
And it would also be parallelized for free at that point..

anyhow, for now this is great

@PhilipVinc PhilipVinc closed this Aug 24, 2021
@PhilipVinc PhilipVinc reopened this Aug 24, 2021
@PhilipVinc PhilipVinc merged commit ffb8650 into netket:master Aug 24, 2021
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