function
parallelize
parallelize[func: fn(Int, /) capturing -> None]()
Executes func(0) ... func(N-1) as sub-tasks in parallel, and returns when all are complete. N is chosen to be the number of processors on the system.
Parameters:
- func (
fn(Int, /) capturing -> None
): The function to invoke.
parallelize[func: fn(Int, /) capturing -> None](num_work_items: Int)
Executes func(0) ... func(num_work_items-1) as sub-tasks in parallel, and returns when all are complete.
CAUTION: Creates and destroys a local runtime! Do not use from kernels!
Parameters:
- func (
fn(Int, /) capturing -> None
): The function to invoke.
Args:
- num_work_items (
Int
): Number of parallel tasks.
parallelize[func: fn(Int, /) capturing -> None](num_work_items: Int, num_workers: Int)
Executes func(0) ... func(num_work_items-1) as sub-tasks in parallel, and returns when all are complete.
Parameters:
- func (
fn(Int, /) capturing -> None
): The function to invoke.
Args:
- num_work_items (
Int
): Number of parallel tasks. - num_workers (
Int
): The number of workers to use for execution.