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

Numba JIT causes up to 15s import times #222

Open
fluffbucket opened this issue Jun 21, 2023 · 4 comments
Open

Numba JIT causes up to 15s import times #222

fluffbucket opened this issue Jun 21, 2023 · 4 comments

Comments

@fluffbucket
Copy link

Compiling sGrid and whatever else uses Numba takes up to 15seconds every time causing long bootup times, consider using AOT instead with Numba.

Measured with cProfile around importing pysheds grid and raster

@mdbartos
Copy link
Owner

Hi @fluffbucket, all of the functions use numba's caching option to store the compiled code:

cache=True)

It should just compile once the first time you use it and then not compile again unless modified.

@fluffbucket
Copy link
Author

fluffbucket commented Jun 25, 2023 via email

@wiesnerfriedman
Copy link

Hi @fluffbucket I'm wondering if you're using Windows? I'm having issues using from pysheds.grid import Grid and it seems to crash in _sgrid.py around def _d8_catchment_iter_numba. I'm thinking it's a Windows thing maybe?

@mdbartos
Copy link
Owner

mdbartos commented Aug 3, 2023

I've noticed numba sometimes has problems on Windows with the functions that use numba implementations of linked lists and dictionaries. You may want to try using algorithm='recursive' in your call to grid.catchment and see if it's more stable.

I haven't been able to reproduce the 15+ second loading times though. I suspect that you may have a caching issue that is causing everything to be re-compiled each time you import.

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

3 participants