about shared memory

First, sorry to my short english grammer…

I am trying to learn a CUDA by myself and I am the beginner about CUDA.

These days I tried to practice shared memory to make a convolution.

Below is part of my code…

global void convolutionGPU(unsigned char *d_Result, unsigned char *d_Data, unsigned char *d_filter, int dataW, int dataH)

__shared__  unsigned char data[256+KERNEL_RADIUS][256+KERNEL_RADIUS];
const int gLoc = threadIdx.x + (blockIdx.x*blockDim.x) + (threadIdx.y * 512) + (blockIdx.y*blockDim.y)*512;

int x,y;

const int x0=threadIdx.x+(blockIdx.x*blockDim.x);
const int y0=threadIdx.y+(blockIdx.y*blockDim.y);


if(x<0 || y<0)


When I run the progrram. there’s a error, mentioned like this,

LINK : fatal error LNK1181: ‘.\Debug\convolution.obj’

and it said it is not possible to open the input file.

I don’t know why this things happen…

Is there any one who can let me why this things happen and teach me how to use shared memory?

(That error is come because of data[threadIdx.x][threadIdx.y] parts.)

Thank you for reading until here.

__shared__ unsigned char data[256+KERNEL_RADIUS][256+KERNEL_RADIUS];

so you declare > 64K byte sheared memory, this is impossible

since total amount of shared memory is 16K byte.

I think that nvcc would report error in compilation phase, not linking phase

yeah sometimes you do get it during linking phase. It can throw you off

LSChien, Ian Wainwright, thanks a lot for teaching. I will try again. Have a nice day~^^