#' Create a Parallel Computing Cluster
#'
#' This function is a wrapper for the \code{\link[BiocParallel]{SnowParam}} and
#' \code{\link[BiocParallel]{MulticoreParam}} constructor functions.
#'
#' @param nCores The number of computing cores to make available for coMethDMR
#' computation
#' @param ... Additional arguments passed to the cluster constructors.
#'
#' @details This function checks the operating system and then creates a
#' cluster of workers using the \code{SnowParam} function for Windows
#' machines and the \code{MulticoreParam} function for non-Windows machines.
#'
#' @export
#'
#' @importFrom BiocParallel SnowParam SerialParam MulticoreParam
#' @examples
#' workers_cl <- CreateParallelWorkers(nCores = 4)
#' @return A parameter class for use in parallel evaluation
CreateParallelWorkers <- function(nCores, ...){
if (nCores > 1L) {
if (Sys.info()["sysname"] == "Windows"){
SnowParam(workers = nCores, type = "SOCK", ...)
} else {
MulticoreParam(workers = nCores, ...)
}
} else {
SerialParam(...)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.