I did a bit of work in OpenCL, but recently, "clBuildProgram" failed to execute in one of my programs. The following is a snippet of code:
cl_program program; program = clCreateProgramWithSource(context, 1, (const char**) &kernel_string, NULL, &err); if(err != CL_SUCCESS) { cout<<"Unable to create Program Object. Error code = "<<err<<endl; exit(1); } if(clBuildProgram(program, 0, NULL, NULL, NULL, NULL) != CL_SUCCESS) { cout<<"Program Build failed\n"; size_t length; char buffer[2048]; clGetProgramBuildInfo(program, device_id[0], CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &length); cout<<"--- Build log ---\n "<<buffer<<endl; exit(1); }
Usually, I used to get syntax or other errors inside the kernel file here using the function "clGetProgramBuildInfo ()" whenever "clBuildProgram" worked, but when this program starts, it only prints to the console:
Error building program --- Build a log ---
And when I tried to print the error code returned by the "clBuildProgram" command; it's "-11" ...... What could be the problem with my kernel file that I am not getting information about a build failure?
Akhtar ali
source share