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

Lookup for binomial_factor #125

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Lookup for binomial_factor #125

wants to merge 8 commits into from

Conversation

awf
Copy link
Collaborator

@awf awf commented Oct 11, 2023

Plumbed in the lookup table from #123, and parametrized tests to compare performance.

TLDR: minimal effect on runtime on CPU/IPUModel, useful improvement in compile time.

$ pytest -k test_nuclear --durations=10 -xs
38.11s call     test/test_integrals.py::test_nuclear[segment_sum-recompile]
9.77s call     test/test_integrals.py::test_nuclear[lookup-recompile]
4.16s call     test/test_integrals.py::test_nuclear[lookup-cached]
4.07s call     test/test_integrals.py::test_nuclear[segment_sum-cached]

Update: the above is on one machine/JAX combination. Others show less of an effect, sometimes inverted. We may prefer to leave this on a branch as an unconclusive experiment.

The improved compile time is probably because the jaxpr is more compact for the lookup case. We might hope that runtime on IPU will be good because the problem is converted to a simple matrix-vector multiply, but at 2*LMAX=8, meaning 128K of memory to store the dense LUT, it may be necessary to sparsely encode it, at which point, a simple C++ vertex implementation may be the better option.

The above results were generated with instrumented tests, but that instrumentation is removed for checkin - we don't want to run them all the time. That branch is at

@pytest.mark.parametrize("binom_factor_str", ["segment_sum", "lookup"])

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@awf awf marked this pull request as draft October 11, 2023 22:42
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