Skip to contents

Splits n_reps replications among n_cores processes so that every process gets the same base share and the remainder is handed out one replication at a time, starting with the first process. This is the load-balancing step of the general parallel simulation algorithm.

Usage

split_reps(n_reps, n_cores)

Arguments

n_reps

Total number of replications.

n_cores

Number of worker processes.

Value

An integer vector of length n_cores that sums to n_reps.

Examples

split_reps(1000003, 8)
#> [1] 125001 125001 125001 125000 125000 125000 125000 125000
sum(split_reps(1000003, 8))
#> [1] 1000003