Skip to main content

Crate archx

Crate archx 

Source
Expand description

§ArchX Sovereign v3.0 — Fluent Performance Runtime

ArchX is a high-performance, adaptive runtime library designed for systems programming in Rust. It empowers developers to build applications that automatically leverage the best available hardware resources—be it CPU (with SIMD), GPU, or a hybrid combination—while maintaining strict safety and stability.

§Core Features

  • Adaptive Dispatch: Intelligently switches between CPU and GPU based on workload size and hardware capability.
  • Sovereign Fluent API: A unified, chainable interface for configuring and executing computations.
  • Safe Math Engine: Built-in protection against overflows and arithmetic errors with multiple precision modes.
  • Built-in Profiling: Real-time metric collection and reporting (JSON/CSV) for performance tuning.
  • Hardware Intelligence: Advanced detection of SIMD levels (AVX2, AVX-512) and GPU vendor capabilities.

§Quick Start

Add ArchX to your Cargo.toml:

[dependencies]
archx = "3.0"

§Simple Adaptive Task

use archx::ArchX;

let result = ArchX::run(|| {
    // Complex computation here
    (0..1000).sum::<u64>()
});
println!("Result: {}", result);

§Using the Fluent API (v3.0)

use archx::{archx, Policy, GpuPolicy};

let a = vec![1.0; 1000];
let b = vec![2.0; 1000];
let mut out = vec![0.0; 1000];

archx()
    .with_policy(Policy::Balanced)
    .with_gpu(GpuPolicy::Adaptive)
    .profile(true)
    .add(&a, &b, &mut out).unwrap();

§Execution Modes

  1. CPU Only: Direct execution on host threads, utilizing SIMD where available.
  2. GPU Only: Force offloading to supported GPU backends.
  3. Hybrid: Workload-aware splitting between CPU and GPU for maximum throughput.
  4. Async: Background execution for non-blocking operations.

§Safety and Precision

ArchX provides three mathematical modes via MathMode:

  • Safe: Full overflow checking, returns errors on arithmetic failure.
  • Fast: Unchecked, wrapping arithmetic for maximum performance.
  • Balanced: Saturating arithmetic, providing stable results without errors.

Re-exports§

pub use public_api::ArchX;
pub use public_api::archx::engine;
pub use public_api::archx::archx;
pub use public_api::archx::ArchXBuilder;
pub use public_api::sovereign::SovereignBuilder;
pub use error::ArchXError;
pub use error::ArchXResult;
pub use decision::Policy;
pub use gpu::GpuPolicy;
pub use hardware::SystemInfo;
pub use hardware::CpuInfo;
pub use hardware::GpuInfo;
pub use hardware::GpuApi;
pub use system::add;
pub use system::add_advanced;
pub use system::get_info;
pub use system::get_system_info;
pub use system::WorkloadHints;
pub use adaptive::AdaptiveEngine;
pub use async_ops::add_async;
pub use math::SafeMath;
pub use math::ArithmeticResult;
pub use math::MathMode;
pub use math::AdaptiveMath;
pub use profiler::JsonExporter;
pub use profiler::CsvExporter;
pub use profiler::ReportExporter;
pub use profiler::get_profiler;
pub use runtime::ArchXSched;
pub use optimizer::scheduler::PowerMode;

Modules§

adaptive
async_ops
core
cpu
decision
detect
dispatch
error
gpu
hardware
math
optimizer
profiler
public_api
runtime
system