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

Commit f0d9ebd

Browse files
authored
Move numba/dppl_config.py to numba_dppy/config.py (numba#14)
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 2d4dc3c commit f0d9ebd

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

numba_dppy/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,14 @@ def main():
506506
from numba import config
507507
import numba.testing
508508

509-
from numba.dppl_config import *
510-
if dppl_present:
509+
from .config import dppy_present
510+
if dppy_present:
511511
from .device_init import *
512512
else:
513513
raise ImportError("Importing dppl failed")
514514

515515
def test(*args, **kwargs):
516-
if not dppl_present and not is_available():
516+
if not dppy_present and not is_available():
517517
dppl_error()
518518

519519
return numba.testing.test("numba_dppy.tests", *args, **kwargs)

numba_dppy/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
try:
2+
import dpctl
3+
4+
dppy_present = dpctl.has_sycl_platforms() and dpctl.has_gpu_queues()
5+
except:
6+
dppy_present = False

numba_dppy/dppl_offload_dispatcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from numba.core import dispatcher, compiler
22
from numba.core.registry import cpu_target, dispatcher_registry
3-
import numba.dppl_config as dppl_config
3+
import numba_dppy.config as dppy_config
44

55

66
class DpplOffloadDispatcher(dispatcher.Dispatcher):
77
targetdescr = cpu_target
88

99
def __init__(self, py_func, locals={}, targetoptions={}, impl_kind='direct', pipeline_class=compiler.Compiler):
10-
if dppl_config.dppl_present:
10+
if dppy_config.dppy_present:
1111
from numba_dppy.compiler import DPPLCompiler
1212
targetoptions['parallel'] = True
1313
dispatcher.Dispatcher.__init__(self, py_func, locals=locals,

numba_dppy/tests/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from os.path import dirname, join
44

55

6-
import numba.dppl_config as dppl_config
6+
import numba_dppy.config as dppy_config
77

88
def load_tests(loader, tests, pattern):
99

1010
suite = SerialSuite()
1111
this_dir = dirname(__file__)
1212

13-
if dppl_config.dppl_present:
13+
if dppy_config.dppy_present:
1414
suite.addTests(load_testsuite(loader, join(this_dir, 'dppl')))
1515
else:
1616
print("skipped DPPL tests")

0 commit comments

Comments
 (0)