R/get_cores.r

Defines functions get_cores

Documented in get_cores

#########################################################################
# GET CORES
#########################################################################

get_cores <- function(runs) {

	x <- max(detectCores(all.tests = FALSE, logical = TRUE) - 1, 1)

	for (i in x:1) {
		if (runs %% i == 0) {
			break
		}
	}
	x <- i
	if (is.na(x)) x <- 2

	if (Sys.info()[['sysname']] == 'Windows') x <- 1

	return(x)

}

Try the population package in your browser

Any scripts or data that you put into this service are public.

population documentation built on March 18, 2022, 7:18 p.m.