I want to launch multiple kernel function in cuda and so I am declaring two separate set of grids,block name and the values of each set is different. e.g:
dim3 gridDim_1(val_1,1);
dim3 blockDim_1(val_2,val_3);
dim3 gridDim_2(val_4,1);
dim3 blockDim_2(val_5,val_6);
for(i=0;i<somenum;i++)
{
kernel_1<<<gridDim_1,blockDim_1>>>(agr1,arg2);
kernel_2<<<gridDim_2,blockDim_2>>>(agr3,arg4);
}
But the compiler is throwing error saying error: gridDim_1 is unknown and similar for other declaration of blocks and grids. How then I could launch these 2 kernels with different names of grids and blocks? I need to mention here that the number of blocks in grids and number of threads in blocks depends on the user input somehow.Thanks for help.
Actually the main code is really big and I am also changing every now and then to get rid of the errors.I am posting a part of it only where I believe the problem lies :
int k,sim_step;
int counter_top,counter_bottom;
............
...................
for(k=0;k<=sim_step;k++)
{
dim3 gridDim(1,1);
dim3 blockDim(counter_top,1,1);
agent_movement_top<<<gridDim,blockDim>>>(args..) ;
dim3 gridDim(1,1);
dim3 blockDim(counter_bottom,1,1);
agent_movement_bot<<<gridDim,blockDim>>>(args...);
}
The current error that I am getting is: error LNK2001: unresolved external symbol _gridDim error LNK2001: unresolved external symbol _blockDim