← Run 2026-09-05T193245

Implementation / rust-simd

Rust (SIMD)1.92.0

An inspectable measurement, with the exact build and environment evidence retained from this run.

systemscompiler-defaultExplicit SIMD
Median wall time141.31 ms
Fastest sample140.73 ms
Slowest sample144.57 ms
Samples retained3

01 / Measurements

Every sample matters.

Individual wall times in seconds. Three samples show observed spread; they do not establish a statistically reliable winner between close results.

Sample 10.141306677 s
Sample 20.144565860 s
Sample 30.140725296 s

02 / Build & protocol

How this was run.

Commands and settings are evidence from the measured revision. They can differ from today’s implementation.

Browse measured source ↗

Compile

rustc -C opt-level=3 -C target-cpu=native -C lto=fat -C codegen-units=1 -C panic=abort -o leibniz leibniz_simd.rs

Execute

./leibniz

Historical protocol recovered from the measured driver. These fields were not embedded in the original result. The raw JSON remains unchanged.

03 / The implementation

Read what ran.

The implementation and supporting files at the measured revision. Highlighting is added for readability; the source text is unchanged.

Recovered from the measured Git revision; not embedded in the original raw results

Browse this revision ↗
src/leibniz_simd.rs86 lines
use std::arch::x86_64::*;
use std::fs::File;
use std::io::prelude::*;

fn main() {
    let mut file = File::open("./rounds.txt").expect("file not found");
    let mut contents = String::new();
    file.read_to_string(&mut contents)
        .expect("something went wrong reading the file");

    let rounds = contents.trim().parse::<u32>().unwrap() + 2;

    assert!(is_x86_feature_detected!("avx512f"), "Rust SIMD requires AVX-512F");
    unsafe { run_benchmark(rounds) }
}

#[target_feature(enable = "avx512f")]
unsafe fn run_benchmark(rounds: u32) {
    let unroll: u32 = 8; // 512-bit = 8x f64

    // Sign alternation vector: [-1, 1, -1, 1, -1, 1, -1, 1]
    // Note: _mm512_set_pd takes arguments in reverse order (high to low)
    let x = _mm512_set_pd(1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0);

    // Constants
    let inc = _mm512_set1_pd(32.0); // Increment by 32 (4 vectors * 8)
    let two = _mm512_set1_pd(2.0);
    let mone = _mm512_set1_pd(-1.0);

    // Initial index vectors for 4 independent accumulators (reverse order for _mm512_set_pd)
    let mut ivec0 = _mm512_set_pd(9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0);
    let mut ivec1 = _mm512_set_pd(17.0, 16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0);
    let mut ivec2 = _mm512_set_pd(25.0, 24.0, 23.0, 22.0, 21.0, 20.0, 19.0, 18.0);
    let mut ivec3 = _mm512_set_pd(33.0, 32.0, 31.0, 30.0, 29.0, 28.0, 27.0, 26.0);

    // Use 4 accumulator vectors for instruction-level parallelism
    let mut pivec0 = _mm512_setzero_pd();
    let mut pivec1 = _mm512_setzero_pd();
    let mut pivec2 = _mm512_setzero_pd();
    let mut pivec3 = _mm512_setzero_pd();

    let vec_end = rounds - (rounds - 2) % (unroll * 4);
    let mut i = 2u32;

    // Main loop: process 32 terms per iteration (4 x 8-wide vectors)
    while i < vec_end {
        // Compute denominators: 2*i - 1 (using FMA: fmadd(two, ivec, mone) would be 2*i + (-1))
        let den0 = _mm512_fmadd_pd(two, ivec0, mone);
        let den1 = _mm512_fmadd_pd(two, ivec1, mone);
        let den2 = _mm512_fmadd_pd(two, ivec2, mone);
        let den3 = _mm512_fmadd_pd(two, ivec3, mone);

        // Accumulate: pivec += x / den
        pivec0 = _mm512_add_pd(pivec0, _mm512_div_pd(x, den0));
        pivec1 = _mm512_add_pd(pivec1, _mm512_div_pd(x, den1));
        pivec2 = _mm512_add_pd(pivec2, _mm512_div_pd(x, den2));
        pivec3 = _mm512_add_pd(pivec3, _mm512_div_pd(x, den3));

        // Increment index vectors
        ivec0 = _mm512_add_pd(ivec0, inc);
        ivec1 = _mm512_add_pd(ivec1, inc);
        ivec2 = _mm512_add_pd(ivec2, inc);
        ivec3 = _mm512_add_pd(ivec3, inc);

        i += unroll * 4;
    }

    // Combine all accumulator vectors
    let pivec_sum = _mm512_add_pd(
        _mm512_add_pd(pivec0, pivec1),
        _mm512_add_pd(pivec2, pivec3)
    );

    // Horizontal sum of the vector
    let mut pi = 1.0 + _mm512_reduce_add_pd(pivec_sum);

    // Scalar cleanup loop for remaining terms
    while i < rounds {
        let xf = -1.0f64 + (2.0 * (i & 0x1) as f64);
        pi += xf / (2 * i - 1) as f64;
        i += 1;
    }

    println!("{:.16}", pi * 4.0);
}

