Reputation: 123
I have written a code in OpenCL. There is an error while building the kernel program. The error code is -11. I tried printing the BUILD LOG but it does not print a proper log but instead it generates some random variables. Here is that part
//these are variable declarations
cl_device_id* devices;
cl_program kernelprgrm;
size_t size;
//these varaibles have already been assigned properly
//main code
clGetProgramBuildInfo(kernelprgrm,devices[i], CL_PROGRAM_BUILD_LOG ,0,NULL,&size);
char *buildlog=(char*)malloc(size);
clGetProgramBuildInfo(kernelprgrm,devices[i], CL_PROGRAM_BUILD_LOG ,size,buildlog,NULL);
printf("\n\nBuildlog: %s\n\n",buildlog);
It gives the following output :-
Buildlog: ���0
Please help me in getting a proper build log. Thanks
Upvotes: 3
Views: 4668
Reputation: 1814
I tested this code on my machine and it works ok:
size_t len = 0;
cl_int ret = CL_SUCCESS;
ret = clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
char *buffer = calloc(len, sizeof(char));
ret = clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, len, buffer, NULL);
As soon as it looks pretty much like your code, there are 2 differences, which may produce error:
Upvotes: 3