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

support caching all jitted functions #651

Merged
merged 5 commits into from
Sep 22, 2023
Merged

support caching all jitted functions #651

merged 5 commits into from
Sep 22, 2023

Conversation

jmoralez
Copy link
Member

@jmoralez jmoralez commented Sep 21, 2023

Adds the cache and nogil arguments to all jitted functions. These can be set with:

  • NIXTLA_NUMBA_CACHE: if this variable is set all functions will be cached
  • NIXTLA_NUMBA_RELEASE_GIL: if this variable is set all functions release the GIL.

Also adds a small notebook (nbs/docs/how-to-guides/numba_cache.ipynb) explaining the caching.

NOTE:
The nelder_mead function couldn't be cached because it received another function as input and I couldn't figure out a way to cache it like that, so it's currently repeated for ces, ets and theta (the only difference is the objective function, which is baked into the function).

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@AzulGarza AzulGarza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome @jmoralez! LGTM😍

@jmoralez jmoralez merged commit 33c2a0a into main Sep 22, 2023
19 checks passed
@jmoralez jmoralez deleted the cache branch September 22, 2023 00:15
@VivCh14
Copy link

VivCh14 commented Feb 13, 2024

Hi, really great addition! Thank you for working on this.

I tried setting the environment variable 'NIXTLA_NUMBA_CACHE=1' or 'NIXTLA_NUMBA_CACHE=0' and they both tend to enable caching! To not cache I have to comment out the 'NIXTLA_NUMBA_CACHE' altogether. Any thoughts ?

@jmoralez
Copy link
Member Author

The caching is enabled if the environment variable is set, so if you don't want to enable it you shouldn't set it or delete it if you've already set it elsewhere, e.g. del os.environ['NIXTLA_NUMBA_CACHE']

@VivCh14
Copy link

VivCh14 commented Feb 14, 2024

Thanks! makes sense :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants