getNCores: Set number of cores

View source: R/getNCores.R

getNCoresR Documentation

Set number of cores

Description

Set the number of cores for parallel operations. Also convert integer 'parallel' to TRUE-FALSE for ease.

Usage

getNCores(parallel)

Arguments

parallel

A logical scalar, or a positive integer; ignored unless confidence intervals are requested (i.e., !is.null(ci)). If TRUE, bootstrap iterations are run in parallel using the maximum number of CPU cores minus 1. The maximum number of CPU cores is reported by parallel::detectCores(). If a positive integer (1 <= parallel <= maximum cores), bootstrap iterations are performed in parallel on that many cores. If FALSE, bootstrap iterations are performed in series, and progress will be shown if showProgress == TRUE. Parameters showProgress and plot.bs are ignored when operating in parallel.

Details

Input parallel <= 0 is converted to 1. Input parallel > maxCores is converted to maxCores. If input parallel is numeric, is first converted to integer by rounding down.

Value

A list with components $parallel and $cores. $parallel is logical, T for parallel operations, F o.w. $cores is the number of cores to use during parallel operations. $cores is integer in the range 1, 2, ..., max(Available cores).


Rdistance documentation built on Jan. 10, 2026, 1:07 a.m.