#parallel #gpgpu #computing #back-end #data #parallel-processing #spindle

macro spindle_macros

A macro backend for spindle: ergonomic GPGPU data parallel computing in Rust

9 releases

0.1.11 Aug 17, 2023
0.1.10 Aug 16, 2023
0.1.5 Jul 22, 2023

#1081 in Procedural macros

Download history 2/week @ 2024-02-16 7/week @ 2024-02-23 2/week @ 2024-03-01 3/week @ 2024-03-08 2/week @ 2024-03-15 105/week @ 2024-03-22 6/week @ 2024-03-29

111 downloads per month
Used in spindle

Apache-2.0 OR MIT

180KB
4K SLoC

Spindle

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(())
}

Contributing

Welcome, idea-haver!

  • Do you have a feature or syntax suggestion?
  • Want to share ideas about bit fiddly implmentations?
  • Did you know how to squash a bug?

Please skim the Collaborator Guidelines and say hello!

Thank you for your contributions!

License

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.

Acknowledgments

(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 concurrency
  • dfdx, for ergonomic machine learning
  • faer, the uncompromisingly brilliant linear algebra backend
  • cudarc, the smart-pointered, typesafe wrapper for CUDA

Alex is personally grateful for

  • the 2023 Scientific Computing in Rust conference
  • the joy I felt when my first GPGPU project hit ~ 1_000_000_000_000_000 iterations in a single day
  • the Rust community's committment to:
    • welcoming everyone,
    • tackling developer ergonomics,
    • teaching us correctness and safety, and
    • giving us tools to push the language further.

Dependencies

~24–33MB
~515K SLoC