Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does this cuda program freeze my display?

Tags:

c++

cuda

nvidia

I am new to CUDA and I was just trying to make a program which utilized a lot of my GPU. The only issue was that I am also using the card for my display and this froze my screen and required me to reboot.

__global__ void cuda_burn(int* sum)
{
    int x = 0;
    for(int i = 0; i < 1000000000; i++)
    {
        x += i;
    }
    atomicAdd(sum, x);
}

I originally launched it like cuda_burn<<<1024, 1024>>>(sum_d); which killed my display. This makes sense to me because I have enough blocks and threads to fully utilize my gpu which leaves no time for the graphics.

Next I tried to launch it like this cuda_burn<<<1, 1024>>>(sum_d); I thought that since I was only using one block that it would not be able to fully utilize the GPU resources and not freeze my display. Unfortunately it still did. Why?

What is also strange is the the mouse does not freeze?

Also is there a better way of unfreezing the display than rebooting?

like image 207
chasep255 Avatar asked Apr 28 '26 21:04

chasep255


1 Answers

Currently, CUDA and display tasks cannot run at the same time. While a CUDA kernel is running, regardless of how much or how little it uses the GPU, display tasks will be "frozen".

like image 67
Robert Crovella Avatar answered Apr 30 '26 10:04

Robert Crovella



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!