All examples
Scientific computing

Reproducible native CPU parallelism

Compare exact serial and automatic CPU sample accounting under the same scientific simulation, then inspect measured execution and the result.

Download .aner source
monte_carlo_local.aner
import aner.parallel

// The same sample identities are used for the serial and automatic CPU runs.
let serial = parallel.monte_carlo(samples: 1000000, seed: 42,
    execution: parallel.local(workers: 1, chunk: 65536))
let concurrent = parallel.monte_carlo(samples: 1000000, seed: 42,
    execution: parallel.local())
print(serial.hits() == concurrent.hits())
print(serial.samples() == concurrent.samples())
print(concurrent.estimate())
print(concurrent.summary())

Make it your experiment.

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

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

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

Use the current native Aner development engine with aner.parallel and VS Code extension 0.1.32. The local program needs no remote configuration. Automatic concurrency honors the discovered CPU allocation; Native Dense training uses its separate replica execution contract.

Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner