-
Notifications
You must be signed in to change notification settings - Fork 34
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
FEAT - Use @njit(cache=True) #215
Comments
@njit(cache=True)
@njit(cache=True)
Thanks for the pointer @PascalCarrivain, I was not aware of this feature. It seems to help a lot (not for the first compilation, but for the subsequent calls), on a very CPU bound problem. From the first run to the second, I change only the value of
import numpy as np
import time
from numba import njit
a = np.arange(10_000)
for i in range(5):
def my_sum(a):
acc = 0
for val in a:
acc += val
return acc
t0 = time.perf_counter()
njit(my_sum, cache=True)(a)
t1 = time.perf_counter()
print(t1 - t0) Can you try to test the impact of using cache=True in our codebase on a real life skglm problem, ie fitting an estimator on a simple problem ? |
@mathurinm Yes, I will do it late this year or early next year. |
@PascalCarrivain do you know if this can help the first compilation too ? |
I do not see a huge difference for the first compilation (at least on my projects). |
Use caching option from Numba
I explore a little bit the skglm source code and I realized you are using Numba decorator
@nijt
.I was wondering if it makes senses to switch to
@nijt(cache=True)
.Indeed, according to Numba documentation caching compiled functions reduces the future compilation time.
The text was updated successfully, but these errors were encountered: