Struggles with GPUs and Ubuntus

Over the last year or so I’ve been working on Ubuntu OSs, conducting my research and writing my thesis. While writing the thesis isn’t an issue when it comes to hardware technicalities, I cannot say the same for the coding side of my Master’s.

My research primarily focuses on optimizing simulations based on cellular automata, and in order to do so, I’ve been utilizing NVIDIA GPUs. I started off using a laptop with a mobile-series GPU. What I did not know at the time of purchase was that Intel and NVIDIA had devised a strategy to save battery life. This strategy is known as Optimus, and essentially what it entails is that the more battery-intensive GPU is only utilized for heavy graphical processing and other forms of rendering. General usage reverts back to using the built-in CPU graphics processor which is less battery intensive. Although this strategy works perfectly fine (as far as I know) on Windows OSs, it does not really work all that well on Ubuntu. First off, if you decide to boot directly into Ubuntu when switching on the laptop, Ubuntu cannot establish proper low-end communication with the battery checker, and a strange glitch tends to occur 90% of the time… The GPU fan will spin at full speed, Ubuntu does not know how much battery life the laptop has left, and whether the laptop is plugged-in or not. The battery indicator LED will also constantly flash.

I did quite some research on this issue, and found two solutions. The one solution (tested by other people across the planet with the same problem as I had) installed an Optimus driver simulator (specifically developed for Ubuntu 12.04+), known as Bumblebee. However, when I discovered Bumblebee, it was still in its infancy and there were still a lot of issues reported, especially with later model GPUs, like the one I have.
The other solution (which I stuck to) is a lot more simple, and it involves first booting into Windows, with the laptop not plugged-in, using a bit of battery, and then restarting and logging into Ubuntu. Luckily, I replaced the stock hard-drive with a solid-state hard-drive to speed-up boot-up times.

When I started learning CUDA later last year, I eventually had to get the GPU working, which meant that I would have to try and install drivers for the GPU. But this meant that I might have to try and install Bumblebee, because at that time I thought that I’d be using the GPU as the primary rendering device. How fortunate I was that this process of getting the GPU to ‘work’ did not require me to hack the system. After I installed CUDA, Ubuntu was able to communicate with the GPU and send it request to perform work, without me having to use it as the primary rendering device.

Thus, I was able to learn and apply CUDA for my research. The GPU in my laptop is pretty much just a chunk of supercomputing power when I’m logged in on Ubuntu. But, it gets the job done.

More recently I decided to get a desktop system, with a desktop GPU (which are more powerful than their mobile counterparts), so that I can generate more data for my thesis. After acquiring the desktop system, the whole process of installing Ubuntu and installing GPU drivers had to be performed again. This time around I wasn’t really bothered (at first) since I wasn’t dealing with a system that uses Optimus. However, getting the GPU to work as I first intended it to do, turned out to be quite difficult…

The plan was to install the drivers and then use the GPU as the primary rendering device (and not the on-board GPU). Unfortunately, the driver that accompanies the latest release of CUDA doesn’t properly support the GPU that I decided to get, as well as the latest release of Ubuntu. It does allow me to communicate with the GPU, but NVIDIA X-Server does not start properly and thus the GPU cannot be used as the primary rendering device. So I had to revert to using the on-board GPU to display the goods. After a couple of days of persistence I did manage to set up a proper working environment.

So what I’ve learned over the last year or so is that, if you are interested in this line of research, i.e. using GPUs for general computation, make sure that the hardware you have at your disposal can be used as you have intended. If you are planning on purchasing new hardware, make sure that the operating system you intend to use, does have support for all of the hardware (yes you: graphics and networking) or that there are proper ways to getting your hardware to work. In terms of using something like CUDA, make sure that you are installing it on a supported operating system. And as far as you can, FOLLOW OFFICIAL INSTRUCTIONS when installing drivers and software on operating systems such as Ubuntu (and other Linux based operating systems). Finally, be persistent; that is what helped me to set up my working environment.

No comments yet.

Leave a comment

Leave a Reply