|
Candidate for Deletion |
|
Needs Updating |
THIS PAGE ISN'T FINALIZED !
CUDA (Compute Unified Device Architecture) is a parallel computing architecture developed by Nvidia for graphics processing.
This document provides instructions to install/remove Cuda 4.2 on Ubuntu 12.04.
Installation
Prerequisites
It is necessary to have a Nvidia proprietary driver up to 295.xx (which can be installed automatically or manually). For Ubuntu versions under 12.04, you will have to install Nvidia driver manually.
Be sure your GPU is compatible with Cuda. Refer to this page. Then, install required packages:
sudo apt-get install libxi-dev libxmu-dev freeglut3-dev build-essential binutils-gold
Downloads
You will have to download two programs: "CUDA Toolkit" and "GPU Computing SDK".
Let's download and save them on the Desktop.
32bits:
cd ~/Desktop wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/cudatoolkit_4.2.9_linux_32_ubuntu11.04.run wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/sdk/gpucomputingsdk_4.2.9_linux.run
64bits:
cd ~/Desktop wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/cudatoolkit_4.2.9_linux_64_ubuntu11.04.run wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/sdk/gpucomputingsdk_4.2.9_linux.run
Installation of CUDA Toolkit
Go to "Desktop", add execution permissions of the cudatoolkit downloaded file, and execute it with root permissions:
cd ~/Desktop chmod +x cudatoolkit_4.2.9_linux_* sudo ./cudatoolkit_4.2.9_linux_*
When it will ask you:
Enter install path (default /usr/local/cuda, '/cuda' will be appended):
type /opt.
Installation of GPU Computing SDK
As before, go to "Desktop", add execution permissions of the gpucomputingsdk downloaded file, and execute it without root permissions:
cd ~/Desktop chmod +x gpucomputingsdk_4.2.9_linux.run ./gpucomputingsdk_4.2.9_linux.run
When it will ask you:
Enter install path (default ~/NVIDIA_GPU_Computing_SDK):
press [enter] (to use default path), and type /opt when it will ask you:
Enter CUDA install path (default /usr/local/cuda):
Preparation
Update variables, and this on every boot:
export PATH=$PATH:/opt/cuda/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64 echo 'export PATH=$PATH:/opt/cuda/bin' >> ~/.bash_profile echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64' >> ~/.bash_profile
Compilation of SDK
Need to be tested !
We finally compile:
cd ~/NVIDIA_GPU_Computing_SDK/C LINKFLAGS=-L/usr/lib/nvidia-current/ make cuda-install=/opt/cuda
NOTE: In case you are using the latest (post-release updates; version current-updates) instead of the recommended (version current) Nvidia drivers, then change the LINKFLAGS to read:
cd ~/NVIDIA_GPU_Computing_SDK/C LINKFLAGS=-L/usr/lib/nvidia-current-updates/ make cuda-install=/opt/cuda
You can check for which version you are using by running the "Additional Drivers" program (System Settings->Hardware->Additional Drivers) and check which version is toggled ON.
Test
Now, let's test if Cuda is working great. Type:
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/./fluidsGL
As you can see on the following picture, it works !
If you are using optimus with bumblebee, run the above with optirun as below:
optirun ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/./fluidsGL
Will come soon...
Cleanup
Now Cuda is installed, the installers files are useless, you can remove them:
cd ~/Desktop rm cudatoolkit_4.2.9_linux_* rm gpucomputingsdk_4.2.9_linux.run
Uninstallation
If you want to totally remove Cuda, juste delete the /opt/cuda and ~/NVIDIA_GPU_Computing_SDK folders:
rm -r ~/NVIDIA_GPU_Computing_SDK sudo rm -r /opt/cuda
and remove the export PATH=$PATH:/opt/cuda/bin and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64 lines of the ~/.bash_profile file.