% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parallel_helpers.R
\name{run_parallel}
\alias{run_parallel}
\title{Run a parallel computation using either "parallel" or "future"}
\usage{
run_parallel(
  X,
  FUN,
  backend = c("parallel", "future"),
  use_threads = NULL,
  cl = NULL
)
}
\arguments{
\item{X}{List (or vector) of inputs that will be split among the workers.}

\item{FUN}{Function that will be executed on each chunk.}

\item{backend}{Either "parallel" or "future".}

\item{use_threads}{Number of workers (relevant for both back‑ends).}

\item{cl}{Optional cluster object created with \code{parallel::makeCluster()}.
Only required when using the \code{"parallel"} backend on Windows, where
\code{parallel::parLapply()} is used. Ignored on Unix-like systems where
\code{parallel::mclapply()} is available.}
}
\value{
List of results (identical to the output of `parLapply` /
  `future_lapply`). The list is **named** – the names are taken from the
  split index (`split_idx`).
}
\description{
Small wrapper that hides the branching between the two back‑ends.
  It always returns a **named list** whose names are identical to the names
  of the input split list. This guarantees that `unlist()` produces the same
  named vector for both back‑ends, which is required by the unit tests.
}
\keyword{internal}
