sycl get_devices() 返回仅CPU,而我有集成的Intel Iris xe和独立的NVIDIA GPU。

huangapple go评论77阅读模式
英文:

sycl get_devices() return just the CPU while I have an integrated Intel Iris xe and a dedicated nvidia GPU

问题

I'm here to provide the translation of your text. Here's the translated content:

"目前,我正在使用DPC++进行项目开发。之前我在Intel DevCloud上工作了一段时间,使用计算资源没有任何问题。当我选择GPU时,它按预期工作。然而,出于隐私原因,我需要在我的本地机器上运行SYCL代码。因此,我安装了Intel oneAPI基本工具包。编译代码没有问题,但当我需要将内核卸载到GPU时出现问题。我将我的队列声明如下:
sycl::queue q(sycl::gpu_selector_v);
我在代码中使用gpu_selector_v,因为gpu_selector{}已经过时了。
这行代码引发了运行时异常,显示以下消息:
**没有可用的所请求类型的设备 'info::device_type::gpu'。请检查https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND)**

实际上,除了集成的Intel Iris Xe外,我还有一块NVIDIA GeForce MX450。因此,我认为SYCL选择器应该选择NVIDIA GPU(在最坏的情况下,应该选择Iris Xe GPU)。

在尝试解决问题时,我认为问题与NVIDIA驱动程序有关,因此我安装了NVIDIA驱动程序(使用Ubuntu 22.04 LTS中的软件和更新)。不幸的是,问题仍然存在。然后,我尝试查询可用设备。我使用以下代码进行了查询:

#include <CL/sycl.hpp>

int main()
{
       for (auto platform : sycl::platform::get_platforms())
       {
           std::cout << "平台:"
           << platform.get_info<sycl::info::platform::name>()
           << std::endl;
           for (auto device : platform.get_devices())
           {
              std::cout << "\t设备"
                      << device.get_info<sycl::info::device::name>()
                      << std::endl;
           }
       }
    
    sycl::queue q(sycl::gpu_selector_v); 
    std::cout << "运行在设备上:" << q.get_device().get_info<sycl::info::device::name>();

}

上述代码的输出如下:
平台:Intel(R) FPGA仿真平台用于OpenCL(TM)
设备:Intel(R) FPGA仿真设备
平台:Intel(R) OpenCL
设备:11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
在抛出'sycl::_V1::runtime_error'实例后调用terminate
what(): 找不到所请求类型的设备 'info::device_type::gpu'。请检查https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND)
已中止(核心已转储)

附加信息,可能有用:

  • 在安装oneAPI基本工具包时,我没有安装v-tune和advisor(因为我目前不需要它们,而且它们很大)。
  • 我没有在Windows上尝试相同的代码(我正在双引导[Ubuntu 22.04,Windows 10])。

我的问题是:我在这里错过了什么?为什么选择器无法找到我的GPU?"

英文:

Currently I am working in a projet using DPC++. I have worked for a while in the Intel DevCloud. I haven't any problem using computing ressources. When I select a gpu, it works as expected. However, for privacy reasons I need to run sycl code in my machine. So I have installed the Intel oneApi base ToolKit. Compiling the code works fine, the problem arises when I need to offload my kernel in the GPU. I declare my queue as follow:
sycl::queue q(sycl::gpu_selector_v);
I am using gpu_selector_v in my code because the gpu_selector{} is depricated.
This line of code throws a runtime exception with the following message:
**No device of requested type 'info::device_type::gpu' available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND)
**

In fact, in addition to the integrated Intel Iris xe, I have a NVIDIA GeForce MX450. Therefore, I think sycl selector should select the nvidia gpu (In the worst cases, it should select the iris xe GPU).

While trying to troubleshoot the problem, I tought the issue is related to nvidia drivers, so I installed nvidia drivers (using software & updates in ubuntu 22.04 lts). Unfortunalty, the issue still exists. Then, I tried to query the available devices. I have done this using the following code

#include <CL/sycl.hpp>

int main()
{
       for (auto platform : sycl::platform::get_platforms())
       {
           std::cout << "Platform: "
           << platform.get_info<sycl::info::platform::name>()
           << std::endl;
           for (auto device : platform.get_devices())
           {
              std::cout << "\tDevice: "
                      << device.get_info<sycl::info::device::name>()
                      << std::endl;
           }
       }
    
    sycl::queue q(sycl::gpu_selector_v); 
    std::cout << "Running on Device: " << q.get_device().get_info<sycl::info::device::name>();

}

The output of the above code is the following:
Platform: Intel(R) FPGA Emulation Platform for OpenCL(TM)
Device: Intel(R) FPGA Emulation Device
Platform: Intel(R) OpenCL
Device: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
what(): No device of requested type 'info::device_type::gpu' available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND)
Aborted (core dumped)

Addition information. they may be useful:

  • During the installation of oneapi base toolkit. I have not installed the v-tune and the advisor (Because I don't need them at the moment, and the are huge).
  • I have not tried the same code in windows (I am running a dual boot [ubuntu 22.04, windows 10])

My question is : what am I missing here ? Why the selector is not able to find my gpu?

答案1

得分: 1

请参考 Data Parallel C++ 第45页中的信息。您可以尝试使用从 device_selector 类派生的自定义设备选择器,在系统中可用的一组 GPU 类型中选择所需的 GPU 以进行卸载操作。

您的系统中是否安装了最新的图形驱动程序?请尝试安装最新的图形驱动程序,然后告诉我们问题是否仍然存在。您可以从以下链接下载它。
https://www.intel.com/content/www/us/en/download/726609/intel-arc-iris-xe-graphics-whql-windows.html

英文:

You can try with Custom Device Selector derived from device_selector class in DPCPP. It can be used when you want to select a desired GPU for offloading from a set of GPU types available in a system.
Please refer to the Data Parallel C++ Page no: 45 for more details.

Do you have the latest graphics drivers in your system? Please try to install the latest graphics drivers in your system and let us know if the issue still persists. You could download it from the link below.
https://www.intel.com/content/www/us/en/download/726609/intel-arc-iris-xe-graphics-whql-windows.html

huangapple
  • 本文由 发表于 2023年4月6日 19:08:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75948825.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定