Restart accel project, GPGPU Framework for Rust: 0.3.0 Release

Restart accel project

After two years from accel-0.1.0 release, I have released accel-0.3.0. This project had been actually dead long time after 0.1.0 release, and 0.3.0 is a first release of restarted this project! (0.2.0 has been yanked)

In this two years, there are many enhancement in Rust environment

accel-0.3.0 has been started in order to migrate these features, and here it has done!

What is accel project?

accel is a crate for writing GPU kernel based on CUDA APIs. Here is a vector add example:

use accel::*;

unsafe fn add(a: *const f32, b: *const f32, c: *mut f32, n: usize) {
    let i = accel_core::index();
    if (i as usize) < n {
        *c.offset(i) = *a.offset(i) + *b.offset(i);

fn main() -> error::Result<()> {
    let device = Device::nth(0)?;
    let ctx = device.create_context();

    // Allocate memories on GPU
    let n = 32;
    let mut a = DeviceMemory::<f32>::zeros(ctx.clone(), n);
    let mut b = DeviceMemory::<f32>::zeros(ctx.clone(), n);
    let mut c = DeviceMemory::<f32>::zeros(ctx.clone(), n);

    // Accessible from CPU as usual Rust slice (though this will be slow)
    for i in 0..n {
        a[i] = i as f32;
        b[i] = 2.0 * i as f32;
    println!("a = {:?}", a.as_slice());
    println!("b = {:?}", b.as_slice());

    // Launch kernel synchronously
        1 /* grid */,
        n /* block */,
        &(&a.as_ptr(), &b.as_ptr(), &c.as_mut_ptr(), &n)
    ).expect("Kernel call failed");

    println!("c = {:?}", c.as_slice());

Current status and Roadmap

This project is still in early stage. There are several limitations as following:

0.3.0 release is focused on what this project can and cannot in order to reveal what we have to do for using it for actual scientific studies. The goal of accel-1.0 is to realized a CUDA/C++ all features on Rust system, but there are several realistic targets:

  • async/.await API for CUDA Stream/Event handling
  • Consistent integration to cuBLAS, cuRAND, and cuFFT
  • libstd for GPU kernel

I will keep working on these targets as I can. If you are interested in, please see GitLab issues.

Links for related projects


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.