Really simple example not working

** figured it out, see below **

Does anyone know why the following function works in CPU emulation mode, but not on my GPU? I’m running an GeForce 8800 GT. When I run the code in emulation mode, it correctly sets each pixel in the image to blue. The GPU blacks out the entire image. There is an error string returned: “invalid device function” – and if I comment out the entire body of GPUIdentity (below), it still throws this error! I’m a total CUDA noob but an experienced C++ developer, and I feel like I’m probably missing something really simple. Thanks in advance!

[codebox]#if __DEVICE_EMULATION__
bool InitCUDA(){return true;}


bool InitCUDA()


	int count = 0;

	int i = 0;


	if(count == 0) {

		fprintf(stderr, "There is no device.\n");

		return false;


	for(i = 0; i < count; i++) {

		cudaDeviceProp prop;

		if(cudaGetDeviceProperties(&prop, i) == cudaSuccess) {

			if(prop.major >= 1) {





	if(i == count) {

		fprintf(stderr, "There is no device supporting CUDA.\n");

		return false;



	printf("CUDA initialized.\n");

	return true;




Fixed it - using the VS CUDA add-in, I needed to set Project properties -> Configuration properties -> CUDA -> Output -> Intern Mode = Real.