R/autodetectCpus.R

Defines functions autodetectCpus

autodetectCpus = function(mode) {
  if (mode == MODE_MULTICORE) {
    cpus = detectCores()
  } else if (mode == MODE_MPI) {
    cpus = max(1L, Rmpi::mpi.universe.size() - 1L)
  } else {
    cpus = NA_integer_
  }
  if (!testCount(cpus, positive = TRUE)) {
    stopf("The was some problem in autodetecting the number of cpus. Autodetection returned:\n%s", printStrToChar(cpus))
  }
  showInfoMessage("Autodetecting cpus: %i", cpus)
  return(cpus)
}

Try the parallelMap package in your browser

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

parallelMap documentation built on June 28, 2021, 9:07 a.m.