Skip to content

Build Instructions for OSX

Charles Determan edited this page Jun 20, 2018 · 7 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.

##Installation

OpenCL

OpenCL should be present by default but you likely will not have the C++ API. This is required currently until I find a cleaner way to include this (possibly in the includes of this package, TBD).

You can download it on the Khronos downloads page here which provides all the OpenCL headers. You will want whichever is the most recent version you currently have. To find this out, on a Mac OSX 10.10 you open the /System/Library/Frameworks/OpenCL.framework/Headers/cl.h file in your favorite text editor and find the /* OpenCL Version */ section. Choose the highest version, download the corresponding cl.hpp file and put it in that directory.

This is typically accomplished with the two following commands (OpenCL 2.1 example):

wget https://www.khronos.org/registry/cl/api/2.1/cl.hpp
sudo mv cl.hpp /System/Library/Frameworks/OpenCL.framework/Headers/cl.hpp

Note for El Capitan Users

If you are using OSX 11.11 (El Capitan), you may need to disable System Integrity Protection (SIP) temporarily to be able to copy cl.hpp to the System folder. To disable SIP:

  1. Restart the computer holding cmd+R
  2. Go to the Utilities menu and open a Terminal
  3. On the Terminal, enter csrutil disable
  4. Then restart the computer normally.

After copying the file, you can enable SIP by repeating the process, but this time entering the command csrutil enable.

SDK

Although this may work out of the box you may need an appropriate SDK installed for the GPU you have installed. Most functions will work on the CPU but you likely are installing this to use a GPU. I personally do not have a Mac so I am unable to provide further documentation at this time. Would love any contributions by those with additional experience.

R Install

Once the above dependencies are met, you can install gpuR

###Stable

install.packages('gpuR')

###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 :)