Skip to content

Commit

Permalink
Replace ImportError with logging.warning if dpctl version is not met
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Feb 21, 2023
1 parent 56e7129 commit c010afc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion numba_dpex/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ def _ensure_dpctl():
from numba_dpex.dpctl_support import dpctl_version

if dpctl_version < (0, 14):
raise ImportError("numba_dpex needs dpctl 0.14 or greater")
logging.warning(
"numba_dpex needs dpctl 0.14 or greater, using "
f"dpctl={dpctl_version} may cause unexpected behavior"
)


def _dpctl_has_non_host_device():
Expand Down
16 changes: 15 additions & 1 deletion numba_dpex/dpctl_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@

import dpctl

dpctl_version = tuple(map(int, dpctl.__version__.split(".")[:2]))

def _parse_version():
t = dpctl.__version__.split(".")
if len(t) > 1:
try:
return tuple(map(int, t))
except ValueError:
return (0, 0)
else:
return (0, 0)


dpctl_version = _parse_version()

del _parse_version

0 comments on commit c010afc

Please sign in to comment.