diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 5a1a465216..c413475518 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -204,6 +204,11 @@ jobs: NUMBA_DPEX_USE_MLIR: ${{ matrix.use_mlir && '1' || '0' }} run: python -c "import dpnp, dpctl, numba_dpex; dpctl.lsplatform()" + - name: Smoke test - test import with no default device + env: + ONEAPI_DEVICE_SELECTOR: unknown:unknown + run: python -c "import numba_dpex" + - name: Run tests if: ${{!matrix.run_gdb}} env: diff --git a/numba_dpex/__init__.py b/numba_dpex/__init__.py index cf72ed70d1..8c03ad1bcc 100644 --- a/numba_dpex/__init__.py +++ b/numba_dpex/__init__.py @@ -71,7 +71,7 @@ def parse_sem_version(version_string: str) -> Tuple[int, int, int]: numba_sem_version = parse_sem_version(numba_version) if numba_sem_version < (0, 57, 0) or numba_sem_version >= (0, 59, 0): logging.warning( - "numba_dpex needs at lease numba 0.57.0 but no more than 0.59.0, using " + "numba_dpex needs at least numba 0.57.0 but no more than 0.59.0, using " f"numba={numba_version} may cause unexpected behavior" ) @@ -111,33 +111,30 @@ def parse_sem_version(version_string: str) -> Tuple[int, int, int]: from numba_dpex.dpctl_iface import _intrinsic # noqa E402 from numba_dpex.dpnp_iface import dpnpimpl # noqa E402 -if config.HAS_NON_HOST_DEVICE: - # Re export - from .core.targets import dpjit_target, kernel_target - from .decorators import dpjit, func, kernel - from .ocl.stubs import ( - GLOBAL_MEM_FENCE, - LOCAL_MEM_FENCE, - atomic, - barrier, - get_global_id, - get_global_size, - get_group_id, - get_local_id, - get_local_size, - get_num_groups, - get_work_dim, - local, - mem_fence, - private, - sub_group_barrier, - ) +from .core.targets import dpjit_target, kernel_target # noqa E402 +from .decorators import dpjit, func, kernel # noqa E402 +from .ocl.stubs import ( # noqa E402 + GLOBAL_MEM_FENCE, + LOCAL_MEM_FENCE, + atomic, + barrier, + get_global_id, + get_global_size, + get_group_id, + get_local_id, + get_local_size, + get_num_groups, + get_work_dim, + local, + mem_fence, + private, + sub_group_barrier, +) + +DEFAULT_LOCAL_SIZE = [] +load_dpctl_sycl_interface() +del load_dpctl_sycl_interface - DEFAULT_LOCAL_SIZE = [] - load_dpctl_sycl_interface() - del load_dpctl_sycl_interface -else: - raise ImportError("No non-host SYCL device found to execute kernels.") Vectorize.target_registry.ondemand["dpex"] = lambda: DpexVectorize diff --git a/numba_dpex/config.py b/numba_dpex/config.py index 43dabcd66c..dd5e187f0e 100644 --- a/numba_dpex/config.py +++ b/numba_dpex/config.py @@ -33,17 +33,6 @@ def __getattr__(name): return getattr(config, name) -# Ensure dpctl can create a default sycl device. -# Set this config flag based on if dpctl is found or not. -# The config flags is used elsewhere inside Numba. -try: - HAS_NON_HOST_DEVICE = dpctl.select_default_device() -except Exception: - logging.exception( - "dpctl could not find any non-host SYCL device on the system. " - + "A non-host SYCL device is required to use numba_dpex." - ) - # To save intermediate files generated by th compiler SAVE_IR_FILES = _readenv("NUMBA_DPEX_SAVE_IR_FILES", int, 0)