Learn R Programming

modeltime (version 1.3.0)

parallel_start: Start parallel clusters using parallel package

Description

Start parallel clusters using parallel package

Usage

parallel_start(..., .method = c("parallel", "spark"))

parallel_stop()

Arguments

...

Parameters passed to underlying functions (See Details Section)

.method

The method to create the parallel backend. Supports:

  • "parallel" - Uses the parallel and doParallel packages

  • "spark" - Uses the sparklyr package

Parallel (<code>.method = "parallel"</code>)

Performs 3 Steps:

  1. Makes clusters using parallel::makeCluster(...). The parallel_start(...) are passed to parallel::makeCluster(...).

  2. Registers clusters using doParallel::registerDoParallel().

  3. Adds .libPaths() using parallel::clusterCall().

Spark (<code>.method = "spark"</code>)

  • Important, make sure to create a spark connection using sparklyr::spark_connect().

  • Pass the connection object as the first argument. For example, parallel_start(sc, .method = "spark").

  • The parallel_start(...) are passed to sparklyr::registerDoSpark(...).

Examples

Run this code

# Starts 2 clusters
parallel_start(2)

# Returns to sequential processing
parallel_stop()



Run the code above in your browser using DataLab