我目前正在进行一个使用 SYCL 将不锐利蒙版应用于图像的项目。我的机器里面有一个NVIDIA和一个Intel GPU。我从以下代码开始:
default_selector deviceSelector;
queue myQueue(deviceSelector);
问题是代码行"default_selector deviceSelector;"会自动抓取我机器内的 NVIDIA GPU,这会破坏以下所有代码,因为 SYCL 不适用于 NVIDIA。
因此,我的问题是 - 如何强制"default_selector deviceSelector;"获取我的英特尔 GPU 而不是 NVIDIA GPU?也许我可以这样说:
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
从而使代码跳过 NVIDIA GPU 并保证选择我的英特尔 GPU。
您正在检查扩展包含一个名为"英特尔"的条目,它不会。 扩展是设备支持的内容,例如 SPIR-V 您可以通过在命令行调用 clinfo 来查看支持的扩展。要选择英特尔 GPU,您需要检查设备制造商以选择正确的设备。
所以在自定义设备选择的示例代码中 https://github.com/codeplaysoftware/computecpp-sdk/blob/master/samples/custom-device-selector.cpp#L46
你只需要有类似的东西
if (device.get_info<info::device::name>() == "Name of device") {
return 100;
}
您可以打印出
device.get_info<info::device::name>
以获取要检查的值。