tomhumphrey
tomhumphrey

Reputation: 17

Errors in OpenCL kernel code at runtime

I am new to Visual Studio and I am using it to write a simple parallel sorting program using OpenCL. When I run it, I get a line before my output (i.e. from before I receive and print the result buffer) saying "5 Errors Generated.". I assume this is telling me that I have errors in my kernel file, and if I deliberately write errors in my kernel file that number increases.

I would really like to know what those errors are so I can correct my program. Being unfamiliar with VS I simply cannot find them listed anywhere. Does anyone know where I can find what errors are being generated. Thanks

Upvotes: 1

Views: 806

Answers (1)

DarkZeros
DarkZeros

Reputation: 8410

You need to call clGetProgramBuidlInfo asking for the CL_PROGRAM_BUILD_LOG in order to get the runtime errors of the compiler.

char result[4096];
size_t size;
clGetProgramBuildInfo( program, device, CL_PROGRAM_BUILD_LOG, sizeof(result), result, &size);
printf("%s\n", result);

Upvotes: 2

Related Questions