Elena Graverini

Install CUDA

The graphic driver included in the CUDA distribution should not be installed in running an Optimus system (see Install Bumblebee).

mkdir CUDA
cd CUDA

Download the 64-bit .run package for Linux Ubuntu from https://developer.nvidia.com/cuda-downloads and put it in the current directory.

Install the prerequisites in order to build the CUDA samples:
sudo apt-get install freeglut3-dev libxi-dev libxmu-dev build-essential libx11-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-devmpi-default-dev

Extract the .run package:

sh cuda*.run -extract=$PWD

To install the CUDA toolkit and the sumples, run the corresponding executables. Set as installation paths:

$HOME/CUDA/cuda-VERSION
$HOME/CUDA/cuda-VERSION/samples

Now link the preexisting drivers:
ln -s /usr/lib/nvidia-319/libcuda.so cuda-VERSION/lib64/libcuda.so
ln -s /usr/lib/nvidia-319/libcuda.so cuda-VERSION/lib64/libcuda.so.1

Setup the environment variables:
echo "export PATH=$HOME/CUDA/cuda-VERSION/bin:\$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=$HOME/CUDA/cuda-VERSION/lib64:$HOME/CUDA/cuda-VERSION/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc

Build the samples:
cd cuda-VERSION/samples/
make -j 4

Try:
optirun ./5_Simulations/fluidsGL/fluidsGL
optirun ./5_Simulations/nbody/nbody
optirun ./5_Simulations/particles/particles
optirun ./1_Utilities/deviceQuery/deviceQuery