Skip to content

Build Instructions for Linux

Charles Determan edited this page Dec 4, 2015 · 10 revisions

##Dependencies There are essentially three major dependencies that are required:

  1. OpenCL headers (can be found at Khronos.org)
  2. An OpenCL SDK specific to your GPU vender (AMD, NVIDIA, Intel, etc.)
  3. A compiler that supports C++11 (e.g. template aliases)

Note - the package will install if you dependencies 1 & 3 but it will be essentially non-functional. However you will need to install opencl-dev or ocl-icd-opencl-dev so you have libOpenCL for the compiler.

The only verified installations at present consisted of using a NVIDIA 970 GTX or a AMD Radeon Graphics Card on a Ubuntu 14.04 system. The installation consisted of: Note, you currently can only have one type installed (NVIDIA or AMD) NVIDIA Driver and CUDA/OpenCL Up-to-date Card

Install OpenCL headers

# Install OpenCL headers
sudo apt-get install opencl-headers

NVIDIA GPU

####New Card

If you are fortunate enough to have a very recent NVIDIA card that you can use the most recent drivers. This install is quite simple:

# Install NVIDIA Drivers and CUDA
sudo add-apt-repository -y ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-346 nvidia-settings
Download and install CUDA toolkit

You can download the .deb file from NVIDIA here and install the repository with:

sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb
sudo apt-get update
sudo apt-get install cuda

It is recommended to restart your computer after this installation completes.

####Older Card

If you have an older card that doesn't support the newest drivers then it is more complicated. The following work-flow has proven successful for me on Ubuntu:

  1. Purge any existing nvidia and cuda implementations (sudo apt-get purge cuda* nvidia-*)
  2. Download appropriate CUDA toolkit for the specific card. You can figure this out by first checking which NVIDIA driver is compatible with your card by searching for it in NVIDIA's Driver Downloads. Then check which cuda toolkit is compatible with the driver from this Backward Compatibility Table The cuda-6.5 toolkit was appropriate for me which you can download from the CUDA toolkit archive. Once downloaded, run the .run file.
  3. Reboot computer
  4. Switch to ttyl (Ctrl-Alt-F1)
  5. Stop the X server (sudo stop lightdm)
  6. Run the cuda run file (sh cuda_6.5.14_linux_64.run)
  7. Select 'yes' and accept all defaults
  8. Required reboot
  9. Switch to ttyl, stop X server and run the cuda run file again and select 'yes' and default for everything (including the driver again)
  10. Update PATH to include /usr/local/cuda-6.5/bin and LD_LIBRARY_PATH to include /usr/local/cuda-6.5/lib64
  11. Reboot again

AMD GPU

If you are using a AMD GPU, the following has proven to work for me on Ubuntu.

#Purge existing fglrx drivers 
sudo sh /usr/share/ati/fglrx_uninstall.sh

#Install current fglrx drivers 
sudo apt-get install fglrx-updates

#Install opencl-headers 
sudo apt-get install opencl-headers

##gpuR package install

Once your driver is installed you can install the gpuR package.

###Stable Will be posted to CRAN following completion of version 1.0.0 Development

###Unstable

# Dev RViennaCL
devtools::install_github("cdeterman/RViennaCL")

# Dev gpuR
devtools::install_github("cdeterman/gpuR")

Once all these things are set you should be able to install the package and begin using your GPU :)