Monday, June 16, 2014

Day 20: Enter the new laptop

On Friday, my new laptop came in and I spent much of the weekend trying to figure out how to enable the GPU.

First of all, since I'm used to working in a Unix environment, I decided to install Ubuntu. Originally, I intended to install this alongside the Windows 8 Operating System the laptop came with. But I accidentally replaced the OS instead.

I'll outline the steps I took in case you're wondering, ... and also for my own sake to have a record.

First step is to download Ubuntu from their website. Since I didn't have any blank DVDs handy, I opted to create a pen drive installer (Ubuntu provides instructions for this). Basically, you turn a USB stick into a Ubuntu operation system. Before booting into Windows, you can boot into your USB stick, where you have the option of testing out Ubuntu, or installing it. You also have the option of installing Ubuntu alongside an existing OS, unless you accidentally click the button that say replace your existing OS (d'oh!). The rest of the installation is pretty straight forward, so I won't go into it.

The hard part was figuring out how to enable the GPU and install CUDA, NVIDIA's parallel computing platform. Building off of CUDA is PyCUDA, a Python wrapper, which I'm excited to apply to some of my MNE routines.

First I had to download CUDA from NVIDIA's website. Since Ubuntu 14.04 isn't explicitly supported, I went with the runfile cuda_6.0.37_linux_64.run. Working primarily from this Ubuntu forum thread, I next extracted the separate installers for the nivida driver, cuda, and cuda samples.


mkdir ~/Downloads/nvidia_installers;
cd ~/Downloads
./cuda_6.0.37_linux_64.run -extract=~/Downloads/nvidia_installers;
 
 
Next I removed any previously installed NVIDIA software. This was necessary after I screwed this up a few times.


sudo apt-get --purge remove nvidia-* 


Next I had to stop all instances of Xorg. This means shutting off the Ubuntu GUI and going to a black screen. I had my other laptop with the instructions handy.
 
 
sudo service lightdm stop


Once you have a black screen, you can log into a terminal interface by pressing Ctrl+Alt+F1. You can then login using your usual username and password. I do a final check for any applications using Xorg (there were none), and then I run the installer for the NVIDIA driver.

 
cd ~/Downloads/nvidia_installers;
sudo killall Xorg
sudo ./NVIDIA-Linux-x86_64-331.62.run --no-opengl-files


The --no-opengl-files option was the key for my laptop. Without it, I couldn't get back to the Ubuntu GUI after running either ...

 
sudo service lightdm start
sudo reboot


The NVIDIA documentation explains that this is necessary when your system has both an integrated GPU and a discrete GPU.

After this step, I was able to install cuda and cuda-samples without anything special.

 
sudo modprobe nvidia
sudo ./cuda-linux64-rel-6.0.37-18176142.run
sudo ./cuda-samples-linux-6.0.37-18176142.run
 

Finally, I followed NVIDIA's post installation guidelines to verify that everything was working correctly.

Now I'm looking forward to using the GPU to speed up code development for this project.

No comments:

Post a Comment