parallel

package
v0.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunks added in v0.20.0

func Chunks(nbIterations int, maxCpus ...int) [][2]int

Chunks returns a slice of [2]int where each element is a (start, end) range to be processed by a worker, exactly as Execute does.

func Execute

func Execute(nbIterations int, work func(int, int), maxCpus ...int)

Execute process in parallel the work function

func ExecuteAligned added in v0.20.0

func ExecuteAligned(nbIterations, alignment int, work func(int, int), maxCpus ...int)

ExecuteAligned is like Execute but ensures that chunk boundaries are aligned to the given alignment value (except possibly the last chunk). This is useful when work functions use SIMD operations that process elements in fixed-size blocks (e.g., 16 for AVX512), to avoid per-chunk tail handling.

Work is distributed evenly: tasks receive either k or k+alignment elements, where k is the largest multiple of alignment that fits. Any unaligned tail (nbIterations % alignment) is absorbed by the last task.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL