Sunday, May 29, 2011

HOWTO : nVidia CUDA Toolkit 4.0 on Ubuntu 11.04 Server

The CUDA Toolkit 4.0 is released on May 2011. If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA Toolkit 4.0 on Ubuntu 11.04 Server.

You will experience a more faster server after the installation of CUDA Toolkit 4.0.

This HOWTO does not require to install X.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Thanks for the developer of CUDA 4.0 PPA - Aaron Haviland of his contribution to make CUDA Toolkit to be installed easily.

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

Step 3 :

sudo nano /etc/init.d/nvidia_cuda

Append the following lines.

============= Copy from here ================
#!/bin/bash

PATH=/sbin:/bin:/usr/bin:$PATH

/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then

   # Count the number of NVIDIA controllers found.
   N3D=`/usr/bin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
   NVGA=`/usr/bin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`

   N=`expr $N3D + $NVGA - 1`
   for i in `seq 0 $N`; do
      /bin/mknod -m 666 /dev/nvidia$i c 195 $i;
   done

   /bin/mknod -m 666 /dev/nvidiactl c 195 255

else
   exit 1
fi


=========== Copy to here =================

Step 4 :

sudo chmod +x /etc/init.d/nvidia_cuda
sudo update-rc.d nvidia_cuda defaults

Step 5 :

Reboot your system.

Remarks

I do not have nVidia display cards server in hand at the moment, I am not sure the captioned startup script working properly or not.

That's all! See you.