Skip to content

Commit c010afc

Browse files
Replace ImportError with logging.warning if dpctl version is not met
1 parent 56e7129 commit c010afc

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

numba_dpex/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ def _ensure_dpctl():
1515
from numba_dpex.dpctl_support import dpctl_version
1616

1717
if dpctl_version < (0, 14):
18-
raise ImportError("numba_dpex needs dpctl 0.14 or greater")
18+
logging.warning(
19+
"numba_dpex needs dpctl 0.14 or greater, using "
20+
f"dpctl={dpctl_version} may cause unexpected behavior"
21+
)
1922

2023

2124
def _dpctl_has_non_host_device():

numba_dpex/dpctl_support.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,18 @@
44

55
import dpctl
66

7-
dpctl_version = tuple(map(int, dpctl.__version__.split(".")[:2]))
7+
8+
def _parse_version():
9+
t = dpctl.__version__.split(".")
10+
if len(t) > 1:
11+
try:
12+
return tuple(map(int, t))
13+
except ValueError:
14+
return (0, 0)
15+
else:
16+
return (0, 0)
17+
18+
19+
dpctl_version = _parse_version()
20+
21+
del _parse_version

0 commit comments

Comments
 (0)