Matrix multiplication issue
I need to multiply 2 square matrices (1024*1024). This following program is written by myself, I believe I am getting the correct output after the multiplication. Once compiled using the command “make emu=1”(Using NVIDIA SDK) I am getting a warning as “./matrixMulNew_kernel.cu(60): warning: expression has no effect”, here line no 60 begins with,
for(p=0,q=N-1; p<N, q>=0; ++p, q–){
sum = sum + a[p+(j*N)] * b[i+(q*N)];
}
Please go through my Kernel prog and let me know why I am getting the above warning. :rolleyes:
N= 1024
blocksize = 16;
===Kernel Program===
global void mul_matrix ( float* a, float* b, float* c, int N ) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
int index = i + jN;
float sum = 0;
int p,q;
for(p=0,q=N-1; p<N, q>=0; ++p, q–){
sum = sum + a[p+(jN)] * b[i+(q*N)];
}
c[index] = sum;
}
===Kernel invocation code===
dim3 dimBlock( blocksize, blocksize );
dim3 dimGrid( N/dimBlock.x, N/dimBlock.y );
mul_matrix<<<dimGrid, dimBlock>>>( ad, bd, cd, N );
Here one thread is responsible for calculating a single value in matrix C