Least Action

Nontrivializing triviality..and vice versa.

Archive for April 2014

NVIDIA CUDA on Fedora 20 x86-64 with NVIDIA Optimus

leave a comment »

So after weeks of experimentation, and frustration, I think I have finally gotten CUDA to work on my MSI GE 70 2OE-071 laptop. As you may know, NVIDIA Optimus is a technology that enables power-sharing and switching between Intel HD and NVIDIA GPUs on laptops. For some reason, MSI and some other manufacturers have disabled the option to disable Optimus technology from within the BIOS. Now as far as I know, Linux has shaky support for Optimus, and while I had no trouble with any Linux distro on my previous Dell XPS laptops (which did have Optimus) I just couldn’t get NVIDIA discrete graphics to work on my MSI “gaming” laptop, which is a shame, because much of my work involves (or has involved) the use of CUDA, and I am not eager to spend my programming time on Windows.

This is not an exhaustive guide, and I invite suggestions and corrections from users who may stumble upon this blog post. I tried to reproduce the scenario on my own laptop in order to make sure I didn’t miss anything.

Typically there are six stages in NVIDIA CUDA installation on Linux:

1. Get rid of the nouveau driver if you are installing the proprietary NVIDIA driver by hand.
2. Reboot, get to a text mode (sadly, init doesn’t work anymore, so if you’re a old Unix user like me, you have to google this up before you start playing with your system).
3. Install the NVIDIA device driver.
4. Reboot, make sure a basic X configuration works (known as the “graphical mode” nowadays).
5. Install the CUDA toolkit, and set PATH and LD_LIBRARY_PATH variables.
6. Compile CUDA samples.

Now I believe much of the errors you will face in steps 1 through 6 are from a partial understanding of the way the X Server and Linux work, and that is based on my own experience. Playing with Linux can be a humbling experience even for someone who has used it for over a decade! But this is quite a lot of fun if you can document everything, and remember what you did to get something to work. It also helps if you have a system to play with, so if you have issues with installing and re-installing the OS n times before you can get to perfection, then this guide isn’t for you. Sorry!

Stuff I had to get to run the CUDA samples:
gcc-g++ in Fedora
libXmu-devel in Fedora (this installs the libXmu libraries)



Written by Vivek

April 20, 2014 at 19:16

Posted in CUDA, Linux, Programming