"no CUDA-capable device is detected" for CUDA ver 7.5, Kubuntu 14.04

I am unable to run a cuda program on my nVidia card, please help.

I have a GEForce card (as described below) in the PCIe slot and my monitor is attached to the VGA port. I plan to use the GEForce card for cuda programming.
The nvidia driver is ver 352.79
I downloaded and used cuda_7.5.18_linux.run to install cuda. Followed the install process described in: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions

Device verification script is run successfully, env setup in .bashrc done,compiled the examples - specifically deviceQuery and here’s the output of running ./deviceQuery.

rinka@rinka-GPU:~/Documents/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery
$ sudo ./deviceQuery
./deviceQuery Starting...

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

cudaGetDeviceCount returned 10
-> invalid device ordinal
Result = FAIL
[Tue Feb 16 21:00:29 IST 2016]
rinka@rinka-GPU:~/Documents/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery
$ ./deviceQuery 
./deviceQuery Starting...

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

cudaGetDeviceCount returned 10
-> invalid device ordinal
Result = FAIL

I really don’t know what I’m missing.

Here’s information on my machine:

$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GK110 [GeForce GTX 780] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GK110 HDMI Audio (rev a1)
[Tue Feb 16 20:12:56 IST 2016]
$ uname -a
Linux rinka-GPU 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
$ sudo lshw
rinka-gpu                 
    description: Desktop Computer
    product: All Series (All)
    vendor: ASUS
    version: System Version
    serial: System Serial Number
    width: 64 bits
    capabilities: smbios-2.7 dmi-2.7 vsyscall32
    configuration: administrator_password=disabled boot=normal chassis=desktop family=ASUS MB frontpanel_password=disabled keyboard_password=disabled power-on_password=disabled sku=All uuid=20252E3C-DAD7-DD11-9BC3-0862664CBD8D
  *-core
       description: Motherboard
       product: B85-PRO GAMER
       vendor: ASUSTeK COMPUTER INC.
       physical id: 0
       version: Rev 1.xx
       serial: 150341964600923
       slot: To be filled by O.E.M.
     *-firmware
          description: BIOS
          vendor: American Megatrends Inc.
          physical id: 0
          version: 2103
          date: 08/19/2014
          size: 64KiB
          capacity: 8128KiB
          capabilities: pci apm upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
     *-memory:0 UNCLAIMED
          physical id: 1
        *-bank UNCLAIMED
             description: DIMM [empty]
             product: [Empty]
             vendor: [Empty]
             physical id: 0
             serial: [Empty]
             slot: ChannelA-DIMM0
     *-memory:1
          description: System Memory
          physical id: 43
          slot: System board or motherboard
        *-bank:0
             description: DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
             product: KHX1866C10D3/8G
             vendor: Kingston
             physical id: 0
             serial: 74267A62
             slot: ChannelA-DIMM1
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
        *-bank:1
             description: DIMM [empty]
             product: [Empty]
             vendor: [Empty]
             physical id: 1
             serial: [Empty]
             slot: ChannelB-DIMM0
        *-bank:2
             description: DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
             product: KHX1866C10D3/8G
             vendor: Kingston
             physical id: 2
             serial: 78268262
             slot: ChannelB-DIMM1
             size: 8GiB
             width: 64 bits
             clock: 1333MHz (0.8ns)
     *-cache:0
          description: L1 cache
          physical id: 4a
          slot: CPU Internal L1
          size: 256KiB
          capacity: 256KiB
          capabilities: internal write-back
     *-cache:1
          description: L2 cache
          physical id: 4b
          slot: CPU Internal L2
          size: 1MiB
          capacity: 1MiB
          capabilities: internal write-back unified
     *-cache:2
          description: L3 cache
          physical id: 4c
          slot: CPU Internal L3
          size: 8MiB
          capacity: 8MiB
          capabilities: internal write-back unified
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
          vendor: Intel Corp.
          physical id: 50
          bus info: cpu@0
          version: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
          slot: SOCKET 1150
          size: 3829MHz
          capacity: 3829MHz
          width: 64 bits
          clock: 100MHz
          capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cpufreq
          configuration: cores=4 enabledcores=4 threads=8
     *-memory:2 UNCLAIMED
          physical id: 2
     *-memory:3 UNCLAIMED
          physical id: 3
     *-pci
          description: Host bridge
          product: 4th Gen Core Processor DRAM Controller
          vendor: Intel Corporation
          physical id: 100
          bus info: pci@0000:00:00.0
          version: 06
          width: 32 bits
          clock: 33MHz
          configuration: driver=hsw_uncore
          resources: irq:0
        *-pci:0
             description: PCI bridge
             product: Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller
             vendor: Intel Corporation
             physical id: 1
             bus info: pci@0000:00:01.0
             version: 06
             width: 32 bits
             clock: 33MHz
             capabilities: pci pm msi pciexpress normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:40 ioport:e000(size=4096) memory:f6000000-f70fffff ioport:e0000000(size=167772160)
           *-display
                description: VGA compatible controller
                product: GK110 [GeForce GTX 780]
                vendor: NVIDIA Corporation
                physical id: 0
                bus info: pci@0000:01:00.0
                version: a1
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
                configuration: driver=nvidia latency=0
                resources: irq:16 memory:f6000000-f6ffffff memory:e0000000-e7ffffff memory:e8000000-e9ffffff ioport:e000(size=128) memory:f7000000-f707ffff
           *-multimedia
                description: Audio device
                product: GK110 HDMI Audio
                vendor: NVIDIA Corporation
                physical id: 0.1
                bus info: pci@0000:01:00.1
                version: a1
                width: 32 bits
                clock: 33MHz
                capabilities: pm msi pciexpress bus_master cap_list
                configuration: driver=snd_hda_intel latency=0
                resources: irq:17 memory:f7080000-f7083fff
        *-display
             description: VGA compatible controller
             product: Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 06
             width: 64 bits
             clock: 33MHz
             capabilities: msi pm vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:44 memory:f7400000-f77fffff memory:d0000000-dfffffff ioport:f000(size=64)
        *-multimedia:0
             description: Audio device
             product: Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
             vendor: Intel Corporation
             physical id: 3
             bus info: pci@0000:00:03.0
             version: 06
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi pciexpress bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:46 memory:f7834000-f7837fff

