Skip to content

Commit

Permalink
fixed biocparallel asking for too many cpus in vignette.md -> now cmd…
Browse files Browse the repository at this point in the history
… check works locally on macOS
  • Loading branch information
evaham1 committed Sep 26, 2024
1 parent 37f903d commit 367ff84
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vignettes/vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,24 @@ The optimal parameters can be output, along with a plot showing the tuning resul
list.keepX <- c(seq(5, 50, 5))
list.keepY <- c(3:10)
# added this to avoid errors where num_workers exceeded limits set by devtools::check()
chk <- Sys.getenv("_R_CHECK_LIMIT_CORES_", "")
if (nzchar(chk) && chk == "TRUE") {
# use 2 cores in CRAN/Travis/AppVeyor
num_workers <- 2L
} else {
# use all cores in devtools::test()
num_workers <- parallel::detectCores()
}
set.seed(33) # For reproducibility with this handbook, remove otherwise
tune.spls.liver <- tune.spls(X, Y, test.keepX = list.keepX,
test.keepY = list.keepY, ncomp = 2,
nrepeat = 1, folds = 10, mode = 'regression',
measure = 'cor',
# the following uses two CPUs for faster computation
# it can be commented out
BPPARAM = BiocParallel::SnowParam(workers = 14)
BPPARAM = BiocParallel::SnowParam(workers = num_workers)
)
plot(tune.spls.liver)
Expand Down

0 comments on commit 367ff84

Please sign in to comment.