Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ImportError with logging.warning if dpctl version is not met #925

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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