Akhilesh
Akhilesh

Reputation: 1034

What is host_selector in SYCL device selector?

I am newbie in SYCL, OpenCL and GPU programming. I read about the device selector in the SYCL and found the following four:

  1. default_selector : Devices selected by heuristics of the system. If no OpenCL device is found then it defaults to the SYCL host device.
  2. gpu_selector : Select devices according to device type info::device::device_type::gpu from all the available OpenCL devices. If no OpenCL GPU device is found the selector fails.
  3. cpu_selector : Select devices according to device type info::device::device_type::cpu from all the available devices and heuristics. If no OpenCL CPU device is found the selector fails.
  4. host_selector : Selects the SYCL host CPU device that does not require an OpenCL runtime.

I ran computecpp_info to find the devices are:

$ /usr/local/computecpp/bin/computecpp_info
/usr/local/computecpp/bin/computecpp_info: /usr/local/cuda-8.0/lib64/libOpenCL.so.1: no version information available (required by /usr/local/computecpp/bin/computecpp_info)
/usr/local/computecpp/bin/computecpp_info: /usr/local/cuda-8.0/lib64/libOpenCL.so.1: no version information available (required by /usr/local/computecpp/bin/computecpp_info)
********************************************************************************

ComputeCpp Info (CE 0.7.0)

********************************************************************************

Toolchain information:

GLIBC version: 2.19
GLIBCXX: 20150426
This version of libstdc++ is supported.

********************************************************************************


Device Info:

Discovered 3 devices matching:
  platform    : <any>
  device type : <any>

--------------------------------------------------------------------------------
Device 0:

  Device is supported                     : NO - Device does not support SPIR
  CL_DEVICE_NAME                          : GeForce GTX 750 Ti
  CL_DEVICE_VENDOR                        : NVIDIA Corporation
  CL_DRIVER_VERSION                       : 384.111
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU 
--------------------------------------------------------------------------------
Device 1:

  Device is supported                     : UNTESTED - Device not tested on this OS
  CL_DEVICE_NAME                          : Intel(R) HD Graphics
  CL_DEVICE_VENDOR                        : Intel(R) Corporation
  CL_DRIVER_VERSION                       : r5.0.63503
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU 
--------------------------------------------------------------------------------
Device 2:

  Device is supported                     : YES - Tested internally by Codeplay Software Ltd.
  CL_DEVICE_NAME                          : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
  CL_DEVICE_VENDOR                        : Intel(R) Corporation
  CL_DRIVER_VERSION                       : 1.2.0.475
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_CPU 

If you encounter problems when using any of these OpenCL devices, please consult
this website for known issues:
https://computecpp.codeplay.com/releases/v0.7.0/platform-support-notes

So, GeForce GTX 750 Ti and Intel(R) HD Graphics devices are GPU devices and Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz is CPU devices. What's about host devices here?

If I select host_selector, where my SYCL code would run?

Upvotes: 2

Views: 1396

Answers (1)

Marios K.
Marios K.

Reputation: 131

In SYCL there is the notion of the host device and the OpenCL device. The OpenCL device is any OpenCL enabled device, like Intel GPU, AMD GPUs, FPGAs with OpenCL support, etc.

The Host device on the other hand, is the device which is operating the OpenCL device. In essence it is your cpu and it controls all the attached OpenCL enabled devices and does not use OpenCL by itself. Sometimes, some CPU vendors provide an OpenCL driver, enabling you to run OpenCL on your CPU as well. In this case the host device and the OpenCL device share the same hardware components.

In your case, Intel provides an OpenCL implementation for CPUs as well as GPUs, thus all your devices are OpenCL enabled. The Host device exists even if you have no OpenCL devices

I would also like to point out that ComputeCpp contains experimental support for NVidia so you might be able to run SYCL on that but with no guarantees

Upvotes: 10

Related Questions