Description Usage Arguments Details Value Examples
makeParallel is a high level function that performs all the steps
to generate parallel code.
| 1 2 3 4 5 6 7 | makeParallel(code, isFile = file.exists(code), expr = if (isFile)
  parse(code, keep.source = TRUE) else parse(text = code, keep.source =
  FALSE), data = NULL, nWorkers = parallel::detectCores(),
  platform = Platform(nWorkers = nWorkers), run = FALSE,
  scheduler = schedule, ..., generator = generate,
  generatorArgs = list(), outFile = FALSE, prefix = "gen_",
  overWrite = FALSE)
 | 
| code | file name or a string containing code to be parsed | 
| isFile | logical, is the code a file name? | 
| expr | expression, for example from  | 
| data | list of data descriptions. Each element is a DataSource. The names of the list elements correspond to the variables in the code that these objects are bound to. | 
| nWorkers | integer, number of parallel workers | 
| platform | Platform describing resource to compute on | 
| run | logical, evaluate the code once to gather timings? | 
| scheduler,  | function to produce a Schedule from a TaskGraph. | 
| ... | additional arguments to schedule methods | 
| generator | function to produce GeneratedCode from a Schedule | 
| generatorArgs | list of named arguments to use with
 | 
| outFile | character name of the file to write the generated script. 
If FALSE then don't write anything to disk.
If TRUE and code comes from a file then use  | 
| prefix | character added to front of file name | 
| overWrite | logical write over existing generated file | 
The following are the high level steps:
Infer the task graph
Schedule the statements
Generate parallel code
The arguments allow the user to control every aspect of this process.
For more details see vignette("makeParallel-concepts").
code object of class GeneratedCode
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Make an existing R script parallel
script <- system.file("examples/mp_example.R", package = "makeParallel")
makeParallel(script)
# Write generated code to a new file
newfile <- tempfile()
makeParallel(script, file = newfile)
# Clean up
unlink(newfile)
# Pass in code directly
d <- makeParallel(expr = parse(text = "lapply(mtcars, mean)"))
# Examine generated code
writeCode(d)
# Specify a different scheduler
pcode <- makeParallel("x <- 1:100
y <- rep(1, 100)
z <- x + y", scheduler = scheduleTaskList)
# Some schedules have plotting methods
plot(schedule(pcode))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.