Crates.io | spindle |
lib.rs | spindle |
version | 0.1.9 |
source | src |
created_at | 2023-07-16 18:07:06.954738 |
updated_at | 2023-08-17 22:27:17.489621 |
description | Ergonomic GPGPU data parallel in Rust. |
homepage | |
repository | https://github.com/ariasanovsky/spindle |
max_upload_size | |
id | 917871 |
size | 43,544 |
Spindle is a Rust crate simplifies GPGPU multithreaded execution of embarrassingly parallel and data parallel tasks.
#[spindle::map]
fn _i32_to_f64(x: i32) -> f64 {
x as f64
}
fn main() -> Result<(), spindle::error::Error> {
spindle::spin!(U, i32, f64);
let nums: Vec<i32> = (0..10).collect();
let spindle: spindle::DevSpindle<U, i32> = nums.try_into()?;
let spindle: spindle::DevSpindle<U, f64> = unsafe { spindle.i32_to_f64() }?;
let spindle: spindle::HostSpindle<U, f64> = spindle.try_to_host()?;
for (i, x) in spindle.iter().enumerate() {
assert_eq!(*x, i as f64);
}
Ok(())
}
Welcome, idea-haver!
Please skim the Collaborator Guidelines and say hello!
Thank you for your contributions!
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0 or the MIT license, at your option. This file may not be copied, modified, or distributed except according to those terms.
(collaborators, feel free to expand)
Our work is inspired by so many great crates! This includes, but is not limited to,
rayon
, our inspiration in reliable fearless concurrencydfdx
, for ergonomic machine learningfaer
, the uncompromisingly brilliant linear algebra backendcudarc
, the smart-pointered, typesafe wrapper for CUDA
1_000_000_000_000_000
iterations in a single day