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

Bump dpctl version requirement to 0.14 and fix issue caused by API change #858

Merged
merged 2 commits into from
Jan 7, 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
4 changes: 2 additions & 2 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ requirements:
- setuptools
- cython
- numba 0.56*
- dpctl >=0.13.0
- dpctl >=0.14*
- dpnp >=0.11*
- wheel
run:
- python
- numba >=0.56*
- dpctl >=0.13.0
- dpctl >=0.14*
- spirv-tools
- llvm-spirv 11.*
- dpnp >=0.11*
Expand Down
26 changes: 10 additions & 16 deletions numba_dpex/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#
# SPDX-License-Identifier: Apache-2.0

import imp
import logging
import os
import warnings

from numba.core import config

Expand All @@ -15,25 +14,23 @@ def _ensure_dpctl():
"""
from numba_dpex.dpctl_support import dpctl_version

if dpctl_version < (0, 8):
raise ImportError("numba_dpex needs dpctl 0.8 or greater")
if dpctl_version < (0, 14):
raise ImportError("numba_dpex needs dpctl 0.14 or greater")


def _dpctl_has_non_host_device():
"""
Make sure dpctl has non-host SYCL devices on the system.
Ensure dpctl can create a default sycl device
"""
import dpctl

# For the numba_dpex extension to work, we should have at least one
# non-host SYCL device installed.
# FIXME: In future, we should support just the host device.
if not dpctl.select_default_device().is_host:
try:
dpctl.select_default_device()
return True
else:
except Exception:
msg = "dpctl could not find any non-host SYCL device on the system. "
msg += "A non-host SYCL device is required to use numba_dpex."
warnings.warn(msg, UserWarning)
logging.exception(msg)
return False


Expand All @@ -57,11 +54,8 @@ def _readenv(): ...
try:
return ctor(value)
except Exception:
import warnings

warnings.warn(
"environ %s defined but failed to parse '%s'" % (name, value),
RuntimeWarning,
logging.exception(
"environ %s defined but failed to parse '%s'" % (name, value)
)
return default

Expand Down
17 changes: 0 additions & 17 deletions numba_dpex/device_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,4 @@
from .core import target
from .decorators import autojit, func, kernel


def is_available():
"""Returns a boolean indicating if dpctl could find a default device.

A ValueError is thrown by dpctl if no default device is found and it
implies that numba_dpex cannot create a SYCL queue to compile kernels.

Returns:
bool: True if a default SYCL device is found, otherwise False.
"""
try:
d = dpctl.select_default_device()
return not d.is_host
except ValueError:
return False


initialize.load_dpctl_sycl_interface()