I am using xgb.cv and xgboost in R. However, it is not working as parallel
My example code as follow
param <- list("objective" = "reg:logistic"
, "eval_metric" = "logloss"
,"nthread" = 8
,"bst:eta" = .025
,"bst:max_depth" = 3
,"lambda" = 1
,"lambda_bias" = 0
,"alpha" = .8
,"min_child_weight" = 3
,"subsample" = .9
,"colsample_bytree" = .6)
bst.cv3 = xgb.cv(param=param, data = x, label = y,
nfold = 3, nrounds=cv.nround, missing = NA
,prediction = TRUE)
brew install clang-omp
brew install gcc --without-multilib
The previously selected answer unfortunately is now outdated. The
clang-omp package is no longer available in homebrew. So here's what worked for me.
First, at the shell:
brew reinstall gcc --without-multilib
Then, create the file
~/.R/Makevars with the following contents, making sure to update the paths so they correctly reflect the gcc version homebrew installed:
CC=/usr/local/Cellar/gcc/6.1.0/bin/gcc-6 CXX=/usr/local/Cellar/gcc/6.1.0/bin/g++-6 SHLIB_CXXLD=/usr/local/Cellar/gcc/6.1.0/bin/g++-6 FC=/usr/local/Cellar/gcc/6.1.0/bin/gfortran-6 F77=/usr/local/Cellar/gcc/6.1.0/bin/gfortran-6 MAKE=make -j8 SHLIB_OPENMP_CFLAGS=-fopenmp SHLIB_OPENMP_CXXFLAGS=-fopenmp SHLIB_OPENMP_FCFLAGS=-fopenmp SHLIB_OPENMP_FFLAGS=-fopenmp
Finally, restart R or RStudio and re-install the packages from source.
Wrote a small blog post about this at https://asieira.github.io/using-openmp-with-r-packages-in-os-x.html, by the way.