File: parallelStart.Rd

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 (186 lines) | stat: -rw-r--r-- 6,961 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parallelStart.R
\name{parallelStart}
\alias{parallelStart}
\alias{parallelStartLocal}
\alias{parallelStartMulticore}
\alias{parallelStartSocket}
\alias{parallelStartMPI}
\alias{parallelStartBatchJobs}
\alias{parallelStartBatchtools}
\title{Parallelization setup for parallelMap.}
\usage{
parallelStart(
  mode,
  cpus,
  socket.hosts,
  bj.resources = list(),
  bt.resources = list(),
  logging,
  storagedir,
  level,
  load.balancing = FALSE,
  show.info,
  suppress.local.errors = FALSE,
  reproducible,
  ...
)

parallelStartLocal(show.info, suppress.local.errors = FALSE, ...)

parallelStartMulticore(
  cpus,
  logging,
  storagedir,
  level,
  load.balancing = FALSE,
  show.info,
  reproducible,
  ...
)

parallelStartSocket(
  cpus,
  socket.hosts,
  logging,
  storagedir,
  level,
  load.balancing = FALSE,
  show.info,
  reproducible,
  ...
)

parallelStartMPI(
  cpus,
  logging,
  storagedir,
  level,
  load.balancing = FALSE,
  show.info,
  reproducible,
  ...
)

parallelStartBatchJobs(
  bj.resources = list(),
  logging,
  storagedir,
  level,
  show.info,
  ...
)

parallelStartBatchtools(
  bt.resources = list(),
  logging,
  storagedir,
  level,
  show.info,
  ...
)
}
\arguments{
\item{mode}{(\code{character(1)})\cr
Which parallel mode should be used: \dQuote{local}, \dQuote{multicore},
\dQuote{socket}, \dQuote{mpi}, \dQuote{BatchJobs}. Default is the option
\code{parallelMap.default.mode} or, if not set, \dQuote{local} without parallel
execution.}

\item{cpus}{(\code{integer(1)})\cr
Number of used cpus. For local and BatchJobs mode this argument is ignored.
For socket mode, this is the number of processes spawned on localhost, if
you want processes on multiple machines use \code{socket.hosts}. Default is the
option \code{parallelMap.default.cpus} or, if not set, \code{\link[parallel:detectCores]{parallel::detectCores()}}
for multicore mode, \verb{max(1, [mpi.universe.size][Rmpi::mpi.universe.size] - 1)} for mpi mode and 1 for socket mode.}

\item{socket.hosts}{\link{character}\cr
Only used in socket mode, otherwise ignored. Names of hosts where parallel
processes are spawned. Default is the option
\code{parallelMap.default.socket.hosts}, if this option exists.}

\item{bj.resources}{\link{list}\cr
Resources like walltime for submitting jobs on HPC clusters via BatchJobs.
See \code{\link[BatchJobs:submitJobs]{BatchJobs::submitJobs()}}. Defaults are taken from your BatchJobs
config file.}

\item{bt.resources}{\link{list}\cr
Analog to \code{bj.resources}.
See \code{\link[batchtools:submitJobs]{batchtools::submitJobs()}}.}

\item{logging}{(\code{logical(1)})\cr
Should slave output be logged to files via \code{\link[=sink]{sink()}} under the \code{storagedir}?
Files are named \verb{<iteration_number>.log} and put into unique subdirectories
named \verb{parallelMap_log_<nr>} for each subsequent \code{\link[=parallelMap]{parallelMap()}}
operation. Previous logging directories are removed on \code{parallelStart} if
\code{logging} is enabled. Logging is not supported for local mode, because you
will see all output on the master and can also run stuff like \code{\link[=traceback]{traceback()}}
in case of errors. Default is the option \code{parallelMap.default.logging} or,
if not set, \code{FALSE}.}

\item{storagedir}{(\code{character(1)})\cr
Existing directory where log files and intermediate objects for BatchJobs
mode are stored. Note that all nodes must have write access to exactly this
path. Default is the current working directory.}

\item{level}{(\code{character(1)})\cr
You can set this so only calls to \code{\link[=parallelMap]{parallelMap()}} that have exactly the
same level are parallelized. Default is the option
\code{parallelMap.default.level} or, if not set, \code{NA} which means all calls to
\code{\link[=parallelMap]{parallelMap()}} are are potentially parallelized.}

\item{load.balancing}{(\code{logical(1)})\cr
Enables load balancing for multicore, socket and mpi.
Set this to \code{TRUE} if you have heterogeneous runtimes.
Default is \code{FALSE}}

\item{show.info}{(\code{logical(1)})\cr
Verbose output on console for all further package calls? Default is the
option \code{parallelMap.default.show.info} or, if not set, \code{TRUE}.}

\item{suppress.local.errors}{(\code{logical(1)})\cr
Should reporting of error messages during function evaluations in local
mode be suppressed? Default ist FALSE, i.e. every error message is shown.}

\item{reproducible}{(\code{logical(1)})\cr
Should parallel jobs produce reproducible results when setting a seed?
With this option, \code{parallelMap()} calls will be reproducible when using
\code{set.seed()} with the default RNG kind. This is not the case by default
when parallelizing in R, since the default RNG kind "Mersenne-Twister" is
not honored by parallel processes. Instead RNG kind \code{"L'Ecuyer-CMRG"} needs
to be used to ensure paralllel reproducibility.
Default is the option \code{parallelMap.default.reproducible} or, if not set,
\code{TRUE}.}

\item{...}{(any)\cr
Optional parameters, for socket mode passed to
\code{parallel::makePSOCKcluster()}, for mpi mode passed to
\code{\link[parallel:makeCluster]{parallel::makeCluster()}} and for multicore passed to
\code{parallel::mcmapply()} (\code{mc.preschedule} (overwriting \code{load.balancing}),
\code{mc.set.seed}, \code{mc.silent} and \code{mc.cleanup} are supported for multicore).}
}
\value{
Nothing.
}
\description{
Defines the underlying parallelization mode for \code{\link[=parallelMap]{parallelMap()}}. Also allows
to set a \dQuote{level} of parallelization. Only calls to \code{\link[=parallelMap]{parallelMap()}}
with a matching level are parallelized. The defaults of all settings are
taken from your options, which you can also define in your R profile. For an
introductory tutorial and information on the options configuration, please go
to the project's github page at https://github.com/mlr-org/parallelMap.
}
\details{
Currently the following modes are supported, which internally dispatch the
mapping operation to functions from different parallelization packages:
\itemize{
\item \strong{local}: No parallelization with \code{\link[=mapply]{mapply()}}
\item \strong{multicore}: Multicore execution on a single machine with \code{parallel::mclapply()}.
\item \strong{socket}: Socket cluster on one or multiple machines with \code{parallel::makePSOCKcluster()} and \code{parallel::clusterMap()}.
\item \strong{mpi}: Snow MPI cluster on one or multiple machines with \code{\link[parallel:makeCluster]{parallel::makeCluster()}} and \code{parallel::clusterMap()}.
\item \strong{BatchJobs}: Parallelization on batch queuing HPC clusters, e.g., Torque, SLURM, etc., with \code{\link[BatchJobs:batchMap]{BatchJobs::batchMap()}}.
}

For BatchJobs mode you need to define a storage directory through the
argument \code{storagedir} or the option \code{parallelMap.default.storagedir}.
}