All examples
Scientific computing

Exact Decimal tasks across machines

Compare local and explicitly enrolled remote workers using Decimal scalars, frozen input arrays and typed outputs.

native_decimal_remote.aner
import aner.parallel

fn decimal_task(parameters: List, iteration: Int64, seed: Int64,
                output: OutputRegion<Decimal>) -> Unit {
    let scalar = cast<Decimal>(parameters.get(0))
    let values = cast<FrozenArray<Decimal>>(parameters.get(1))
    output[0] = scalar
    let index = iteration % values.len()
    output[1] = values[integer_div(index, 2), index % 2]
    output[2] = D("0.1000") + D("0.2000")
    output[3] = cast<Decimal>(parameters.get(2))
}

let values = NDArray<Decimal>(shape: List(2, 2), fill: D(0))
values[0, 0] = D("1234567890123456789012345678901234")
values[0, 1] = D("0.1000")
values[1, 0] = D("-0.00")
values[1, 1] = D("1e-6176")
let parameters = List(D("1e6144"), values.snapshot(), D("-0.0000"))
let baseline = parallel.repeat(12, decimal_task, parameters,
    output_shape: List(4), execution: parallel.local(1), seed: 42)
let remote = parallel.repeat(12, decimal_task, parameters,
    output_shape: List(4), execution: parallel.cluster("native-decimal-remote.conf"), seed: 42)
var exact = true
for iteration in Range(12) {
    for column in Range(4) {
        if String(remote[iteration, column]) != String(baseline[iteration, column]) {
            exact = false
        }
    }
    if remote.seed(iteration) != baseline.seed(iteration) { exact = false }
}
print(exact)
print(String(remote[0, 1]))
print(String(remote[1, 1]))
print(String(remote[2, 1]))
print(String(remote[3, 1]))
print(String(remote[0, 2]))
print(String(remote[0, 3]))
print(remote.summary())

Make it your experiment.

Use a compatible Aner runtime. Save this program as examples/parallel/native_decimal_remote.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

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

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

Use the matching native runtime and worker SDK with native subset v4 and ANERNATIVE/3. Configure native decimal remote.conf with explicitly enrolled remote workers and build the identical source for each target. The guide distinguishes process checks from complete cross machine result verification.

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