1

I'm using a GeForce 9800 GX2. I installed drivers and the CUDA SDK i wrote simple program which look s like this:

__global__ void myKernel(int *d_a) { int tx=threadIdx.x; d_a[tx]+=1; cuPrintf("Hello, world from the device!\n"); } int main() { int *a=(int*)malloc(sizeof(int)*10); int *d_a; int i; for(i=0;i<10;i++) a[i]=i; cudaPrintfInit(); cudaMalloc((void**)&d_a,10*sizeof(int)); cudaMemcpy(d_a,a,10*sizeof(int),cudaMemcpyHostToDevice); myKernel<<<1,10>>>(d_a); cudaPrintfDisplay(stdout, true); cudaMemcpy(a,d_a,10*sizeof(int),cudaMemcpyDeviceToHost); cudaPrintfEnd(); cudaFree(d_a); } 

The code is compiling properly, but the kernel appear not to be launching... No message is printed from the kernel side. What should I do to resolve this?

4
  • 4
    You could start by adding some error checking. Every one of those API calls returns a status. You should check every one of them to see what error is being reported and where it is occurring. Commented Mar 1, 2012 at 15:57
  • Also, you did run the SDK sample code, right? Linux or Windows? Do the SDK samples compile and work? All of them? Commented Mar 1, 2012 at 16:30
  • I tried putting APIs to identify runtime error but it is showing no CUDA-capable device is detected in simple_device_call.cu at line 30...i'm using linux and SDL sample code is also not working Commented Mar 1, 2012 at 17:24
  • 4
    @user997704: So you have a non-working CUDA installation. Fix that before you worry about this code. Commented Mar 1, 2012 at 19:25

1 Answer 1

1

Given that in your comments you say you are getting "No CUDA-capable device" that implies that either you do not have a CUDA-capable GPU or that you do not have the correct driver installed. Given that you say you have both, I suggest you try reinstalling your driver to check.

Some other notes:

  1. Are you trying to do this through Remote Desktop? That won't work since with RDP Microsoft uses a dummy display device in order to forward the display remotely, the Tesla GPUs support TCC which allows RDP to work by making the GPU behave as a non-display device, but with display GPUs like Geforce this is not possible. Either run at the console or login at the console and use VNC.
  2. Also try running the deviceQuery SDK code sample to check that it detects your GPU and driver/runtime version correctly.
  3. You should check all CUDA API calls for errors.
  4. Call cudaDeviceSynchronize() before cudaPrintfDisplay().
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.