Tidymodels, processing through CPU vs. GPU

I was only able to find below two posts on this topic -- barely any conversation. Is there any support or documentation for tidymodels on using GPU?

When I try

library(tidymodels)
xg_model <-
  boost_tree(
    # trees = 1000, 
    # tree_depth = tune(), min_n = tune(), 
    # loss_reduction = tune(),                     ## first three: model complexity
    # sample_size = tune(), mtry = tune(),         ## randomness
    # learn_rate = tune(),                         ## step size
  ) %>%
  set_engine("xgboost", tree_method = 'gpu_hist') %>%
  set_mode("classification") %>% fit(Species ~.,data=iris)

I get

Error in xgb.iter.update(bst$handle, dtrain, iteration - 1, obj) :
[09:00:18] amalgamation/../src/metric/../common/common.h:156: XGBoost version not compiled with GPU support.
Timing stopped at: 0 0 0

which would imply to me that it would use gpu, if my xgboost was compiled with that ability.

2 Likes

Right

Do you happen to know if there is a list of methods within tidymodels that would use the GPU? It could be resampling methods, modelling, recipes, etc.

sorry, I have no idea about that.
probably another good place to ask might be the issues board on Issues · tidymodels/tidymodels (github.com)

1 Like

You have to compile xgboost yourself if you want GPU support. CRAN doesn't build the package for that. See this thread.

tidymodels just calls the function so, I believe , that it should just work as long as the package itself can do it.

4 Likes

My understanding is the GPU will really shine when using deep learning models or XGBoost and other tree models (if they have GPU support). It's because you need thousands of processes that can run in parallel. I don't think GPU will provide any boost for data pre-processing or resampling.