Ubuntu CUDA driver only working when using graphics card for display

I am running Ubuntu 14.04 and have a Nvidia Geforce GTX 970.

I have successfully installed both the graphics card driver and the CUDA toolkit and have been using it successfully.

When I am actually using the graphics card as my display hardware as well, i.e. my monitor is plugged into my graphics card, this works without a problem.

I would however prefer to use my graphics card for GPU processing only and thus plug my monitor into my motherboard graphics card.

When I do this, however, it seems like I am unable to use my Geforce card and I get a CUDA error when I try to use the GPU.

Is this a known quirk?

I am sure it must be possible to use a GPU without it being plugged in?

Thank you in advance

Yes, it’s possible.

It would probably be helpful to know exactly what error is reported if you try to run a CUDA sample code like deviceQuery (in the failing state).

My guess is that your motherboard detects the presence of a monitor attached to the on-board graphics and automatically disables the GPU plugged into a PCIE slot.

Normally, without the above feature, you should not witness much difference between using the GPU when a display is plugged in vs. when no display is plugged in.

To help confirm this, when you have the monitor plugged into the onboard graphics, I would study the output of:

lspci |grep -i nvidia

and

dmesg |grep NVRM

It may be possible by entering the BIOS setup menu on your motherboard to modify this behavior. You’ll need to look for options which affect onboard graphics behavior.

Thank you txbob.

When I run deviceQuery I get:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

lspci |grep -i nvidia returns:

01:00.0 VGA compatible controller: NVIDIA Corporation GM204 [GeForce GTX 970] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GM204 High Definition Audio Controller (rev a1)

dmesg |grep NVRM returns:

loading NVIDIA UNIX x86_64 Kernel Module  384.98  Thu Oct 26 15:16:01 PDT 2017 (using threaded interrupts)

PS: I have CUDA toolkit 8.0

OK I think my theory was not correct.

what happens if you run deviceQuery as root?

sudo ./deviceQuery

?

Great, that seems to have worked. So it looks like it’s working now.

I also tested out the other application I was originally running and that’s also working now.

In my troubleshooting process I reinstalled both the CUDA toolkit and my graphics card driver, so I suspect it’s one of those things that fixed it.

Thank you very much for your assistance.

I am curious now why my system seems to be responding slowly when my GPU is running?

That was originally why I wanted to use the GPU only for GPU processing and free up the system graphics requirements.

But I see now there is no increase in speed of the GPU (as you hinted towards in your first comment), and my system is responding quite slowly. What would be the reason for that, since I am only using the GPU for one specific task, and that shouldn’t effect my CPU usage right?

I’m not certain what is happening in your case, but one possible issue preventing things from working (unless root) is a device file permissions issue as described here:

http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-verifications

When X is managing the display (as would be the case when your monitor is plugged into the GTX 970) then the device files and permissions are automatically set by X, and the above item is not relevant. But if you are not running X on that GPU, it could be an issue. When you run as root, you also bypass any permissions issues.

At the moment I don’t have any theories on this:

I don’t really know what you mean by “responding slowly”, or "I see now there is no increase in speed of the GPU "

I think the permissions issue might be because th CUDA toolkit is installed in /usr/local, perhaps if it is installed in home, it wouldn’t need permissions, but that is not really a problem.

With ‘responding slowly’, I mean that desktop applications, such as viering a PDF in Evince, is very ‘laggy’ and responds slowly, similarly for other application.

With “increase in GPU speed” I meant that I thought that since the GPU was also used for my monitor, it might work faster if I only use it for GPU processing and use my onboard graphics card for my monitor, i.e. free up resources for the GPU.

I hope that is more clear.

Regards

I guess if you are running the display from integrated motherboard graphics, and it is responding slowly, that has nothing to do with NVIDIA.

I would think the same, except that when I stop the GPU process, the system response returns to normal.

In any case, that is not important and I fixed my original problem, so thank you once again.

Regards