[deleting the less relevant devices such as usb, network, isa, storage, serial etc.,]

        *-multimedia:1
             description: Audio device
             product: 8 Series/C220 Series Chipset High Definition Audio Controller
             vendor: Intel Corporation
             physical id: 1b
             bus info: pci@0000:00:1b.0
             version: 05
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi pciexpress bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:47 memory:f7830000-f7833fff
        *-pci:1
             description: PCI bridge
             product: 8 Series/C220 Series Chipset Family PCI Express Root Port #1
             vendor: Intel Corporation
             physical id: 1c
             bus info: pci@0000:00:1c.0
             version: d5
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:16 ioport:2000(size=4096) memory:cf200000-cf3fffff ioport:cf400000(size=2097152)
        *-pci:2
             description: PCI bridge
             product: 82801 PCI Bridge
             vendor: Intel Corporation
             physical id: 1c.3
             bus info: pci@0000:00:1c.3
             version: d5
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm subtractive_decode bus_master cap_list
           *-pci
                description: PCI bridge
                product: ASM1083/1085 PCIe to PCI Bridge
                vendor: ASMedia Technology Inc.
                physical id: 0
                bus info: pci@0000:03:00.0
                version: 04
                width: 32 bits
                clock: 33MHz
                capabilities: pci subtractive_decode bus_master cap_list
  *-power UNCLAIMED
       description: To Be Filled By O.E.M.
       product: To Be Filled By O.E.M.
       vendor: To Be Filled By O.E.M.
       physical id: 1
       version: To Be Filled By O.E.M.
       serial: To Be Filled By O.E.M.
       capacity: 32768mWh
[Tue Feb 16 20:44:42 IST 2016]
$ lsmod | grep nvidia
nvidia               8536985  0 
drm                   311018  5 i915,drm_kms_helper,nvidia
$ grep nvidia /proc/modules 
nvidia 8536985 0 - Live 0x0000000000000000 (POE)
drm 311018 5 nvidia,i915,drm_kms_helper, Live 0x0000000000000000
$ cat /etc/X11/xorg.conf
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "SNA"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection
$ cat /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
$ ll /dev/nvidia*
crw-rw-rw- 1 root root 195,   0 Feb 16 21:00 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Feb 16 20:37 /dev/nvidiactl

Hi rinka

You should check /var/lib/dkms/nvidia/build/make.log what happened on your installation.

Could you see the errors happened on your log?

-masafumi

As I posted some time ago, there are two weird behaviors I had to bypass in Ubuntu. First, the first time I run a Cuda program, I had to do sudo. Just verify if the Nvidia driver found its “rightful place” by running glmark2 first.

Second, recent Nvidia drivers were more willing to work with my machines if I was running Lubuntu and Xubuntu, so you may want to try “sudo apt-get install lubuntu-desktop” if all else fails.

  1. Is the v352.79 driver installed properly? (you can check it by $nvidia-smi or $dmesg | grep NVRM);
  2. Does it still happen after re-build the sample?
    $cd ~/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery
    $make clean
    $make