From 1d8ffbc48f81653ff737431f4b75c4b7e45d7fba Mon Sep 17 00:00:00 2001 From: Diptorup Deb Date: Thu, 5 Jan 2023 20:29:55 -0600 Subject: [PATCH 1/2] Bump dpctl version requirement to 0.14 and fix issue caused by API change. --- conda-recipe/meta.yaml | 4 ++-- numba_dpex/config.py | 26 ++++++++++---------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 469a856d59..38ada8ee04 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -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* diff --git a/numba_dpex/config.py b/numba_dpex/config.py index 55d6f3c746..3cbbca2ba1 100644 --- a/numba_dpex/config.py +++ b/numba_dpex/config.py @@ -2,9 +2,8 @@ # # SPDX-License-Identifier: Apache-2.0 -import imp +import logging import os -import warnings from numba.core import config @@ -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 @@ -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 From 61c46f18565a4c604409d5a08537ce2c7377648b Mon Sep 17 00:00:00 2001 From: Diptorup Deb Date: Fri, 6 Jan 2023 18:14:33 -0600 Subject: [PATCH 2/2] Remove dead code. --- numba_dpex/device_init.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/numba_dpex/device_init.py b/numba_dpex/device_init.py index b329083bfa..3452ffdcb9 100644 --- a/numba_dpex/device_init.py +++ b/numba_dpex/device_init.py @@ -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()