However, after installing the NVIDIA driver, CUDA 4.2 and SDK on Ubuntu 12.04, the test program deviceQuery cannot find the CUDA device:
$. / DeviceQuery
[DeviceQuery] starting ...
. / DeviceQuery Starting ...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 38
-> No CUDA-capable device is detected
[DeviceQuery] test results ...
Press ENTER to exit ...
Checking the device:
$ lspci | grep -i NVIDIA
01:00.0 VGA compatible controller: NVIDIA Corporation Tesla C2075 (rev a1)
With the help of the post: http://d.hatena.ne.jp/flick-flick/20110818 and Google Translate, finally realized the problem is actually stated in the installation doc:
4. If you do not use a GUI environment, ensure that the device files /dev/nvidia*
exist and have the correct file permissions. (This would be done automatically when
initializing a GUI environment.) This can be done creating a startup script like the
following to load the driver kernel module and create the entries as a superuser at
if [ "$?" -eq 0 ]; then
# Count the number of NVIDIA controllers found.
NVDEVS=`lspci | grep -i NVIDIA`
N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`
N=`expr $N3D + $NVGA - 1`
for i in `seq 0 $N`; do
mknod -m 666 /dev/nvidia$i c 195 $i
mknod -m 666 /dev/nvidiactl c 195 255
Thus to solve the problem: add the above scripts to /etc/rc.local as a startup script.