lecture-python.myst
lecture-python.myst copied to clipboard
MAINT: update @jit(nopython=True) to @jit with numba>=0.59
This PR updates njit to use jit now that numba>=0.59 and nopython=True is now the default behaviour of the jit
This resolves https://github.com/QuantEcon/meta/issues/112 for this lecture series
- [x] checked support files in
_static/lecture_specific - [x] link checker is false positive
🚀 Deployed on https://667b7f4d7bb2ccbc199998b3--nostalgic-wright-5fa355.netlify.app
There are a few speed regressions when applying these changes (right is this PR, left is current live site)
@kp992 would you have any time to review this and see what might be causing the slowdown in execution speed?
Checking this from numba repo: https://github.com/numba/numba/blob/e15cd6870042125ff025e459f5f7558449b22cf8/numba/core/decorators.py#L49 -- Shows that nopython is set by default to True.
And njit is just jit(nopython=True): https://github.com/numba/numba/blob/e15cd6870042125ff025e459f5f7558449b22cf8/numba/core/decorators.py#L250.
Hmm, I guess there can 2 reasons behind this:
- We are using GPU which calls cuda.jit internally in numba and the docs are just talking about CPU options.
- Maybe the cache isn't updated and so the execution time has increased?
@kp992 I don't fully understand your comments.
We are using GPU which calls cuda.jit internally in numba and the docs are just talking about CPU options.
This PR is strictly update the Numba jit so I don't understand why GPU is involved?
Maybe the cache isn't updated and so the execution time has increased?
For any lecture that has had code change then the cache should be invalidated and the lecture is run fresh.
Perhaps we can link up and discuss this?
Thanks @mmcky, I can try looking into it in more details and discuss on this.
@mmcky Can we re-run and see if the time results still differ? Maybe sometimes we might have hit some outlier?
@kp992 there are still large differences:
I will try to debug what's creating these differences.
- [x] recheck results with latest anaconda environments to see if issue persists.
🚀 Deployed on https://673ad3a1057182c68b3b9dd6--nostalgic-wright-5fa355.netlify.app
@kp992 and @HumphreyYang it looks like many of the large differences have resolved in the latest run and versions of numba.
Thanks @kp992. This looks great and clean!