Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
PokhodenkoSA committed Nov 18, 2020
commit 10807edfd7883031d666222cbf70fa20b97915e8
17 changes: 12 additions & 5 deletions numba/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,24 @@ def __wrapper(func):
f"{type(func)})."
)

from numba import dppl_config
if (target == 'npyufunc' or targetoptions.get('no_cpython_wrapper')
or sigs or config.DISABLE_JIT or not targetoptions.get('nopython')
or dppl_config.dppl_present is not True):
is_numba_dppy_present = False
try:
import numba_dppy.config as dppy_config

is_numba_dppy_present = dppy_config.dppy_present
except ImportError:
pass

if (not is_numba_dppy_present
or 'npyufunc' or targetoptions.get('no_cpython_wrapper')
or sigs or config.DISABLE_JIT or not targetoptions.get('nopython')):
target_ = target
if target_ is None:
target_ = 'cpu'
disp = registry.dispatcher_registry[target_]
return wrapper(func, disp)

from numba.dppl.target_dispatcher import TargetDispatcher
from numba_dppy.target_dispatcher import TargetDispatcher
disp = TargetDispatcher(func, wrapper, target, targetoptions.get('parallel'))
return disp

Expand Down