Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed the nvidia 331.38 driver on a laptop with a gt 650m and optimus. I followed the guide here, How can I get nVidia CUDA or OpenCL working on a laptop with nVidia discrete card/Intel Integrated Graphics? to install cuda, but cannot run the sample vector addition program provided by nvidia. The programs compile fine, but when I run them, e.g. vectorAdd, I am given

Failed to allocate device vector A (error code no CUDA-capable device is detected)!

Why is this happening?


$ lspci | grep -i nvidia


01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 650M] (rev a1)

deviceQuery returns

cudaGetDeviceCount returned 38
 -> no CUDA-capable device is detected
Result = FAIL
share|improve this question
What happens when you run deviceQuery.cu? –  Jamie May 7 '14 at 21:00
@Jamie it gives an error. Please check my edits –  user1876508 May 7 '14 at 21:04
That probably means you didn't install / aren't currently running the CUDA driver. (You might need to disable the nvidia drivers first.) I think the guide you posted walks you through this step –  Jamie May 7 '14 at 21:07
It said that I should NOT install the CUDA driver from nvidia, just the toolkit. I have the toolkit installed in /opt/cuda/. All of the files that should be there are. –  user1876508 May 9 '14 at 18:56
Are we looking at the same guide? The one you linked (this) recommends to install the CUDA driver from Ubuntu's package manager. No matter where you get it, to run cuda you need a cuda driver. –  Jamie May 9 '14 at 23:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.