/usr/lib/R/site-library/BiocParallel/unitTests/test_bpvectorize.R is in r-bioc-biocparallel 0.6.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(doParallel)
.fork_not_windows <- function(expected, expr)
{
err <- NULL
obs <- tryCatch(expr, error=function(e) {
if (!all(grepl("fork clusters are not supported on Windows",
conditionMessage(e))))
err <<- conditionMessage(e)
expected
})
checkTrue(is.null(err))
checkIdentical(expected, obs)
}
test_bpvectorize_Params <- function()
{
params <- list(serial=SerialParam(),
mc=MulticoreParam(2),
snow0=SnowParam(2, "FORK"),
snow1=SnowParam(2, "PSOCK"),
batchjobs=BatchJobsParam(workers=2),
dopar=DoparParam())
dop <- registerDoParallel(cores=2)
x <- 1:10
expected <- sqrt(x)
for (ptype in names(params)) {
psqrt <- bpvectorize(sqrt, BPPARAM=params[[ptype]])
.fork_not_windows(expected, psqrt(x))
}
closeAllConnections()
}
|