A definitive and stable way to install CUDA on (Ubuntu 14.04, Mint 17.2, or Fedora)

MrJay42 picture MrJay42 · Jul 22, 2014 · Viewed 8.5k times · Source

I am having trouble with CUDA installation on Linux. I have tried the installation of CUDA 6 on: Ubuntu 14.04 (x64) Linux Mint 17 (x64)

The problem:

I have tried to simply download/execute the nvidia CUDA executable (it is a *.run file downloaded from nvidia website) I have tried to install CUDA from the .deb file given by nvidia I have tried to install CUDA from edgers repository

I have followed tens of tutorials, I have reinstalled at least 20 times Linux, just to be sure that I am working on a clean version.

In any case: I paid attention to define the variable environment at the end of the process: PATH and LD_LIBRARY_PATH so that they point to the recently installed CUDA directory. (/path/to/cuda/bin for PATH and /path/to/cuda/lib64 for LD_LIBRARY_PATH.

At the end of the process I am trying to compile and launch the sample code given by nVidia in the sample code thing that you can install/download. The example I am running is "deviceQuery". (located in /path/to/cuda/samples/)

In any case, I had the nvidia (proprietary driver installation), not Nouveau.

And in any case, I have an error when I launch this deviceQuery. The error is either something like: no CUDA-able device detected. Or something like nvidia-uvm is missing (I have tried to install nvidia-uvm, when I tried the installation from the edgers PPA repository, and the error I have when I launch the deviceQuery sample is then no no CUDA-able device detected.

The question

What is, the right, stable, clear way to install CUDA on ANY version of Linux. I am ready to download, install ANY version of Linux.

Thanks a lot and very much for your help

Answer

Robert Crovella picture Robert Crovella · Jul 22, 2014

Niether Ubuntu 14.04 nor Linux Mint 17 is an officially supported distro for CUDA 6.

I've just done two installs of CUDA 6.5RC on Fedora 20 64-bit.

  1. load Fedora 20, select the C Development personality
  2. download the CUDA 6.5RC 64-bit installer (.run file) from developer.nvidia.com (you have to be a registered developer)
  3. switch to runlevel 3. To do this, take a look at the instructions in /etc/inittab, you basically want to do this, as root:

    ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
    
  4. remove the nouveau driver (as root):

    echo -e "blacklist nouveau\noptions nouveau modeset=0"  > /etc/modprobe.d/disable-nouveau.conf
    dracut --force
    
  5. reboot, and run the CUDA installer (.run file) as root. If you have 4GB or less of system memory, you may want to specify the temp directory that doesn't use tmpfs:

    sh cuda_6.5.11_rc_linux_64.run -tmpdir /var/tmp
    

    select accept, y, or <enter> as appropriate to accept the default options for loading the driver, toolkit, and samples.

  6. you can now switch back to runlevel 5 if you want to.

  7. run nvidia-smi as root, each time you reboot the system. This should not be necessary if you are running X (ie. runlevel 5). And there are other ways to address this as discussed in the getting started document.

Also refer to the linux getting started guide.

Instructions for other RHEL/CentOS/Fedora distros will be similar, and should work with previous CUDA versions (e.g. 6), if you don't want to use the 6.5RC toolkit. Be sure to select a distro that is officially supported for the CUDA toolkit you choose (in recent toolkits, refer to the getting started document.)

You'll also want to do those things you already know about, such as building the samples, setting your PATH and LD_LIBRARY_PATH environment variables, etc. This brief answer is not intended to be a replacement for reading the getting started document.