Optimus + CUDA in Fedora 20

Recent laptops mostly come with hybrid-graphics system (two GPUs in one machine: an integrated GPU and a discrete GPU). It was first designed to control power consumption in laptops. By default, the operating system will use the integrated GPU which is less power consumption. Only when heavy activities (gaming, graphic rendering, GPU computing, etc) are performed, then operating system will move the workload to the discrete GPU.

For laptop with NVIDIA GPU, there is NVIDIA Optimus Technology for auto-switching between integrated GPU and discrete GPU. Unfortunately, NVIDIA support for this technology in Linux is not as good as in Windows. Since discrete GPU is a secondary card, installing the driver for NVIDIA GPU is not easy and may cause problem with the display manager in Linux.

But, thankfully, there is an open-source project called Bumblebee-project that develop and provide support for the NVIDIA Optimus Technology in Linux. It provides access to the discrete GPU including running CUDA applications. And here are the steps to make Optimus and CUDA work in Fedora 20:

1. Install virtualgl, bbswitch, bumblebee, and bumblebee-nvidia. Follow instructions in this link (fedoraproject.org/wiki/Bumblebee)

2. Download cuda repo from NVIDIA website (developer.nvidia.com/cuda-downloads)

3. Install cuda-toolkit (yum -y install cuda-toolkit). NOTE: it must be “cuda-toolkit” because we have to exclude the cuda-drivers package.

4. To run cuda application, we have to use optirun command.
$> optirun [your_cuda_application]

Leave a Reply

Your email address will not be published. Required fields are marked *