Tuesday, November 6, 2012

Installing CUDA on Linux Mint 13 MATE 64 Bit

These notes are based on these notes,

First thing, download the Ubuntu 11.0 64 bit version of CUDA 5.0

This downloads an installer script.  When I did this, the file was called (cuda_5.0.35_linux_64_ubuntu11.10-1.run).  This master install script contains scripts to install the a) CUDA Toolkit, b) Nvidia display driver and, c) SDK code samples.

The main points for this install are the following,
1) You can use either your own Nvidia display driver or the provided one.
2) The samples are best installed after the other two items

First install the requisite graphics packages,
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Next split the install script into its three components.  This will be useful later.
sh cuda_5.0.35_linux_64_ubuntu11.10-1.run -extract=<your/path>

If you are going to use the display driver that comes with the installer then ... 

Add the following lines to the file /etc/modprobe.d/blacklist.conf 
blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

Remove whatever nvidia drivers are present on your system.
sudo apt-get remove --purge nvidia*
Now, in order to install a new display driver we can't be running the X-server so log out and press Ctrl+Alt+F1 to switch to a text based login (you may have to switch to Ctrl+Alt+F2 if this dies when you kill the mdm service).  Next, change to the directory where the install script is.    First we need to shut down the X-server in Linux Mint
sudo service mdm stop
And now run the install script,
sudo cuda_5.0.35_linux_64_ubuntu11.10-1.run
When I ran this the default install location is in /usr/local and the tool kit and the display driver were installed successfully but the samples will fail.  At this point, you can reboot the machine and with any luck the new display driver will be in action.

If you are going to use the display driver you already have then ... 

Simply run the individual script that installs the cuda tool kit (i.e. the one that is NOT the display driver or the samples).  You shouldn't have to log out of your current X-window session.  You WILL most likely need to copy (or link) the libcuda.so file from wherever your current driver is keeping it to the install directory you chose for the cuda tool kit.  For example on my system I did,
 ln -s /usr/lib/nvidia-current-updates/libcuda.so.304.43 /usr/local/cuda-5.0/lib64/libcuda.so
 ln -s /usr/lib/nvidia-current-updates/libcuda.so.304.43 /usr/local/cuda-5.0/lib64/libcuda.so.1

No matter what display driver your are using ...

Now we need to update the PATH and LD_LIBRARY_PATH environment variables
export PATH=/usr/local/cuda-5.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH
Now that the Toolkit is installed and the paths are set we can install the samples by running the separate install script we extracted above.  All of the samples can be build by running make in the Samples directory.  Some of them require MPI so you should install the openmpi packages from the repository.  Run some of the samples to make sure everything is good.  A really cool one is
 Now you should be ready to go!

No comments:

Post a Comment