All examples
Scientific computing

Share immutable numerical inputs

Snapshot a typed array once, run bounded local repetitions and inspect exact immutable input values and copy accounting.

repeat_shared_input.aner
import aner.parallel

// One explicit numerical copy, shared by all local repetitions.
// Ordinary mutable parameters still receive private per-task copies.
fn simulate(parameters: List, iteration: Int64, seed: Int64) -> Float64 {
    let input = cast<FrozenArray<Float64>>(parameters.get(0))
    return input[iteration % input.len()] + Float64(iteration)
}

let initial = Array<Float64>(size: 1000, fill: 2.0)
let input = initial.snapshot()
initial[0] = 99.0

let results = parallel.repeat(iterations: 1000, task: simulate,
    parameters: List(input), execution: parallel.local(), seed: 42)
print(input[0])
print(results.value(0, 0))
print(results.value(999, 0))
print(results.summary())

Make it your experiment.

With Aner 0.0.3 or newer installed, save this program as examples/parallel/repeat_shared_input.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/parallel/repeat_shared_input.aner
aner run examples/parallel/repeat_shared_input.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires Aner 0.0.4 or newer. This complete example runs locally with synthetic numerical inputs and no external files, service or credentials. The guide describes memory limits and optional cluster setup separately.

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner