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 haveNVIDIA GeForce ... On
We are trying to select GPU using
gpu_selector
method. It is giving runtime error likeCL_DEVICE_NOT_FOUND
in dpc++. whereascpu_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)