SHA-256 · 8a35d0b0fc07b596df6ccf5fd8f1a1a006ef01f669a272e992d32e703e4a7f9e

04 / Package provenance

Beyond a version number.

Resolved Nix revisions and store paths identify the packages in the recorded Devbox lock. Other platforms listed by the resolver are alternatives, not machines used in this run.

github:NixOS/nixpkgs/nixpkgs-unstableflake reference
Complete package record
{
  "last_modified": "2026-09-03T10:26:31Z",
  "resolved": "github:NixOS/nixpkgs/9b9402b959a2276982ddd5ad3652a38b97f7c40b?lastModified=1788431191&narHash=sha256-MFClkboDeW56feBCAeAV3Z3J2quGSZFlAOXQ4JjIlIA%3D"
}
hyperfine@1.18.01.18.0

aarch64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/9xndv63zi1n8i42l4fy4kdjw8rs8gnhf-hyperfine-1.18.0",
      "default": true
    }
  ],
  "store_path": "/nix/store/9xndv63zi1n8i42l4fy4kdjw8rs8gnhf-hyperfine-1.18.0"
}

aarch64-linux

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/klirs2wv0wm9p7rkp6v70v5770x73bgf-hyperfine-1.18.0",
      "default": true
    }
  ],
  "store_path": "/nix/store/klirs2wv0wm9p7rkp6v70v5770x73bgf-hyperfine-1.18.0"
}

x86_64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/zvpjdyck0vj7w4piicfxbskv8fw7ik4i-hyperfine-1.18.0",
      "default": true
    }
  ],
  "store_path": "/nix/store/zvpjdyck0vj7w4piicfxbskv8fw7ik4i-hyperfine-1.18.0"
}

x86_64-linux Matching architecture / OS

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/7hj45kx7ln0ncn0i984zbh0gmbliya5j-hyperfine-1.18.0",
      "default": true
    }
  ],
  "store_path": "/nix/store/7hj45kx7ln0ncn0i984zbh0gmbliya5j-hyperfine-1.18.0"
}
Complete package record
{
  "last_modified": "2024-11-03T14:18:04Z",
  "resolved": "github:NixOS/nixpkgs/4ae2e647537bcdbb82265469442713d066675275#hyperfine",
  "source": "devbox-search",
  "version": "1.18.0",
  "systems": {
    "aarch64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/9xndv63zi1n8i42l4fy4kdjw8rs8gnhf-hyperfine-1.18.0",
          "default": true
        }
      ],
      "store_path": "/nix/store/9xndv63zi1n8i42l4fy4kdjw8rs8gnhf-hyperfine-1.18.0"
    },
    "aarch64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/klirs2wv0wm9p7rkp6v70v5770x73bgf-hyperfine-1.18.0",
          "default": true
        }
      ],
      "store_path": "/nix/store/klirs2wv0wm9p7rkp6v70v5770x73bgf-hyperfine-1.18.0"
    },
    "x86_64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/zvpjdyck0vj7w4piicfxbskv8fw7ik4i-hyperfine-1.18.0",
          "default": true
        }
      ],
      "store_path": "/nix/store/zvpjdyck0vj7w4piicfxbskv8fw7ik4i-hyperfine-1.18.0"
    },
    "x86_64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/7hj45kx7ln0ncn0i984zbh0gmbliya5j-hyperfine-1.18.0",
          "default": true
        }
      ],
      "store_path": "/nix/store/7hj45kx7ln0ncn0i984zbh0gmbliya5j-hyperfine-1.18.0"
    }
  }
}
micropython@1.24.11.24.1

