Jump to content

geev03

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by geev03

  1. 🦀 Rust PiCalculator on Orange Pi RV2 (riscv64, Armbian Trixie)

    Compiled and ran a high-precision Pi calculator in Rust on my Orange Pi RV2 (K1X, 8-core @ 1.6 GHz) running Armbian-unofficial Trixie riscv64. The goal: test rustc performance and validate big-integer workloads on RISC-V.

    Environment

    OS: Armbian-unofficial 26.02.0-trunk (Debian Trixie)

    Kernel: Linux 6.18.5-edge-spacemit

    Rust: rustc 1.85.0, cargo 1.85.0 (built from source)

    Display: EZCAP28X @ 1920×1080

    Memory: 3.7 GiB RAM, 1.3 GiB used

    Disk: ext4, 28.96 GiB total

    GPU: Mesa llvmpipe (LLVM 19.1.7)

    🧮 Project: PiCalculator

    Rust implementation using rug (GMP-backed) to compute 1000 digits of π:

    rust

    use rug::{float::Constant, Float}; fn main() { let digits: usize = 1000; let bits: u32 = ((digits as f64) * 3.321928).ceil() as u32 + 10; let pi = Float::with_val(bits, Constant::Pi); let s = pi.to_string_radix(10, Some(digits)); println!("{s}"); }

    🧩 Build Notes

    Needed libgmp-dev and m4 to compile rug cleanly.

    cargo build --release succeeded without patching.

    Output verified against known π digits.

    ⚖️ Performance Comparison

    Board CPU Time (ms) Real Time (ms) Pi 400 Faster (1.8 GHz, fewer cores) Lower latency RV2 (K1X) Slower per-core, but stable Good throughput

    Despite having 8 cores, the RV2’s in-order K1X is slower than the Pi 400’s Cortex-A72 for single-threaded math. Still, the build was smooth and the output correct — a great stress test for rustc on riscv64.

     

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines