revdep/checks.noindex/MachineShop/old/MachineShop.Rcheck/tests/testthat/helper-parallel.R

with_parallel <- function(code) {
  cores <- as.numeric(Sys.getenv("TEST_CORES"))
  if (is.na(cores)) cores <- 1
  if (require("doParallel", quietly = TRUE) && cores > 1) {
    doParallel::registerDoParallel(cores = cores)
    on.exit(doParallel::stopImplicitCluster())
  }

  code
}
gbm-developers/gbm documentation built on Feb. 16, 2024, 6:13 p.m.