Hello
I have a c++ class, which invokes a function in a .cu file.
In that .cu file, my function tries to launch a kernel
void multiplyCuda( ARRAY2F A, ARRAY2F B, ARRAY2F &C){
float* Ad = A.dData;
float* Bd = B.dData;
float* Cd = C.dData;
dim3 threads( BLOCKSIZE,BLOCKSIZE );
dim3 grid(A.width/BLOCKSIZE,A.height/BLOCKSIZE );
multiplyKernel<<<grid, threads>>>( Ad, Bd, Cd );
}
My kernel looks like
__global__ void addKernel( float *A, float *B, float *C){
int index = (blockDim.x*blockIdx.x)+threadIdx.x;
C[index]=A[index] + B[index];
}
but all i get while compiling the project is:
line 73: error: call can not be configured
What did i wrong?
First of all your kernel name is different from what you have in your .cu file :)
I think line 73 is where you do your kernel invocation in you cpp file?
You cannot invoke your kernel like this. You need to build a wrapper function around your kernel that can be called. It is not possible to call it like this.
try something like this:
this part will come in your .cu file
void addKernel_wrapper(float *Ad, float *Bd, float *Cd) {
addKernel<<<block, grid>>>(Ad, Bd, Cd);
}
Also make a .h file for your .cu so you can include the .h file in your .cpp file
then just call the wrapper from inside the .cpp file
That should do the trick.
PS. there could be some errors if you copy/paste this but this is the idea behind it. :)