** 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;
cudaGetDeviceCount(&count);
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) {
break;
}
}
}
if(i == count) {
fprintf(stderr, "There is no device supporting CUDA.\n");
return false;
}
cudaSetDevice(i);
printf("CUDA initialized.\n");
return true;
}
[/codebox]