Installing CUDA on Ubuntu
In this topic the related issues for installing CUDA on Ubuntu linux will be discussed.
In this topic the related issues for installing CUDA on Ubuntu linux will be discussed.

#1
Posted 11/01/2012 01:31 PM   
To start filling the new forum, this is the script I use to install CUDA 5 on Ubuntu 12.04.1 LTS (64 bit). I think it is pretty complete, but please update if you find anything missing. [code] # install dependencies # - freeglut, libxi and libxmu are only required for the OpenGL SDK examples # - mpich2 is required for the CUDA MPI example sudo apt-get install build-essential freeglut3-dev libxi-dev libxmu-dev mpich2 # create a symlink to libglut.so where the driver-installer expects it sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so # switch to a non-GUI environment to install the driver # - log out of the 'normal' GUI environment # - press ctrl-alt-F1 # - log in with your normal username and password # stop the GUI environment sudo /etc/init.d/lightdm stop # install the NVIDIA driver, toolkit and SDK # - the next command may have to be executed multiple times before success # since it first needs to uninstall the open-source nouveau drivers # - run the command in the directory where you have downloaded # the driver-toolkit-SDK package sudo sh cuda_5.0.35_linux_64_ubuntu11.10.run # update the PATH and LD_LIBRARY_PATH environment variables for all users - Add /usr/local/cuda-5.0/bin to /etc/environment - Create file /etc/ld.so.conf.d/cuda.conf which contains: /usr/local/cuda-5.0/lib /usr/local/cuda-5.0/lib64 # now run sudo ldconfig # reboot, just to be sure driver is installed and loaded correctly # and lightdm (the GUI environment) is restarted properly sudo reboot [/code]
To start filling the new forum, this is the script I use to install CUDA 5 on Ubuntu 12.04.1 LTS (64 bit). I think it is pretty complete, but please update if you find anything missing.

# install dependencies
# - freeglut, libxi and libxmu are only required for the OpenGL SDK examples
# - mpich2 is required for the CUDA MPI example
sudo apt-get install build-essential freeglut3-dev libxi-dev libxmu-dev mpich2

# create a symlink to libglut.so where the driver-installer expects it
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so

# switch to a non-GUI environment to install the driver
# - log out of the 'normal' GUI environment
# - press ctrl-alt-F1
# - log in with your normal username and password

# stop the GUI environment
sudo /etc/init.d/lightdm stop

# install the NVIDIA driver, toolkit and SDK
# - the next command may have to be executed multiple times before success
# since it first needs to uninstall the open-source nouveau drivers
# - run the command in the directory where you have downloaded
# the driver-toolkit-SDK package
sudo sh cuda_5.0.35_linux_64_ubuntu11.10.run

# update the PATH and LD_LIBRARY_PATH environment variables for all users
- Add /usr/local/cuda-5.0/bin to /etc/environment
- Create file /etc/ld.so.conf.d/cuda.conf which contains:
/usr/local/cuda-5.0/lib
/usr/local/cuda-5.0/lib64
# now run
sudo ldconfig

# reboot, just to be sure driver is installed and loaded correctly
# and lightdm (the GUI environment) is restarted properly
sudo reboot

Parallel Architecture Research in Eindhoven - http://parse.ele.tue.nl

#2
Posted 11/01/2012 02:51 PM   
Thank you for the instructions. I would like to share my experience hoping it will help someone. I'm running Linux Mint 13 (64 bit) with Bumblebee. I've followed the above instructions in parallel with the CUDA Getting Started Guide from Nvidia. Because of Bumblebee, I've skipped the driver installation part of the setup. Everything went according to plan, but when I tried to compile the provided samples, I got an error: [code]/usr/bin/ld: cannot find -lcuda[/code] What worked for me, in case anyone else has the same problem, was executing: [code]su -c 'ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so && ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/libcuda.so.1'[/code] Thanks again.
Thank you for the instructions. I would like to share my experience hoping it will help someone.

