Skip to contents

Configures the future backend for parallel execution. Supports local multicore, PBS/TORQUE, SLURM, and other HPC schedulers via future.batchtools.

Usage

setup_future_backend(
  backend = c("multisession", "multicore", "cluster", "sequential", "batchtools_torque",
    "batchtools_slurm", "batchtools_sge", "batchtools_lsf"),
  workers = NULL,
  resources = list(),
  template = NULL,
  verbose = TRUE
)

Arguments

backend

Character. Backend type:

  • "multisession": Local parallel sessions (default)

  • "multicore": Local forked processes (Unix only)

  • "cluster": Manual cluster setup

  • "batchtools_torque": PBS/TORQUE scheduler

  • "batchtools_slurm": SLURM scheduler

  • "batchtools_sge": SGE scheduler

  • "batchtools_lsf": LSF scheduler

workers

Integer. Number of workers for local backends.

resources

List. HPC resource specifications for batchtools backends:

  • walltime: Wall time limit (e.g., "04:00:00")

  • memory: Memory per job (e.g., "4gb" or "4096")

  • ncpus: CPUs per job

  • queue: Queue/partition name

template

Character. Path to batchtools template file (optional).

verbose

Logical. Print setup information.

Value

Invisibly returns the previous plan.

Details

This function is a wrapper around future::plan() that simplifies HPC backend configuration. For PBS/TORQUE, it uses future.batchtools::batchtools_torque.

Examples

if (FALSE) { # \dontrun{
# Local multicore
setup_future_backend("multisession", workers = 4)

# PBS/TORQUE with resources
setup_future_backend(
  "batchtools_torque",
  resources = list(walltime = "02:00:00", memory = "8gb")
)

# Reset to sequential
setup_future_backend("sequential")
} # }