-
Notifications
You must be signed in to change notification settings - Fork 11
Getting Started
Simply start R and install directly from CRAN.
R> install.packages("Rclusterpp")
All done! A this time, the binary version of Rclusterpp for Mac OS X hosted on CRAN does not support multithreaded operation. To compile with multithreaded support, see the next section.
- Version 2.15 or later of R. The 64-bit version of the program is recommended.
- If installing from source (which you're probably doing if you're reading this page), you'll need a compiler installed.
- Linux users will most likely already have a complier installed.
- Windows users will need to install the Rtools package.
- For Mac OS X, XCode should work although there are some incompatibilities between the newly-released Xcode 5 and the pre-compiled version of R supplied by CRAN. In order to use the compiler supplied by any version of XCode, the command line compile tools must also be installed . To install them after installing XCode:
- Launch XCode.
- Choose "Preferences..." under the "XCode" Menu.
- Select the "Downloads" section and then click on the "Components" bar.
- Click the "Install" button for the Command Line Tools option.
- NOTE: If Command Line Tools are not available in XCode, try running the following command in the terminal:
xcode-select --install
To enable Rclusterpp to take advantage of OpenMP multithreaded support, we must first install a compiler that supports OpenMP. To do this:
Download and install MacPorts
Open a terminal and from the command line, install gcc version 4.8:
shell> sudo port install gcc48
Confirm gcc48 is active:
shell> g++-mp-4.8 -v
Now tell R to use our newly installed version of g++. Open a terminal and use a text editor to create the ~/.R/Makevars file:
shell> mkdir ~/.R shell> nano ~/.R/Makevars
Add the following lines to the text file:
CXX=g++-mp-4.8 -arch x86_64 CC=gcc-mp-4.8 SHLIB_OPENMP_CXXFLAGS= -fopenmp
Write changes and exit the editor. If you're using nano, type control-o, hit "enter", and then control-x.
Start R and recompile the Rclusterpp and its dependancies using the newly installed compiler:
R> install.packages("Matrix") R> install.packages(c("Rcpp","RcppEigen","Rclusterpp"),type="source")
Multithreaded support should now be enabled.
You may tell R to ignore the new compiler in the future by commenting out the added lines in the Makevars file.