File: zzz.R

package info (click to toggle)
r-cran-parallelmap 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 336 kB
  • sloc: sh: 13; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
#' @import BBmisc
#' @import checkmate
#' @import parallel
#' @importFrom utils getFromNamespace head tail
#' @importFrom stats setNames

# define constants
MODE_LOCAL = "local"
MODE_MULTICORE = "multicore"
MODE_SOCKET = "socket"
MODE_MPI = "mpi"
MODE_BATCHJOBS = "BatchJobs"
MODE_BATCHTOOLS = "batchtools"
MODES = c(MODE_LOCAL, MODE_MULTICORE, MODE_SOCKET, MODE_MPI, MODE_BATCHJOBS, MODE_BATCHTOOLS)

STATUS_STARTED = "started"
STATUS_STOPPED = "stopped"

PKG_LOCAL_ENV = new.env()

.MulticoreCluster = new.env()

.onLoad = function(libname, pkgname) {
  # init all settings from defaults
  # we cant call any function here in onload that dispatch to BBmisc...
  options(
    parallelMap.mode = getPMDefOption("mode", MODE_LOCAL),
    parallelMap.cpus = getPMDefOption("cpus", NA_integer_),
    parallelMap.socket.hosts = getPMDefOption("socket.hosts", NULL),
    parallelMap.level = getPMDefOption("level", NA_character_),
    parallelMap.logging = getPMDefOption("logging", FALSE),
    parallelMap.show.info = getPMDefOption("show.info", TRUE),
    parallelMap.storagedir = getPMDefOption("storagedir", getwd()),
    parallelMap.status = STATUS_STOPPED,
    parallelMap.on.slave = FALSE,
    parallelMap.registered.levels = list(),
    parallelMap.suppress.local.errors = FALSE,
    parallelMap.reproducible = TRUE
  )
  # set defaults
  makeMulticoreCluster()
}