Problem with cudaMemcpyToSymbol

I’m trying to execute this program, but when it execute the cudaMemcpyToSymbol I got this message"invalid device symbol". A piece of code has been copied.

In the Header

typedef struct{

	unsigned short ordre;

	double coefficient[FIRCOEFFSIZE];

	unsigned short inputLength;


In the .cu

a Part of Main

static __device__ __constant__ FILTRE GPUcoeff;
FILTRE filtre;

	filtre.ordre = FIRCOEFFSIZE;

	filtre.coefficient[0] = 1; 

	filtre.inputLength = SHAPEDLEN+(DELAY*2);

	matchedFilter(dataQ, &filtre, &fs, dimBlock, dimGrid);

a Part of matchedFilter function

void matchedFilter(double *shaped, FILTRE* fir1, double *fs, dim3 dimBlock, dim3 dimGrid)


	//Declaration of GPU's variable in ****

	double *GPUShape;

	double *GPUFs;


	//Load data in GPU's constant memory

	cutilSafeCall(cudaMemcpyToSymbol("GPUcoeff", &fir1, sizeof(FILTRE)));

Is the symbol declared in the same compilation unit as the function call? If it isn’t, you to refactor your code or add a wrapper function to get the access to symbol, because all symbols have to be defined in the same compiation unit where they are used. Also, you are missing a couple for arguments in the call itself - as per here there has to be an offset and direction arguments supplied.

Thank you for your help, but I found my problem. I replace the flag argument -arch=compute_13 by -arch=compute_20.

have a good day! :biggrin: