Tag Archives: cuda

Install (and develop in) cuda under ubuntu 11.10

What you need for cuda with ubuntu 11.10 :

Download and install cudatoolkit (4.1.28) and gpucomputingsdk nvidia download page
You also need last driver (either with a ppa package or direct from nvidia).

chmod +x cudatoolkit_4.1.28_linux_64_ubuntu11.04.run
#-> /home/XXX/cuda for instance
chmod +x gpucomputingsdk_4.1.28_linux.run
#-> /home/XXX/NVIDIA_GPU_Computing_SDK
# indicate cuda install dir

I choose to install both in my home dir. Cuda need gcc 4.4 (not 4.6 which is default in ubuntu 11.10) if not installed
sudo apt-get install gcc-4.4 g++-4.4
then the simplest solution i’ve found is

ln -s /usr/bin/gcc-4.4 ~/cuda/bin/gcc
ln -s /usr/bin/g++-4.4 ~/cuda/bin/g++

Add lib and bin dir to path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/XXX/cuda/lib64; export PATH=$PATH:XXX/cuda/bin

cuda sdk needs also Xi Xmu and glut
sudo apt-get install libxi-dev libxmu-dev freeglut3-dev
and I don’t know why, but libcuda.so wasn’t linked from /usr/lib/nvidia-current to /usr/lib/ so you need to add the symlink
sudo ln -s nvidia-current/libcuda.so .

And to compile NVIDIA_GPU_Computing,
one need also to modify common.mk to use g++-4.4/gcc-4.4 in place of g++/gcc
in ~/NVIDIA_GPU_Computing_SDK/C/common/common.mk
~/NVIDIA_GPU_Computing_SDK/CUDALibraries/common/common_cudalib.mk common_npplib.mk
CXX := g++ -fPIC
CC := gcc -fPIC
LINK := g++ -fPIC

CXX := g++-4.4 -fPIC
CC := gcc-4.4 -fPIC
LINK := g++-4.4 -fPIC

A last thing is cuda sdk provides GL/* headers which are not compatible with some of my code, so I need to remove the directory found here ~/NVIDIA_GPU_Computing_SDK/CUDALibraries/common/inc/GL