The following c++ SYCL code works only using host device, using GPU device (NVIDIA or INTEL) I have the following error:
No kernel named _ZTSZZN10MainWindow15testPerformanceEiENKUlRN2cl4sycl7handlerEE_clES3_E10FillBuffer was found -46 (CL_INVALID_KERNEL_NAME)
thanks in advance.
std::vector<sycl::platform> all_platforms = sycl::platform::get_platforms();
cl::sycl::device selectedDevice;
if (all_platforms.size()==0)
{
std::cout<<" No platforms found. Check OpenCL installation!\n";
return;
}
for(size_t i = 0; i < all_platforms.size(); i++)
{
sycl::platform current_platform = all_platforms[i];
std::vector<sycl::device> all_devices = current_platform.get_devices();
// Loop over all devices available from this platform.
for( const cl::sycl::device& device : all_devices )
{
QString type;
if(device.is_gpu())
{
selectedDevice = device;
break;
}
}
}
sycl::queue myQueue(selectedDevice);
try
{
myQueue.submit([&](sycl::handler &h) {
sycl::stream os(1024, 768, h);
h.parallel_for<class FillBuffer>(32, [=](sycl::id<1> i) {
os<<i<<"\n";
});
}).wait();
}
catch (cl::sycl::exception ex)
{
std::cout << "cl::sycl::exception+: " << ex.what() << " category: " << ex.category().name() << std::endl;
return;
}
The problem was releated to qmake autogenerated Makafile parameter order
WRONG WAY (auto generated):
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<<
debug\main.obj debug\mainwindow.obj debug\moc_mainwindow.obj
$(LIBS)
<<
CORRECT WAY:
$(LINKER) debug\main.obj debug\mainwindow.obj debug\moc_mainwindow.obj $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<<
$(LIBS)
<<