aarch64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/g4dz2lvzzhggnxkavi1jiiiy1dpa8c4p-micropython-1.24.1",
      "default": true
    }
  ],
  "store_path": "/nix/store/g4dz2lvzzhggnxkavi1jiiiy1dpa8c4p-micropython-1.24.1"
}

aarch64-linux

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/3yggs5nl5pavnxh8k4adiq09s1f0ppry-micropython-1.24.1",
      "default": true
    }
  ],
  "store_path": "/nix/store/3yggs5nl5pavnxh8k4adiq09s1f0ppry-micropython-1.24.1"
}

x86_64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/gav96yf4pxhj59idrs67z59cw3zfimfd-micropython-1.24.1",
      "default": true
    }
  ],
  "store_path": "/nix/store/gav96yf4pxhj59idrs67z59cw3zfimfd-micropython-1.24.1"
}

x86_64-linux Matching architecture / OS

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/vhfgy8vnd904mlzw35z61rh177cvcb40-micropython-1.24.1",
      "default": true
    }
  ],
  "store_path": "/nix/store/vhfgy8vnd904mlzw35z61rh177cvcb40-micropython-1.24.1"
}
Complete package record
{
  "last_modified": "2025-04-10T20:20:34Z",
  "resolved": "github:NixOS/nixpkgs/d19cf9dfc633816a437204555afeb9e722386b76#micropython",
  "source": "devbox-search",
  "version": "1.24.1",
  "systems": {
    "aarch64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/g4dz2lvzzhggnxkavi1jiiiy1dpa8c4p-micropython-1.24.1",
          "default": true
        }
      ],
      "store_path": "/nix/store/g4dz2lvzzhggnxkavi1jiiiy1dpa8c4p-micropython-1.24.1"
    },
    "aarch64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/3yggs5nl5pavnxh8k4adiq09s1f0ppry-micropython-1.24.1",
          "default": true
        }
      ],
      "store_path": "/nix/store/3yggs5nl5pavnxh8k4adiq09s1f0ppry-micropython-1.24.1"
    },
    "x86_64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/gav96yf4pxhj59idrs67z59cw3zfimfd-micropython-1.24.1",
          "default": true
        }
      ],
      "store_path": "/nix/store/gav96yf4pxhj59idrs67z59cw3zfimfd-micropython-1.24.1"
    },
    "x86_64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/vhfgy8vnd904mlzw35z61rh177cvcb40-micropython-1.24.1",
          "default": true
        }
      ],
      "store_path": "/nix/store/vhfgy8vnd904mlzw35z61rh177cvcb40-micropython-1.24.1"
    }
  }
}
rustc@1.92.01.92.0

aarch64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/ymskl36napcfgl6wjz1xdjn0jd25inrv-rustc-wrapper-1.92.0",
      "default": true
    },
    {
      "name": "man",
      "path": "/nix/store/ch54xfkz0dlqvhbinzlbkva2898nvihl-rustc-wrapper-1.92.0-man",
      "default": true
    },
    {
      "name": "doc",
      "path": "/nix/store/09yhz82jqxwbmn4dbjy7p9hrvbr4g0mn-rustc-wrapper-1.92.0-doc"
    }
  ],
  "store_path": "/nix/store/ymskl36napcfgl6wjz1xdjn0jd25inrv-rustc-wrapper-1.92.0"
}

