| Crates.io | veda-rs |
| lib.rs | veda-rs |
| version | 1.0.0 |
| created_at | 2025-10-26 10:13:26.495723+00 |
| updated_at | 2025-10-26 10:13:26.495723+00 |
| description | High-performance parallel runtime for Rust with work-stealing and adaptive scheduling |
| homepage | |
| repository | https://github.com/TIVerse/veda-rs |
| max_upload_size | |
| id | 1901173 |
| size | 512,472 |
A high-performance parallel runtime for Rust with work-stealing and adaptive scheduling. Features excellent API compatibility with standard parallel libraries while providing enhanced capabilities for variable workloads, GPU compute, and async integration.
Status: 100% Complete ✨
flat_map(), zip(), partition(), position_any()par_chunks(), par_windows() for batch operationsany(), all(), find_any() with early-exit optimizationAdd VEDA to your Cargo.toml:
[dependencies]
veda-rs = "1.0"
[dependencies]
veda-rs = { version = "1.0", features = ["telemetry", "async", "gpu"] }
Available features:
adaptive - Adaptive scheduling (enabled by default)telemetry - Metrics and observability (enabled by default)deterministic - Deterministic execution modeasync - Async/await integrationgpu - GPU compute supportnuma - NUMA-aware allocationenergy-aware - Energy-efficient schedulingcustom-allocators - Custom memory allocatorsuse veda_rs::prelude::*;
fn main() {
// Lazy initialization - no init() needed!
let sum: i32 = (0..1000)
.into_par_iter()
.map(|x| x * 2)
.sum();
println!("Sum: {}", sum);
// Runtime automatically managed
}
Note: Explicit init() and shutdown() are optional with lazy initialization enabled by default.
use veda_rs::prelude::*;
fn main() {
veda_rs::init().unwrap();
// Vec parallel processing
let vec = vec![1, 2, 3, 4, 5];
let doubled: Vec<i32> = vec.into_par_iter()
.map(|x| x * 2)
.collect();
// Slice parallel processing
let array = [1, 2, 3, 4, 5];
let sum: i32 = array.par_iter().sum();
veda_rs::shutdown();
}
use veda_rs::prelude::*;
fn main() {
veda_rs::init().unwrap();
// Check if any element matches
let has_large = (0..1000).into_par_iter().any(|x| *x > 500);
// Check if all elements match
let all_positive = vec![1, 2, 3].into_par_iter().all(|x| *x > 0);
// Find any matching element
let found = (0..1000).into_par_iter().find_any(|x| *x == 42);
veda_rs::shutdown();
}
use veda_rs::{Config, SchedulingPolicy};
fn main() {
let config = Config::builder()
.num_threads(4)
.scheduling_policy(SchedulingPolicy::Adaptive)
.build()
.unwrap();
veda_rs::init_with_config(config).unwrap();
veda_rs::shutdown();
}
use veda_rs::scope;
fn main() {
veda_rs::init().unwrap();
let data = vec![1, 2, 3, 4, 5];
scope::scope(|s| {
for item in &data {
let item = *item;
s.spawn(move || {
println!("Processing: {}", item * 2);
});
}
});
veda_rs::shutdown();
}
See the examples/ directory for more comprehensive examples:
basic_par_iter.rs - Basic parallel iterator usageadaptive_workload.rs - Adaptive scheduling with variable workloadsscoped_parallelism.rs - Safe scoped task spawningcustom_priorities.rs - Task prioritizationdeterministic_debug.rs - Reproducible executioncomprehensive_demo.rs - All features demonstrationgpu_compute.rs - GPU kernel execution (requires --features gpu)async_parallel.rs - Async/await integration (requires --features async)Run an example:
cargo run --example basic_par_iter
use veda_rs::prelude::*;
fn main() {
veda_rs::init().unwrap();
let result = (0..1000).into_par_iter()
.filter(|x| *x % 2 == 0)
.map(|x| x * x)
.take(10)
.any(|x| *x > 100);
println!("Result: {}", result);
veda_rs::shutdown();
}
use veda_rs::prelude::*;
fn main() {
veda_rs::init().unwrap();
// Parallel fold with reduce
let product: i64 = (1i32..=10)
.into_par_iter()
.map(|x| x as i64)
.fold(|| 1i64, |acc, x| acc * x)
.reduce(|a, b| a * b);
println!("Product: {}", product);
veda_rs::shutdown();
}
use veda_rs::{Config, SchedulingPolicy};
fn main() {
let config = Config::builder()
.scheduling_policy(SchedulingPolicy::Deterministic { seed: 42 })
.num_threads(4)
.build()
.unwrap();
veda_rs::init_with_config(config).unwrap();
// Results will be reproducible across runs
let result: i32 = (0..1000).into_par_iter()
.map(|x| x * x)
.sum();
veda_rs::shutdown();
}
use veda_rs::telemetry::export::{ConsoleExporter, MetricsExporter};
fn main() {
veda_rs::init().unwrap();
// Run some parallel work
let _: i32 = (0..10000).into_par_iter().sum();
// Export metrics
let metrics = veda_rs::telemetry::metrics::Metrics::default();
let snapshot = metrics.snapshot();
let exporter = ConsoleExporter::new(true);
let _ = exporter.export(&snapshot);
veda_rs::shutdown();
}
VEDA is built with a modular architecture:
┌─────────────────────────────────────────────────────────────┐
│ VEDA Runtime │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌──────────────────┐ │
│ │ User Interface │───────▶│ Telemetry │ │
│ │ - par_iter() │ │ Subsystem │ │
│ │ - spawn() │ │ - Metrics │ │
│ │ - scope() │ │ - Tracing │ │
│ └────────┬────────┘ └────────┬─────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────────────────────────────────┐ │
│ │ Adaptive Scheduler │ │
│ │ - Load Balancing │ │
│ │ - Task Prioritization │ │
│ │ - Energy Awareness │ │
│ └────────┬─────────────────────────────────┘ │
│ │ │
│ ┌─────┴──────┬──────────────┬──────────────┐ │
│ ▼ ▼ ▼ ▼ │
│ ┌──────┐ ┌──────┐ ┌─────────┐ ┌─────────┐ │
│ │ CPU │ │ CPU │ │ GPU │ │ Async │ │
│ │ Pool │ │ Pool │ ... │ Runtime │ │ Bridge │ │
│ └──────┘ └──────┘ └─────────┘ └─────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Benchmarks show competitive performance on uniform workloads, with significant improvements on variable workloads:
| Workload Type | VEDA Performance | Notes |
|---|---|---|
| CPU-bound, uniform | Baseline | Industry-standard performance |
| CPU-bound, variable | 1.2-1.8x faster | Adaptive scheduling wins |
| Small tasks (<1ms) | ~0.95x | Slight overhead from telemetry |
| Large tasks (>100ms) | 1.1-1.5x faster | Superior load balancing |
Run benchmarks:
cargo bench
VEDA includes comprehensive test coverage with 68 passing tests:
# Run all tests (requires serial execution due to global runtime)
cargo test -- --test-threads=1
# Run integration tests
cargo test --test integration_test -- --test-threads=1
# Run stress tests (long-running)
cargo test --test stress_test -- --test-threads=1 --ignored
# Run benchmarks
cargo bench
VEDA is designed as a drop-in replacement for standard parallel libraries:
Before (Other Library):
use other_lib::prelude::*;
fn main() {
let sum: i32 = (0..1000).into_par_iter().sum();
}
After (VEDA):
use veda_rs::prelude::*;
fn main() {
veda_rs::init().unwrap();
let sum: i32 = (0..1000).into_par_iter().sum();
veda_rs::shutdown();
}
Key Differences:
init() and shutdown() calls for runtime management (optional with lazy initialization)veda_rs:: namespaceany(), all(), find_any(), enumerate(), take(), skip()flat_map(), zip(), partition(), position_any()par_chunks(), par_windows()Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas where we'd love help:
VEDA is dual-licensed under either:
at your option.
VEDA builds upon the foundational work of the Rust community and these excellent projects:
Project Maintainers:
Eshan Roy (@eshanized)
ved0010 (@ved0010)
Contributors: See CONTRIBUTORS.md for a full list of contributors.
All planned features have been implemented and tested:
Quality Metrics:
Optional Enhancements (Low Priority):