Installing and setting up CUDA on Linux Mint 13 (64 bit)

Posted: December 5, 2012 in CUDA

CUDA – Compute Unified Device Architecture, is NVIDIA’s parallel computing architecture. It boost the computing performance of a program by making use of the power of the graphics processing unit (GPU). Read more…

First thing you must do is to download CUDA (current version is 5.0).
Link: https://developer.nvidia.com/cuda-downloads

2 ways to proceed with installation:

  1. Either install with default display driver.
  2. Or Install with NVIDIA display driver.

Once you have the downloaded script file “cuda_5.0.35_linux_64_ubuntu11.10-1.run” , it can be extracted to obtain 3 sub script files:

sh cuda_5.0.35_linux_64_ubuntu11.10-1.run -extract=”absolute path”

1. “cudatoolkit_5.0.35_linux_64_ubuntu11.10.run” – Cuda Toolkit (contains IDE Nsight which is based on Eclipse)
2. “devdriver_5.0_linux_64_304.54.run” – NVIDIA device driver
3. “cuda-samples_5.0.35_linux.run” – Cuda samples

Then install the NVIDIA driver,

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates

sudo apt-get update && sudo apt-get install nvidia-current

Installing with default display driver

1. Run script file ”cudatoolkit_5.0.35_linux_64_ubuntu11.10.run” to install the nvidia toolkit.

sudo ./cudatoolkit_5.0.35_linux_64_ubuntu11.10.run

2. You will need to link the libcuda.so.”version” (e.g libcuda.so.304.64) file from the nvidia driver directory to the install directory for the cuda toolkit

sudo ln -s /usr/lib/nvidia-current/libcuda.so.304.64 /usr/local/cuda-5.0/lib64/libcuda.so

sudo ln -s /usr/lib/nvidia-current/libcuda.so.304.64 /usr/local/cuda-5.0/lib64/libcuda.so.1

3. Install cuda samples

sudo ./cuda-samples_5.0.35_linux.run

Installing with NVIDIA display driver

1. Reconfigure the basic video driver by removing all nvidia drivers present.

sudo apt-get remove –purge nvidia*

2. Blacklist the built-in nouveau driver so that it does not conflict with the nvidia driver which is going to be installed afterwards.

Create a file and call it blacklist.conf in /etc/modprobe.d/ and add the following lines,

blacklist nvidiafb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist vga16fb
options nouveau modeset=0

3. To install the new nvidia driver, log out of your system and press CTRL+ALT+F1 to enter a text based login. Stop the graphical display manager

sudo service mdm stop

4. Run the script “cudatoolkit_5.0.35_linux_64_ubuntu11.10.run” to install the toolkit, the video driver and cuda samples. Then reboot your system.

sudo shutdown -r now

Setting Environment Variables

export PATH=/usr/local/cuda-5.0/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH

Running CUDA Samples

Some cuda samples require openGL and openMPI packages to be installed in order to run.

sudo apt-get install freeglut3-dev libxi-dev libxmu-dev

sudo apt-get install mpi-default-dev

Go to the samples directory and execute the following command to build the samples,

make

Test by running,

./NVIDIA_CUDA-5.0_Samples/5_Simulations/smokeParticles/smokeParticles

NVIDIA_CUDA-5.0_Samples directory is found on your home directory when the building process has finished.

Error!

If you encouter with the following error,

error while loading shared libraries: libcudart.so.2: cannot open shared object file: No such file or directory

it can be solved by modifying the /etc/ld.so.conf file and adding the following two line,

/usr/local/cuda/lib64
/usr/local/cuda/lib

and run

sudo ldconfig

Now you are ready to go.

About these ads
Comments
  1. Ananya says:

    I have all the packages which need to be installed. But samples like smokePartiles and fluidsGL are not running.
    “Error finding floor image file” is displayed when I run smokeParticles.
    What could be the problem and how do i solve it?

    • nasiroudin says:

      I think the program cannot find the floor image file. Make sure you have “floortile.ppm” in the smokeParticles directory on the cuda samples directory:
      "/5_Simulations/smokeParticles/data/floortile.ppm"

      If this file is not found, i recommend you to reinstall the Cuda Samples:
      sudo ./cuda-samples_5.0.35_linux.run

  2. jeremy says:

    Good instructions, thanks.

    Installed successfully on Mint 14 (Nadia). Since that uses gcc-4.7 by default which cuda 5 does not support you should install gcc-4.5, g++-4.5 using synaptic and then link g++, gcc to those versions for cuda before the samples will compile.

    ln -s /usr/bin/gcc-4.5 /usr/local/cuda/bin/gcc
    ln -s /usr/bin/g++-4.5 /usr/local/cuda/bin/g++

  3. tuncay says:

    my nvidia is geforce 635m , from nsight preference, i couldnt enter cuda toolkit, it is written that no cuda enable device detected. what can i do ? thanks

    • nasiroudin says:

      You must run nsight with your nvidia graphics card. That’s why your device is not being detected. If your system supports both NVidia and Intel graphics card, then i recommend you to install Bumblebee (https://wiki.ubuntu.com/Bumblebee) which is also applicable to Linux Mint. After installing, launch nsight from command line using

      $~ optirun nsight

      or you can edit menu. Go to Programming -> Nsight -> Properties and add optirun before the command in the command field.

  4. ty says:

    Im on linux mint 14 cinamon, and flipped the failboat. aha. I downloaded cuda, and eclipse juno. Ok so I can get the user agreement on cuda to display, but It gives me an error like Cannot install Toolkit in /usr/local/cuda-5.0
    Enter Toolkit Location [ default is /usr/local/cuda-5.0 ]:

    what should I do?

  5. ty says:

    im new to linux

    sh cuda_5.0.35_linux_64_ubuntu11.10-1.run -extract=\usr\local\cuda-5.0
    Logging to /tmp/cuda_install_2715.log
    Please specify an absolute path extract directory.

    what do I need to do? Thanks
    -Ty.

    • Sam says:

      How did you solve this problem. I’m having the same problem.

      • nasiroudin says:

        The -extract param should take an absolute path like:
        sh cuda_5.0.35_linux_64_ubuntu11.10-1.run -extract=/home/user/Desktop/TempDir
        The above path is an absolute path.

        You should not do “cd /home/user/Desktop” and -extract=TempDir since it takes only an absolute path.

  6. ty says:

    New question. Got everything installed and got Eclipse up and running. Now when I compile I get an error that the binary cant be found. My drivers are set up everything is set up correctly. I tried to link it but to no avail. ANy help is appreciated. thanks

    • nasiroudin says:

      You should first build your project by pressing CTRL + B. This will build your project to create the object file required for you to run your program. You can now press the play button on the eclipse to get it running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s