numba-dpex icon indicating copy to clipboard operation
numba-dpex copied to clipboard

Informative error message when no sycl device are available

Open ogrisel opened this issue 2 years ago • 3 comments

numba-dpex should probably raise an exception with an informative error message whenever it cannot find a valid SYCL device to advise the users about:

  • the possibility how to enable a CPU backend by setting the SYCL_ENABLE_HOST_DEVICE=1 (or even do it automatically if no other device is available)
  • print the active value of os.environ.get('SYCL_DEVICE_FILTER') if not None and link to https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md#sycl_device_filter;
  • recommend to install an OpenCL runtime library if none can be found and list package names (e.g. intel-opencl-rt or others if numba-dpex supports alternative OpenCL runtimes at some point);
  • alternatively recommend to install intel-level-zero if it detects that it is running on a host with Intel devices (e.g. using lspci if available);
  • it should probably point the user to some documentation page to install drivers for GPU devices (either the existing page at https://dgpu-docs.intel.com/installation-guides/index.html but this only covers Intel GPU devices or new page with pointers to the documentation for various vendors that expected to be supported by dpctl and friends).

Also the documentation at:

https://intelpython.github.io/numba-dpex/latest/user_guides/getting_started.html

should be updated to explicitly mention installing the GPU drivers with a link to https://dgpu-docs.intel.com/installation-guides/index.html.

ogrisel avatar Sep 21 '22 15:09 ogrisel

Note at the moment, one gets a SyclDeviceCreationError: Default device is unavailable. without any further instructions.

Traceback (most recent call last):
  File "/opt/conda/envs/numba-dpex/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/opt/conda/envs/numba-dpex/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/__init__.py", line 21, in <module>
    from numba_dpex.retarget import offload_to_sycl_device
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/retarget.py", line 28, in <module>
    from numba_dpex.target import DPEX_TARGET_NAME
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/target.py", line 30, in <module>
    from numba_dpex.utils import (
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/utils/__init__.py", line 19, in <module>
    from numba_dpex.utils.array_utils import (
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/utils/array_utils.py", line 21, in <module>
    from numba_dpex import config
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/config.py", line 54, in <module>
    HAS_NON_HOST_DEVICE = _dpctl_has_non_host_device()
  File "/opt/conda/envs/numba-dpex/lib/python3.9/site-packages/numba_dpex/config.py", line 41, in _dpctl_has_non_host_device
    if not dpctl.select_default_device().is_host:
  File "dpctl/_sycl_device_factory.pyx", line 344, in dpctl._sycl_device_factory.select_default_device
  File "dpctl/_sycl_device_factory.pyx", line 359, in dpctl._sycl_device_factory.select_default_device
dpctl._sycl_device.SyclDeviceCreationError: Default device is unavailable.

See: https://github.com/IntelPython/numba-dpex/issues/776#issuecomment-1253585774

ogrisel avatar Sep 21 '22 16:09 ogrisel

I think it's fixed and the issue can be closed @ogrisel https://github.com/IntelPython/numba-dpex/blob/main/numba_dpex/config.py#L36-L45

fcharras avatar May 04 '23 12:05 fcharras

The logged error message could still be improved based on the suggestions I put in the description but I agree this is already an improvement.

ogrisel avatar May 04 '23 12:05 ogrisel