Showing posts with label CUDA. Show all posts
Showing posts with label CUDA. Show all posts

Monday, September 26, 2011

How to install CUDA 4.0 on Ubuntu 10.10 or later

First, you need to install the NVIDIA development drivers. Download the current version (270.41.19) here.
To install the dev drivers, reboot and go into recovery mode. Select the "Drop to root shell prompt" option. Now type:
sudo telinit 3
Login again using your username, then cd to the directory where you downloaded the drivers (e.g. ~/Downloads):
cd ~/Downloads
chmod u+x devdriver_4.0_linux_64_270.41.19.run
sudo ./devdriver_4.0_linux_64_270.41.19.run
Follow the instructions on the screen. Make sure you write to your xorg.conf file. When done reboot:
sudo reboot
Download the CUDA Toolkit from this page (Linux -> CUDA Toolkit for Ubuntu Linux 10.10).
cd ~/Downloads
chmod u+x cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
sudo ./cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
Finally, download the GPU Computing SDK from the above website.
cd ~/Downloads
chmod u+x gpucomputingsdk_4.0.17_linux
./gpucomputingsdk_4.0.17_linux
Add the these lines at the end of your ~/.profile (if your OS is 32-bit, remove the lib64 entry):
#CUDA stuff
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Now you just need to compile the samples. Assuming you installed the SDK in your home directory:
cd ~/NVIDIA_GPU_Computing_SDK
make
You can now run one of the demos, e.g. the particle demo
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/particles
and you should see something like this: