parallel

package
v0.7.6 Latest Latest
Warning

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

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

Documentation

Overview

Package parallel provides parallel execution utilities for the Born ML framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For(n int, f func(i int), cfg Config)

For executes f(i) for i in [0, n) with optional parallelism. Falls back to sequential execution if parallelism is disabled or n is too small.

func ForBatch

func ForBatch(batch, channels int, f func(b, c int), cfg Config)

ForBatch optimized for batch*channels iteration pattern. Common in CNN operations like Conv2D.

Types

type Config

type Config struct {
	Enabled      bool // Whether parallel execution is enabled.
	NumWorkers   int  // Number of worker goroutines to use.
	MinChunkSize int  // Minimum items per goroutine to avoid overhead.
}

Config controls parallel execution behavior.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns sensible defaults based on CPU count.

Jump to

Keyboard shortcuts

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