Newbie idiot program crashes linux Crashing Linux


Just started hacking cuda stuff. I haven’t got very far; so this code below likely appears like an idiot wrote it… Yes, I do know that the pointer myInt is not in device memory…

None the less, when I run it, the mp3 player stops, and if I’m lucky enough hitting ctrl-c in time prevents the OS from locking up.

I suspect that there may be a bug in the driver as user mode code probably shouldn’t lock linux up…

#include <stdio.h>
//#include <cutil.h>

global void myTest(int* myInt) {
*myInt = 32;

int main() {
printf(“Hello world\n”);

int testInt = 0;

dim3 threads = dim3(1,1); // 1 block
dim3 blocks = dim3(1, 1); // 1 thread

myTest<<<blocks,threads, 0, 0>>>(&testInt);

printf(“testInt is: %d\n”, testInt);

I compiled it with nvcc (to a.out).

I’m using a GeForce 8800GT on a dual opteron (x86_64) running Fedora core 6, and NVIDIA driver version 169.07.


Does Linux lock up permanently, or only for approx. 5 seconds?

(5-seconds lockups are normal.)

If this problem persists with 169.12, please generate and attach an nvidia-bug-report.log.

I ran the program twice:

On the first run, I hit ctrl-c immediately; the mouse was still moving, even though audio output had ceased (I was playing mp3s at the time).

On the second run the program hung, the mouse stopped moving. Ctrl-Alt-F1 did not swtich from X to console 1. Ctrl-Alt-Backspace did not kill X. I pressed the reset button after that. I did not try logging in remotely from another machine.


Ok - Ill upgrade right now.



Definite improvement with 169.12; however, the system still shows odd behaviour. I ran the program about five times in a row - this is what I observed:

Run 1: Ran, and returned after a couple of seconds reporting “Hello world\ntestInt is:0\n” (as expected, as the pointer was not in device memory).

Run 2: Mp3 player stopped for circa 5 seconds, and then returned the expected response.

Run 3: Identical to run 1

Run 4: Identical to run 2

Run 5: This time the program printed out “Hello world” (as expected), then generated slew of carriage return characters, then returned testInt is: 0. Perhaps the return address is getting munged on the stack; perhaps there is other voodoo at the driver layer . . . .

I’ve attached a crash log for you.

(I’ve also fixed my defective experimental code for more cuda learning…)


nvidia_bug_report.txt (228 KB)

I notice that after your kernel invocation you do not wait in the CPU mainline code for the kernel(s) to finish.

AFAIK the kernel invocation is async and your main() might return before the kernel does(? maybe some Nvidia admin will correct me.). I was able to generate weirdness like you describe by not waiting.

Try this in main():

kernel<<< g, b, ns >>>( … ); // what ever your kernel command is.
cudaThreadSynchronize(); // wait for the kenel to finish