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

environment variable to have njit behave as jit? #3817

Closed
belm0 opened this issue Mar 1, 2019 · 3 comments
Closed

environment variable to have njit behave as jit? #3817

belm0 opened this issue Mar 1, 2019 · 3 comments
Labels
question Notes an issue as a question stale Marker label for stale issues.

Comments

@belm0
Copy link

belm0 commented Mar 1, 2019

(disclaimer: I'm new to Numba)

It seems there is a tension between use of @jit vs. @njit. If I use jit, it's too easy to have a performance regression if some code makes Numba fall back to object mode. If I use njit, it's too easy to have a runtime error if some code path has unsupported constructs (... short of maintaining 100% code coverage for all Numba code).

I noticed there is a environment variable NUMBA_DISABLE_JIT which makes jit/njit behave as a no-op. Along those lines I'd like to see NUMBA_NJIT_AS_JIT which forces njit to behave as jit. How it would be used: the codebase uses njit for performance-critical code, and runtime errors are addressed during development. In the release environment, set NUMBA_NJIT_AS_JIT=1 to ensure there are no runtime errors and at worse only performance is affected, not correctness.

@stuartarchibald
Copy link
Contributor

Thanks for the query. Would it be sufficient to just have this locally in your code base? i.e. somewhere high up in the application start sequence have something like:

import os
if os.environ.get('NUMBA_NJIT_AS_JIT', False):
  from numba import jit as njit
  print("release mode")
else:
  from numba import njit
  print("development mode")

then continue to use njit throughout, or perhaps do import as myjit or similar and use myjit throughout so there's less potential confusion?

@stuartarchibald stuartarchibald added the question Notes an issue as a question label Mar 1, 2019
@github-actions
Copy link

This issue is marked as stale as it has had no activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with any updates and confirm that this issue still needs to be addressed.

@github-actions github-actions bot added the stale Marker label for stale issues. label Jun 30, 2021
@stuartarchibald
Copy link
Contributor

Closing this question as it seems to be resolved. Numba now has a discourse forum https://numba.discourse.group/ which is great for questions like this, please do consider posting there in future :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Notes an issue as a question stale Marker label for stale issues.
Projects
None yet
Development

No branches or pull requests

2 participants