Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 945bc46

Browse files
authored
Move dppl_config.py to numba-dppy and make numba_dppy optional for numba (#106)
* Make numba_dppy optional for numba Note: This place introduces optional dependency `numba` -> `numba_dppy`. Right dependency order is `numba` <- `numba_dppy`. `numba_dppy` is required because of implementation of `with context` requires TargetDispatcher. * Move numba/dppl_config.py to numba_dppy/config.py dppl_config.py contains flag `dppl_present` which indicate that `dpCtl` and devices are available. As `numba-dppy` will depend on `dpCtl` then the check is not necessary. Also checking for available platform and device could be done in `numba-dppy`. It also can raise and exception on import as before. `dppl_present` also renamed to `dppy_present`.
1 parent 4fdff94 commit 945bc46

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

numba/core/decorators.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,24 @@ def __wrapper(func):
222222
f"{type(func)})."
223223
)
224224

225-
from numba import dppl_config
226-
if (target == 'npyufunc' or targetoptions.get('no_cpython_wrapper')
227-
or sigs or config.DISABLE_JIT or not targetoptions.get('nopython')
228-
or dppl_config.dppl_present is not True):
225+
is_numba_dppy_present = False
226+
try:
227+
import numba_dppy.config as dppy_config
228+
229+
is_numba_dppy_present = dppy_config.dppy_present
230+
except ImportError:
231+
pass
232+
233+
if (not is_numba_dppy_present
234+
or target == 'npyufunc' or targetoptions.get('no_cpython_wrapper')
235+
or sigs or config.DISABLE_JIT or not targetoptions.get('nopython')):
229236
target_ = target
230237
if target_ is None:
231238
target_ = 'cpu'
232239
disp = registry.dispatcher_registry[target_]
233240
return wrapper(func, disp)
234241

235-
from numba.dppl.target_dispatcher import TargetDispatcher
242+
from numba_dppy.target_dispatcher import TargetDispatcher
236243
disp = TargetDispatcher(func, wrapper, target, targetoptions.get('parallel'))
237244
return disp
238245

numba/dppl_config.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)