# Parallel computation

#### Mark Padgham

#### 2026-09-03

The `dodgr` package implements most calculations by default in parallel, using the maximum number of available threads or cores. Numbers of available threads can be determined with either of the following two functions:

    parallel::detectCores ()

    ## [1] 12

    RcppParallel::defaultNumThreads ()

    ## [1] 12

Numbers of cores used in calculations can be controlled by specifying the `numThread` parameter passed to the `RcppParallel` function `setThreadOptions`. For control over numbers of threads used, this function must be called prior to calling any `dodgr` functions. For example, single-threaded processing can be ensured by first making the following call:

    RcppParallel::setThreadOptions (numThreads = 1L)