1

I am currently working on a project using SYCL to apply an unsharp mask to an image. My machine has an NVIDIA and an Intel GPU inside it. I am starting with the following code:

default_selector deviceSelector;
queue myQueue(deviceSelector);

The issue is that the line of code "default_selector deviceSelector;" automatically grabs the NVIDIA GPU inside my machine, this breaks all the code that follows as SYCL does not work with NVIDIA.

Therefore my question is - how can I force "default_selector deviceSelector;" to get my Intel GPU and not the NVIDIA GPU? Perhaps I can say something like:

if (device.has_extension(cl::sycl::string_class("Intel"))) 
   if (device.get_info<info::device::device_type>() == info::device_type::gpu)
       then select this GPU;//pseudo code 

Thus making the code skip over the NVIDIA GPU and guaranteeing the selecting of my Intel GPU.

Kyle_Pearce
  • 111
  • 1
  • 8

1 Answers1

1

You are checking the extensions contain an entry called "Intel" which it would not. Extensions are things the device supports, such as SPIR-V You can see the supported extensions by calling clinfo at the command line. To choose the Intel GPU you need to check the manufacturer of the device to select the correct one.

So in the sample code for custom device selection https://github.com/codeplaysoftware/computecpp-sdk/blob/master/samples/custom-device-selector.cpp#L46

You would need to just have something like

if (device.get_info<info::device::name>() == "Name of device") {
        return 100;
      }

You could print out the value of

device.get_info<info::device::name>

to get the value to check against.

Rod Burns
  • 2,104
  • 13
  • 24