-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow the numba cache to be used, for development #441
base: main
Are you sure you want to change the base?
Conversation
Copied from SGKIT. Fixes tskit-dev#438
I ran into the same issues as you here-- the bulk of stuff is still being compiled on import. I think pulling all the EP stuff into a low-level extension is the way to go. |
Can we do this while keeping it in python (I presume not)? Or are you thinking of writing the low-level e.g. in rust? |
It may be possible to build the extension with numba, but I think it'd be stabler and easier to maintain a C or rust extension. |
Numba complains about these
I could make the edits to the scipy special functions on this branch if you'd like @hyanwong ? |
Yes, why not. Thank you. |
Do you want me to have a go at swapping in math.lgamma for the script version, @nspope ? |
Sure, sorry to drop the ball on this. Where I'm thinking is, https://github.com/tskit-dev/tsdate/blob/240593d01a1a77561dadebee82cfb5fae67f83bc/tsdate/hypergeo.py#L72C17-L74C26 the _gammaln_f8 should be changed to math.lgamma -- hopefully that's enough to make more functions cache-able? |
No problem,. I'll give it a whirl. Thanks for the pointer. |
OK, with the new commits and the math.lgamma function this now seems to work, and cuts import down from 29 seconds (with I put |
Aha. I spotted some more functions I could mark to cache. Now down to 5 secs for import. |
I guess this is good to go, at least for the time being. To enable the caching (e.g. for development), you need to explicitly set |
Copied from SGKIT. Fixes #438