clBuildProgram - Invalid Operation

Discussion created by alexaverbuch on Sep 22, 2009
Latest reply on Sep 23, 2009 by alexaverbuch


I'm getting an error while trying to build my OpenCL program, and would be grateful if someone could provide any suggestions.

Please see attached code for an extract of the offending code.

When calling clBuildProgram I get a CL_INVALID_OPERATION error. In the OpenCL spec (version 1.0.43) this error is described as:

"if the build of a program executable for any of the devices listed in device_list by a previous call to clBuildProgram for program has not completed __OR__ if there are kernel objects attached to program"

This is the first call to clBuildProgram in this execution, as I only call it once. Could the error be caused by a previous execution?!

I only have 1 Kernel object and have not created it yet at this point, so I don't see how it could be attached to the program.

Thanks in advance for any help.


commandQueue = clCreateCommandQueue( context, devices[0], 0, &status); const char * filename = ""; std::string sourceStr = convertToString(filename); const char * source = sourceStr.c_str(); size_t sourceSize[] = { strlen(source) }; program = clCreateProgramWithSource( context, 1, &source, sourceSize, &status); status = clBuildProgram(program, 1, devices, NULL, NULL, NULL); // <------- BOOM!!