5

I am very very new to CUDA programming. I am going through the examples that came with the SDK. I was able to compile the code, but when I run it, I get the following error:

"clock.cu(177) : CUDA Runtime API error 38: no CUDA-capable device is detected".

I have GeForce 8400M GS on my machine, and according to this list, it is a CUDA-supported GPU: http://developer.nvidia.com/cuda-gpus.

Levon
  • 138,105
  • 33
  • 200
  • 191
gmemon
  • 2,573
  • 5
  • 32
  • 37

2 Answers2

13

There are several things you can check to fix that error:

  1. Make sure that your /dev/nvidia*'s permission is 666 (crw-rw-rw-) and owner root:root

  2. If you installed the SDK using sudo, then you may need to change to root first to execute the code

  3. Make sure you've installed the compatible NVIDIA's driver available in CUDA zone for your CUDA Toolkit

ardiyu07
  • 1,790
  • 2
  • 17
  • 29
  • 1
    I dont have /dev/nvidia* at all. What should I do? – gmemon Jun 07 '12 at 05:19
  • what's your output for `/usr/bin/lspci | grep -y nvidia` and `cat /proc/driver/nvidia/version`? – ardiyu07 Jun 07 '12 at 05:24
  • The output of lspci is 01:00.0 VGA compatible controller: nVidia Corporation G86 [GeForce 8400M GS] (rev a1) I dont have nvidia directory in /proc/driver/. Does this mean the driver that came with the toolkit was not installed? – gmemon Jun 07 '12 at 05:28
  • yes, you may have to reinstall the driver.. or maybe the installation wasnt succeeded? – ardiyu07 Jun 07 '12 at 05:33
  • 2
    @gmemon:There is no driver that "comes with the toolkit". You have to separately download and install the NVIDIA drvier package, and make sure that any "competing" drivers like nouveau are completely uninstalled. – talonmies Jun 07 '12 at 05:34
  • @talonmies I know that no driver came with the toolkit. I meant the the driver CUDA downloads website asks you to download with the toolkit: http://developer.nvidia.com/cuda-downloads – gmemon Jun 07 '12 at 05:36
  • I disabled all competing drivers (existing nvidia driver and nouveau driver) and reinstalled the CUDA driver. Now, there is an nvidia directory in /proc/driver. The output of `"cat /proc/driver/nvidia/version"` is: `"NVRM version: NVIDIA UNIX x86 Kernel Module 295.41 Fri Apr 6 22:53:56 PDT 2012 GCC version: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)"` I still dont see anything in `"/dev/"` – gmemon Jun 07 '12 at 05:55
  • 1
    have you rebooted your system? – ardiyu07 Jun 07 '12 at 05:58
  • I did, but I was booting it in text mode. When I boot it in graphical mode, the driver gets loaded and the sample application works. Is there anyway that I can load the driver in text mode? – gmemon Jun 07 '12 at 06:22
  • I'm sorry but i don't see the point of doing that.. if you're in Ubuntu desktop, then you can just turn of the graphical view (gdm), otherwise you should've installed ubuntu server.. – ardiyu07 Jun 07 '12 at 06:39
  • 3
    Page 6 of the Getting Started Guide for Linux gives a sample script you can use to load the driver and create the devices _without_ starting X – Peter Jun 07 '12 at 13:58
  • try sudo modprobe nvidia && sudo chmod 666 /dev/nvidia* – serbaut Nov 05 '12 at 22:59
  • 2
    thankyou, it was as simple as using sudo to run my compiled code for me. Can I change something so that this won't be necessary in the future? – Alex Mar 10 '13 at 03:03
0

if you are sure cuda driver and all is installed then just try

$ sudo nvidia-xconfig --enable-all-gpus 

now try ur cuda samples,

  • This answer is complete nonsense. None of these things you suggested have *anything* to do with either the problem which the original questioner had, nor will they fix the problem, which was related to not loading the kernel driver when X11 isn't running. – talonmies Sep 15 '12 at 17:44
  • @talonmies, i got the same issue, and the only solution i got is "nvidia-xconfig --enable-all-gpus" ,(which generated an xorg.conf file in /X11/ which is for display i know ) after giving this command, CUDA is detecting the nvidia card. if this is a nonsense then how this worked for me? but this made a lag in the actual performance. am expecting an answer from you which can completely get me out from all ma issues. – sivapal ayyappan nadar Sep 20 '12 at 05:06
  • Because your problem and this problem are not the same. For the second time, the original questioner **was not running X11 at all**. How will generating an X11 configuration file fix anything on a machine not running X11? – talonmies Sep 20 '12 at 05:24
  • @talonmies.. see what you have said was right, running CUDA nd X11 dont have any relation. but i can only run my samples like devicequery after enabling in such a way. but it enables the nvidia for display too i guess, Is there any other option to enable NVIDIA card for CUDA purpose alone? if you are having a solution please help me. – sivapal ayyappan nadar Sep 20 '12 at 05:54
  • 1
    read the other answer and comments in this question! the answer is literally on the screen in front of you. – talonmies Sep 20 '12 at 06:28
  • i have already tried those , hope u got an idea about wat i have done with ma system... is there anything i should do to run ma CUDA samples without the issues i have mentioned? – sivapal ayyappan nadar Sep 20 '12 at 07:36
  • 1
    This solution worked for me. Yes, it updated X configuration, but it created all necessery /dev/nvidia* char devices without restarting X. Thank you. – milo Jun 13 '14 at 09:59