pin_workers: Pin shard workers to CPU cores
Description
Best-effort worker pinning to improve cache locality and reduce cross-core
migration. Currently supported on Linux only.
Usage
pin_workers(pool = NULL, strategy = c("spread", "compact"), cores = NULL)Value
Invisibly, a logical vector per worker indicating success.
Arguments
- pool
Optional shard_pool. Defaults to current pool.
- strategy
"spread" assigns worker i -> core i mod ncores. "compact"
assigns workers to the first cores.
- cores
Optional integer vector of available cores (0-based). If NULL,
uses 0:(detectCores()-1).
Examples
Run this code# \donttest{
affinity_supported()
# }
Run the code above in your browser using DataLab