invalid device function error: cudaErrorInvalidDeviceFunction

Hi Cuda Experts,

when calling kernel ‘asdf’ i get the cudaErrorInvalidDeviceFunction error.

after hours of experimenting with that problem, does anybody have a suggestion what the problem may be?

extern "C" void scatter_display(GLuint pbo, float *d_dataX, float *d_dataY, int noPoints, float viewMinValX, float viewMaxValX, float viewMinValY, float viewMaxValY, uint dimX, uint dimY, uint dimZ)


	dim3 blockSize0(dimX,1,1);

	dim3 gridSize0(dimY,dimZ,1);


	asdf<<<gridSize0, blockSize0>>>(d_dataX); 

	cudaError_t ce = cudaGetLastError();

	if(ce != cudaSuccess)



__global__ void asdf(float *d_dataX)


	uint idx = threadIdx.x +blockIdx.x*blockDim.x + blockIdx.y*blockDim.x*gridDim.x;

	d_dataX[idx] = d_dataX[idx]+1;




Is the kernel in the same file with the function that calls it? Because if it’s not, you might need to “include” it or declare the kernel as extern.

uh, do you have a declaration for the kernel before the invocation?

thanks tmurray & yamsha

yes, the kernel is declared at the beginning of the file.

yes, there is one single cu file…

basically, if added some #includes (cutil, runtime,…) and the declaration of the kernel, you’ve got the whole file already …

Hello again,

i’m still unable to figure out this problem… :wacko: I’ve made a simpler version that reproduces the error - any ideas???



Solved. There was another cuda call initializing a pbo which was wrong and somehow killed cuda. The code up there now works fine.

How to solve this? How do you identify what is from cuda and how do you clear them up?