Hello there!
I’m here again asking about SYCL, recently I attended the IWOCL 2021 (amazing by the way). Today I decided to work with ComputeCpp 2.5 and just for fun I tried to run the Code Exercises from the IWOCL 2021: SYCL tutorial
and I noticed that Exercise 03 and Exercise 05 did not work.
The Exercise 05 with verbose mode gives me this error message:
ComputeCpp> (CE 2.5.0 2021/04/23 )
ComputeCpp> (Selected Platform: Intel(R) OpenCL HD Graphics )
ComputeCpp> (Selected Device: Intel(R) UHD Graphics 630 [0x3e9b] )
Chosen device: Intel(R) UHD Graphics 630 [0x3e9b]
ComputeCpp> Error: [ComputeCpp:RT0102] The requested kernel name could not be found (Unable to retrieve kernel function, is integration header included? )
ComputeCpp> -> Triggered at: program.h (491)
Exception caught: Error: [ComputeCpp:RT0102] The requested kernel name could not be found (Unable to retrieve kernel function, is integration header included? )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main2.exe is a Catch v2.12.1 host application.
Run with -? for options
-------------------------------------------------------------------------------
intel_gpu_device_selector
-------------------------------------------------------------------------------
solution.cpp:37
...............................................................................
solution.cpp:74: FAILED:
REQUIRE( r == 42 )
with expansion:
0 == 42
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
Additionally I decided to writhe this program:
#include<CL/sycl.hpp>
#include
class intel_gpu_selector : public sycl::device_selector {
public:
int operator()(const cl::sycl::device& dev) const override {
if (dev.has(cl::sycl::aspect::gpu)) {
auto vendorName = dev.get_info<cl::sycl::info::device::vendor>();
if (vendorName.find("Intel") != std::string::npos) {
return 1;
}
}
return -1;
}
};
int main(){
auto Q = cl::sycl::queue{intel_gpu_selector{}};
//cl::sycl::device
std::cout << "Chosen device: "
<< Q.get_device().get_info<cl::sycl::info::device::name>()<<std::endl;
//Create a buffer of 4 doubles and initialize it from a host pointer
double mat1[4] = {1.2,2.2,3.3,4.4};
double mat2[4] = {1.2,2.2,3.3,4.4};
double mat3[4] = {0.0,0.0,0.0,0.0};
constexpr int N = 4;
{
cl::sycl::buffer<double, 1> buff1{mat1, cl::sycl::range<1>{4}};
cl::sycl::buffer<double, 1> buff2{mat2, cl::sycl::range<1>{4}};
cl::sycl::buffer<double, 1> buff3{mat3, cl::sycl::range<1>{4}};
//
Q.submit([&](cl::sycl::handler &cgh){
auto acc_mat1 = buff1.get_access<cl::sycl::access::mode::read>(cgh);// Accessor for Mat1
auto acc_mat2 = buff2.get_access<cl::sycl::access::mode::read>(cgh); //Accessor for mat2
auto acc_mat3 = buff3.get_access<cl::sycl::access::mode::write>(cgh); //Accessor for mat3
cgh.parallel_for(cl::sycl::range<1>(N), [=](cl::sycl::id<1> index){
acc_mat3[index] = acc_mat1[index] + acc_mat2[index];
});
});
}
for(int i=0; i<4; i++)
std::cout<<"mat3 = "<<mat3[i]<<std::endl;
return 0;
}
But the error message with verbose mode is the same
ComputeCpp> (CE 2.5.0 2021/04/23 )
ComputeCpp> (Selected Platform: Intel(R) OpenCL HD Graphics )
ComputeCpp> (Selected Device: Intel(R) UHD Graphics 630 [0x3e9b] )
Chosen device: Intel(R) UHD Graphics 630 [0x3e9b]
ComputeCpp> Error: [ComputeCpp:RT0102] The requested kernel name could not be found (Unable to retrieve kernel function, is integration header included? )
ComputeCpp> -> Triggered at: program.h (491)
terminate called after throwing an instance of 'cl::sycl::invalid_object_error'
Aborted (core dumped)
NOTE: The errors above did not show when I use the CPU device
I’m compiling in this way since I have ComputeCpp in my computer:
compute++ function_evaluation.cpp -I /usr/local/computecpp2.5/include/ -lOpenCL -L /usr/local/computecpp2.5/lib/ -lComputeCpp -std=c++17 -o main.exe -DSYCL_LANGUAGE_VERSION=2020
Thanks for your help!
-Juan