thank you for your answers and information. I still cannot figure it out and the problem is a bit too strange to me. Let me change the problem description.
I have to kernels (independent from each other), which are empty and do not do anything. They look like:
__kernel void mutualInformation(
__global float *d_Dst,
__global float *d_Entropies1,
__global float *d_Entropies2,
__global float *d_EntropiesJoint,
__local float *ldata,
unsigned int histoSize,
unsigned int normalizeMI
){
// an empty kernel...
}
__kernel void mutualInformation2(
__global float *d_Src,
__global float *d_Entropies1,
__global float *d_Entropies2,
__global float *d_EntropiesJoint,
unsigned int histoSize,
float densitySize
){
//another empty kernel
}
This code above works fine and I dont get any errors. Especially I dont get any errors after following statements:
shrLog(LOGBOTH, 0.0, "Building program...
");
errcode = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL);
shrCheckError(errcode, CL_SUCCESS);
shrLog(LOGBOTH, 0.0, "Creating kernels...
");
ckMutualInformation = clCreateKernel(cpProgram, "mutualInformation", &errcode);
shrCheckError(errcode, CL_SUCCESS);
ckMutualInformation2 = clCreateKernel(cpProgram, "mutualInformation2", &errcode);
shrCheckError(errcode, CL_SUCCESS);
Here everything is fine and by debugging at that position all errcode is 0.
Now I add one more parameter at the end of the second kernel.
__kernel void mutualInformation(
__global float *d_Dst,
__global float *d_Entropies1,
__global float *d_Entropies2,
__global float *d_EntropiesJoint,
__local float *ldata,
unsigned int histoSize,
unsigned int normalizeMI
){
// an empty kernel...
}
__kernel void mutualInformation2(
__global float *d_Src,
__global float *d_Entropies1,
__global float *d_Entropies2,
__global float *d_EntropiesJoint,
unsigned int histoSize,
float densitySize,
__local float *ldata,
){
//another empty kernel
}
Here I also add the 7. kernel argument for the second kernel with appropriate local memory size of 1 KB, like:
clSetKernelArg(ckMutualInformation2, 7, 256 * sizeof(cl_float), NULL);
But now, if I do so, then I get errcode for the FIRST kernel, which I didnt touched.
shrLog(LOGBOTH, 0.0, "Building program...
");
errcode = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL);
shrCheckError(errcode, CL_SUCCESS);
shrLog(LOGBOTH, 0.0, "Creating kernels...
");
ckMutualInformation = clCreateKernel(cpProgram, "mutualInformation", &errcode);
(DEBUG POINT) shrCheckError(errcode, CL_SUCCESS);
ckMutualInformation2 = clCreateKernel(cpProgram, "mutualInformation2", &errcode);
shrCheckError(errcode, CL_SUCCESS);
Now by debugging , I see that errcode is -47 by (DEBUG POINT) , which is after clCreateKernel of the first kernel. But I didnt change anything by the first kernel. I really cannot understand why I get this error for the first kernel which is still the same and not by the second kernel? and if I change the row like:
shrLog(LOGBOTH, 0.0, "Building program...
");
errcode = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL);
shrCheckError(errcode, CL_SUCCESS);
shrLog(LOGBOTH, 0.0, "Creating kernels...
");
ckMutualInformation2 = clCreateKernel(cpProgram, "mutualInformation2", &errcode);
shrCheckError(errcode, CL_SUCCESS);
ckMutualInformation = clCreateKernel(cpProgram, "mutualInformation", &errcode);
(DEBUG POINT) shrCheckError(errcode, CL_SUCCESS);
Then I still dont get errcode -47 for second kernel (I get errcode 0) , but -47 again for only first kernel.
This problem is very strange to me and I still cannot figure it out why???