Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

clBuildProgram fails after clRetainProgram

I get CL_INVALID_OPERATION trying to build OpenCL program, but it compiles fine in AMD KernelAnalyzer 2. After a bit of debugging, I foound that the problem is caused by clRetainProgram. My code looks approximately as follows:

std::string source = <some source>;

cl_int errCode = 0;

cl_program program = clCreateProgramWithSource(context, 1, source.c_str(), 0, &errCode);

// clRetainProgram(program); // causes CL_INVALID_OPERATION in clBuildProgram

errCode = clBuildProgram(program, 0, 0, "-cl-fast-relaxed-math", 0);

Hope this will be helpful. I've attached program source code, just in case.

0 Replies