I'm running Linux Mint 13 (64 bit) with Bumblebee. I've followed the above instructions in parallel with the CUDA Getting Started Guide from Nvidia. Because of Bumblebee, I've skipped the driver installation part of the setup. Everything went according to plan, but when I tried to compile the provided samples, I got an error:
/usr/bin/ld: cannot find -lcuda

What worked for me, in case anyone else has the same problem, was executing:
su -c 'ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so && ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/libcuda.so.1'


Thanks again.

#3
Posted 11/01/2012 11:49 PM   
Hello, When I wrote a blog post about CUDA 5.0 installation on Ubuntu 12.10, I found an interesting article which describes all error messages which I faced during the installation process. I hope, it is allowed to post links here: [url]http://www.cnblogs.com/chenrui/archive/2012/10/16.html[/url] Kind regards!
Hello,

When I wrote a blog post about CUDA 5.0 installation on Ubuntu 12.10, I found an interesting article which describes all error messages which I faced during the installation process.
I hope, it is allowed to post links here: http://www.cnblogs.com/chenrui/archive/2012/10/16.html

Kind regards!

#4
Posted 11/06/2012 05:42 PM   
Hi, Just another sharing from my experience Ubuntu 12.10 has gcc and g++ version 4.7 by default which might halt 5.0 installation , if this issue encountered during installation, you can undertake following workaround : 1) remove symbol link gcc & g++ in /usr/bin 2) apt-get install gcc-4.6 and g++-4.6 3) create symbol link : ln -s gcc-4.6 gcc AND ln -s g++-4.6 g++ then re-start CUDA 5.0 installation Good Luck
Hi,

Just another sharing from my experience
Ubuntu 12.10 has gcc and g++ version 4.7 by default which might halt 5.0 installation ,
if this issue encountered during installation, you can undertake following workaround :
1) remove symbol link gcc & g++ in /usr/bin
2) apt-get install gcc-4.6 and g++-4.6
3) create symbol link : ln -s gcc-4.6 gcc AND ln -s g++-4.6 g++
then re-start CUDA 5.0 installation

Good Luck

#5
Posted 12/25/2012 02:49 AM   
@Gert-Jan, could you update your script? It would be great if so to capture the changes mentioned by others. Changes that are required to make it work (at least for me it was necessary to change the compiler as panjian mentioned and as mentioned below, to remove the default nvidia drivers installed by Ubuntu.) On my end, I also had to run the necessary commands to remove the default nvidia drivers installed by Ubuntu. Otherwise it would find a mismatched between libraries and the kernel module. [code]NVRM: API mismatch: the client has the version 304.54, but NVRM: this kernel module has the version 304.51. Please NVRM: make sure that this kernel module and all NVIDIA driver NVRM: components have the same version.[/code] It would be something like: [code]apt-get remove --purge nvidia-common nvidia-current nvidia-settings[/code] I also had to re-install the driver after the remove. This meant revert the gcc/g++ soft links back to normal (because drivers have to be compiled with exactly the same version of the compiler as used for the kernel.)
@Gert-Jan, could you update your script? It would be great if so to capture the changes mentioned by others. Changes that are required to make it work (at least for me it was necessary to change the compiler as panjian mentioned and as mentioned below, to remove the default nvidia drivers installed by Ubuntu.)

On my end, I also had to run the necessary commands to remove the default nvidia drivers installed by Ubuntu. Otherwise it would find a mismatched between libraries and the kernel module.

NVRM: API mismatch: the client has the version 304.54, but
NVRM: this kernel module has the version 304.51. Please
NVRM: make sure that this kernel module and all NVIDIA driver
NVRM: components have the same version.


It would be something like:

apt-get remove --purge nvidia-common nvidia-current nvidia-settings


I also had to re-install the driver after the remove. This meant revert the gcc/g++ soft links back to normal (because drivers have to be compiled with exactly the same version of the compiler as used for the kernel.)

#6
Posted 12/27/2012 09:29 AM   
Scroll To Top