Skip to contents

This function initializes a persistent parallel cluster (either a fork cluster on Unix-like systems or a mirai cluster on others) to be used by all Design and Inference objects. This avoids the overhead of creating clusters repeatedly.

Usage

set_num_cores(num_cores, force_mirai = FALSE)

Arguments

num_cores

Integer number of worker processes to make available.

force_mirai

If TRUE, forces the use of the mirai package even on systems where forking is available.

Value

Invisible NULL.

Details

set_num_cores() sets a global upper bound for parallel work. It does not guarantee that every inference routine will use all requested workers. EDI's inference dispatcher applies a blocklist-first heuristic informed by package benchmarks: workloads that have shown consistent multicore slowdowns are forced to run serially, while the remaining workloads are allowed to use their method-specific warmup heuristics and native thread caps.

The default forced-serial blocklist covers incidence randomization confidence intervals, bootstrap for non-regression KK Wilcoxon inference, bootstrap for non-KK survival procedures, and bootstrap for incidence procedures. Do not expect a universal "more cores is faster" rule.

If you want to change the default policy, use set_parallel_dispatch_policy().

Examples

set_num_cores(2)
unset_num_cores()