Header Ads

Seo Services

Install Cuda on Ubuntu

A few points before we begin though -
  1. As always, a working CUDA installation requires a CUDA capable card.
  2. Installing CUDA 5 will give you the option of opting for the development drivers or sticking with the regular ones. Personally, I chose the regular ones and they’ve worked out just fine (version 310.19 as of this writing).
STEP I – Driver installation (if you choose the regular drivers)
This section remains almost unchanged. Download the Nvidia drivers for Linux from their website, making sure to select 32 or 64-bit Linux based on your system.
Make sure the requisite tools are installed using the following command -
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
Next, blacklist the required modules (so that they don’t interfere with the driver installation) -
sudo nano /etc/modprobe.d/blacklist.conf
Add the following lines to the end of the file, one per line, and save it when done -
blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
In order to get rid of any nVidia residuals, run the following command in a terminal -
sudo apt-get remove --purge nvidia*
This may take a while, so be patient. Once it’s done, reboot your machine. At the login screen, don’t login just yet. Press Ctrl+Alt+F1 to switch to a text-based login, and switch to the directory which contains the downloaded driver. Run the following commands -

sudo service lightdm stop
chmod +x NVIDIA*.run

where NVIDIA*.run is the full name of your driver. Next, start the installation with -

sudo ./NVIDIA*.run

Follow the onscreen instructions. If the installer throws up an error about nouveau still running, allow it to create a blacklist for nouveau, quit the installation and reboot. In that case, run the following commands again -

sudo service lightdm stop
sudo ./NVIDIA*.run

The installation should now proceed smoothly. When it asks you if you want the 32-bit libraries and if you want it to edit xorg.conf to use these drivers by default, allow both.
Reboot once the installation completes.

STEP II – CUDA toolkit installation
Download the CUDA toolkit (I used the Ubuntu 11.10 64-bit version). Navigate to the directory that contains the downloaded CUDA toolkit package, and run the following command -
chmod +x cuda*.run
sudo ./cuda*.run

where cuda*.run is the full name of the downloaded CUDA toolkit. Accept the license that appears. Next, choose to install the driver if you’ve not done so already (this is the development version). Installation of the driver will require switching to a text-based shell (Ctrl+Alt+F1), stopping lightdm as detailed in the previous step and running the toolkit installer as superuser. The CUDA 5.0 toolkit installation is compulsory, while that of the included samples isn’t. Allow the installer to proceed with default locations unless you have specific reasons for not doing so. This makes for easier troubleshooting in the future.
This process might take a while depending upon your system config. Once it’s done, double check the summary screen to make sure everything is in place. If the installation of the samples fails (which it does more often than not), it’s probably due to one or more missing libraries. In that case, install the required libraries and rerun the installer, choosing to install the samples alone.
To make sure the necessary environment variables (PATH and LD_LIBRARY_PATH) are modified every time you access a terminal, add the requisite lines (from the summary screen) to the end of ~/.bashrc as follows -
32 bit systems -
export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib

64 bit systems -
export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/lib

The paths used above will vary based on the install directory you choose for the toolkit. This wraps up the arguably simpler setup (compared to CUDA 4.x for Linux users), although the samples’ installation still suffers from dependency hell.

1 comment:

Powered by Blogger.