aarch64-linux

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/qnvqgfiqh8s08cqp452665l2b60a811h-rustc-wrapper-1.92.0",
      "default": true
    },
    {
      "name": "man",
      "path": "/nix/store/5ggpm5m3wkxj05si2id4b6sq4alf90qg-rustc-wrapper-1.92.0-man",
      "default": true
    },
    {
      "name": "doc",
      "path": "/nix/store/camfpqmi94ssc1p8vkygp2s621ykq80m-rustc-wrapper-1.92.0-doc"
    }
  ],
  "store_path": "/nix/store/qnvqgfiqh8s08cqp452665l2b60a811h-rustc-wrapper-1.92.0"
}

x86_64-darwin

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/zkcwgmgli06nsh0v8yv82gnh5whgcdyl-rustc-wrapper-1.92.0",
      "default": true
    },
    {
      "name": "man",
      "path": "/nix/store/2k3fdy9xjwkx06rlfwfn449w442vgk0i-rustc-wrapper-1.92.0-man",
      "default": true
    },
    {
      "name": "doc",
      "path": "/nix/store/7271gqq93bbxrqb9rw3hf5b5x6wdm2cn-rustc-wrapper-1.92.0-doc"
    }
  ],
  "store_path": "/nix/store/zkcwgmgli06nsh0v8yv82gnh5whgcdyl-rustc-wrapper-1.92.0"
}

x86_64-linux Matching architecture / OS

