0

In my Ubuntu 20.04 version, we have installed intel one API dpc++. The version is; Intel(R) one API DPC++/C++ Compiler 2022.1.0 (2022.1.0.20220316)

  • Where we have nvidia gpu. (Got to know by command: nvidia-smi) There we have NVIDIA GeForce ... On

  • We are trying to select GPU using gpu_selector method. It is giving runtime error like CL_DEVICE_NOT_FOUND in dpc++. whereas cpu_selector is working fine.

Please check the below methods and help me. Thanks

Program:

#include<iosteam>
#include<CL/sycl.hpp>
#include<CL/sycl/device_selector.hpp>
    
int main()
{
    cl::sycl::queue q(sycl::gpu_selector{});
    std::cout<<"Running on"<<q.get_devicee().get_info<cl::sycl::info::device::name>();
    return 0;
}

2nd Method

    device d;
    d = device(gpu_selector());
    std::cout<<"Gpu info: "<<d.get_info<sycl::info::device::name();

3rd Method

    sycl::device dev = sycl::gpu_selector().select_device();
    std::cout<<"GPU info: "<<dev.get_info<sycl::info::device::name>()<<std::endl;<<dev.get_info<sycl::info::device::vendor()<<std::endl;

output for all the methods:

terminate called after throwing an instance of 'cl::sycl::runtime_error' intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.htmo -1 (CL_DEVICE_NOT_FOUND)
Aborted (core dumped)
paleonix
  • 2,293
  • 1
  • 13
  • 29
  • 1
    Do you have also have an Intel GPU on your system? The selector probably can only find that because you do not have the built version of DPC++ with the Nvidia support. See this answer for how to use the Nvidia GPU support in DPC++ https://stackoverflow.com/questions/70656634/cannot-find-libspirv-nvptx64-nvidiacl-bc-when-used-intel-clang-to-build-binar/70663942?noredirect=1#comment125503827_70663942 – Rod Burns Jun 17 '22 at 10:13
  • 1
    Rod’s answer is the right one. Basically you need to run Codeplay’s SYCL->CUDA compiler. SYCL allows to compile and run on various backend hardware, but you still need to use the right compiler. For NVIDIA hardware the right solution is Codeplay – TonyM Jun 20 '22 at 12:42

0 Answers0