Skip to main content

ringkernel_cpu/
lib.rs

1//! CPU Backend for RingKernel
2//!
3//! This crate provides a CPU-based implementation of the RingKernel runtime,
4//! primarily used for testing and as a fallback when no GPU is available.
5//!
6//! # Features
7//!
8//! - Full implementation of the RingKernelRuntime trait
9//! - Simulates GPU execution using async tasks
10//! - Supports all kernel lifecycle operations
11//! - Useful for unit testing and development
12//!
13//! # Example
14//!
15//! ```ignore
16//! use ringkernel_cpu::CpuRuntime;
17//! use ringkernel_core::runtime::{RuntimeBuilder, Backend};
18//!
19//! #[tokio::main]
20//! async fn main() {
21//!     let runtime = CpuRuntime::new().await.unwrap();
22//!     let kernel = runtime.launch("my_kernel", Default::default()).await.unwrap();
23//!     kernel.activate().await.unwrap();
24//! }
25//! ```
26
27#![warn(missing_docs)]
28#![warn(clippy::unwrap_used)]
29
30mod kernel;
31mod memory;
32pub mod mock;
33mod runtime;
34pub mod simd;
35
36pub use kernel::CpuKernel;
37pub use memory::CpuBuffer;
38pub use mock::{MockAtomics, MockGpu, MockKernelConfig, MockSharedMemory, MockThread, MockWarp};
39pub use runtime::CpuRuntime;
40pub use simd::SimdOps;
41
42/// Prelude for convenient imports.
43pub mod prelude {
44    pub use crate::mock::{
45        MockAtomics, MockGpu, MockKernelConfig, MockSharedMemory, MockThread, MockWarp,
46    };
47    pub use crate::simd::SimdOps;
48    pub use crate::CpuKernel;
49    pub use crate::CpuRuntime;
50}