{
  "outputs": [
    {
      "name": "out",
      "path": "/nix/store/qvpg842zrjkywv7sqgw2h05spdyzcj86-rustc-wrapper-1.92.0",
      "default": true
    },
    {
      "name": "man",
      "path": "/nix/store/n1d4093lcx7ljgks1j352fbrf5w551v9-rustc-wrapper-1.92.0-man",
      "default": true
    },
    {
      "name": "doc",
      "path": "/nix/store/425gvb2xnhkwb1izjr97wpwdwndwi516-rustc-wrapper-1.92.0-doc"
    }
  ],
  "store_path": "/nix/store/qvpg842zrjkywv7sqgw2h05spdyzcj86-rustc-wrapper-1.92.0"
}
Complete package record
{
  "last_modified": "2026-01-23T17:20:52Z",
  "plugin_version": "0.0.1",
  "resolved": "github:NixOS/nixpkgs/a1bab9e494f5f4939442a57a58d0449a109593fe#rustc",
  "source": "devbox-search",
  "version": "1.92.0",
  "systems": {
    "aarch64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/ymskl36napcfgl6wjz1xdjn0jd25inrv-rustc-wrapper-1.92.0",
          "default": true
        },
        {
          "name": "man",
          "path": "/nix/store/ch54xfkz0dlqvhbinzlbkva2898nvihl-rustc-wrapper-1.92.0-man",
          "default": true
        },
        {
          "name": "doc",
          "path": "/nix/store/09yhz82jqxwbmn4dbjy7p9hrvbr4g0mn-rustc-wrapper-1.92.0-doc"
        }
      ],
      "store_path": "/nix/store/ymskl36napcfgl6wjz1xdjn0jd25inrv-rustc-wrapper-1.92.0"
    },
    "aarch64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/qnvqgfiqh8s08cqp452665l2b60a811h-rustc-wrapper-1.92.0",
          "default": true
        },
        {
          "name": "man",
          "path": "/nix/store/5ggpm5m3wkxj05si2id4b6sq4alf90qg-rustc-wrapper-1.92.0-man",
          "default": true
        },
        {
          "name": "doc",
          "path": "/nix/store/camfpqmi94ssc1p8vkygp2s621ykq80m-rustc-wrapper-1.92.0-doc"
        }
      ],
      "store_path": "/nix/store/qnvqgfiqh8s08cqp452665l2b60a811h-rustc-wrapper-1.92.0"
    },
    "x86_64-darwin": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/zkcwgmgli06nsh0v8yv82gnh5whgcdyl-rustc-wrapper-1.92.0",
          "default": true
        },
        {
          "name": "man",
          "path": "/nix/store/2k3fdy9xjwkx06rlfwfn449w442vgk0i-rustc-wrapper-1.92.0-man",
          "default": true
        },
        {
          "name": "doc",
          "path": "/nix/store/7271gqq93bbxrqb9rw3hf5b5x6wdm2cn-rustc-wrapper-1.92.0-doc"
        }
      ],
      "store_path": "/nix/store/zkcwgmgli06nsh0v8yv82gnh5whgcdyl-rustc-wrapper-1.92.0"
    },
    "x86_64-linux": {
      "outputs": [
        {
          "name": "out",
          "path": "/nix/store/qvpg842zrjkywv7sqgw2h05spdyzcj86-rustc-wrapper-1.92.0",
          "default": true
        },
        {
          "name": "man",
          "path": "/nix/store/n1d4093lcx7ljgks1j352fbrf5w551v9-rustc-wrapper-1.92.0-man",
          "default": true
        },
        {
          "name": "doc",
          "path": "/nix/store/425gvb2xnhkwb1izjr97wpwdwndwi516-rustc-wrapper-1.92.0-doc"
        }
      ],
      "store_path": "/nix/store/qvpg842zrjkywv7sqgw2h05spdyzcj86-rustc-wrapper-1.92.0"
    }
  }
}
Complete Devbox configuration
{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.16.0/.schema/devbox.schema.json",
  "packages": [
    "rustc@1.92.0",
    "hyperfine@1.18.0",
    "micropython@1.24.1"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

05 / Environment & limits

The machine behind
the measurement.

Container-visible resources are not necessarily dedicated resources. Hypervisor CPU flags indicate virtualization; CPU counts do not prove exclusive CPU allocation.

All recorded environment fields
{
  "arch": "x86_64",
  "kernel": "6.18.38-talos",
  "cpu_model": "AMD EPYC-Genoa Processor",
  "cpu_flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl xtopology cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core pti ssbd ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 clzero xsaveerptr wbnoinvd arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid fsrm",
  "cpu_threads": "4",
  "runner": "homelab-argo"
}

“Not recorded” means unknown, not unlimited. Historical data cannot establish CPU isolation, host contention, thermal state or frequency stability.

Declared scheduler settings

Retained Argo stored workflow template; declared settings, not an observation of effective cgroup limits. A CPU request does not reserve exclusive hardware.

06 / Evidence

Take the data with you.

Original bytes are preserved. The checksum below identifies this exact raw JSON file.

Download raw JSON ↓
All other recorded result fields
                    {
  "Mean": "0.1421992774666667s",
  "Max": "0.1445658598s",
  "Target": "rust-simd",
  "Stddev": "0.00207003258962856s",
  "Version": "1.92.0",
  "Language": "Rust (SIMD)",
  "UserTime": "0.13976782s",
  "SystemTime": "0.00226288s",
  "Median": "0.1413066768s",
  "Command": "./leibniz",
  "TimesPerRun": [
    0.1413066768,
    0.1445658598,
    0.1407252958
  ],
  "Accuracy": 9.496651887881681,
  "Min": "0.1407252958s",
  "ExitCodesPerRun": [
    0,
    0,
    0
  ],
  "CalculatedPi": "3.1415926545909407",
  "BuildSource": "native-devbox",
  "DevboxImage": "jetpackio/devbox:0.16.0@sha256:0475601f3ddbc1d06be7f7d4d51143dcc005400593407d5e3627fdf7edf6c7dd",
  "AllowNativeFlags": true,
  "MathMode": "compiler-default",
  "ExplicitSIMD": true,
  "Algorithm": "leibniz-series",
  "Rounds": 1000000000,
  "Compile": "rustc -C opt-level=3 -C target-cpu=native -C lto=fat -C codegen-units=1 -C panic=abort -o leibniz leibniz_simd.rs",
  "Run": "./leibniz",
  "Nixpkgs": [
    "rustc@1.92.0"
  ],
  "NixFlakes": [],
  "Category": "systems"
}