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

Investigate use of numba.config.DISABLE_JIT for coverage approximations #1449

Open
brandonwillard opened this issue Feb 21, 2023 · 3 comments · May be fixed by #1470
Open

Investigate use of numba.config.DISABLE_JIT for coverage approximations #1449

brandonwillard opened this issue Feb 21, 2023 · 3 comments · May be fixed by #1470
Labels
enhancement New feature or request help wanted Extra attention is needed Numba Involves Numba transpilation testing

Comments

@brandonwillard
Copy link
Member

brandonwillard commented Feb 21, 2023

We're currently using a hackish mock approach to estimating coverage for our Numba implementations; however, this is cumbersome to use and extend. Let's take (another) look at the use of numba.config.DISABLE_JIT for these purposes.

For instance, instead of eval_python_only at

eval_python_only(fn_inputs, fn_outputs, inputs, mode=numba_mode)

we would—ideally—have something the following:

from numba.tests.support import override_config

with override_config('DISABLE_JIT', True):
    aesara_numba_fn(*inputs)

A change like that would need to be followed by some pytest runs with coverage enabled, and the results would need to indicate that coverage was obtained for the Python code produced for Numba by Aesara.

@brandonwillard brandonwillard added enhancement New feature or request help wanted Extra attention is needed testing Numba Involves Numba transpilation labels Feb 21, 2023
@Smit-create
Copy link
Member

Looking into this I noticed that numba.config.DISABLE_JIT = True will not affect already compiled functions. To call the pure python functions i.e. without jitted, we should use numba_function.py_func. We need to figure out some way so that aesara.compile.function can recognize a new mode say -- numba_no_jit, and generate the compiled aesara function by using numba_function.py_func.

@Smit-create Smit-create linked a pull request Mar 13, 2023 that will close this issue
6 tasks
@brandonwillard
Copy link
Member Author

We need to figure out some way so that aesara.compile.function can recognize a new mode say -- numba_no_jit, and generate the compiled aesara function by using numba_function.py_func.

That sounds good!

@dgerlanc
Copy link
Contributor

Looking into this I noticed that numba.config.DISABLE_JIT = True will not affect already compiled functions. To call the pure python functions i.e. without jitted, we should use numba_function.py_func

So it sounds like even if you use:

from numba.tests.support import override_config

with override_config('DISABLE_JIT', True):
    aesara_numba_fn(*inputs)

So if the function has already been compiled, Numba will still use the compiled function, not the pure Python function?

If so, we can probably change the cache directory dynamically, perhaps with a pytest extension, to handle.

@brandonwillard brandonwillard linked a pull request Mar 23, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed Numba Involves Numba transpilation testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants