Giter Site home page Giter Site logo

emu's Introduction

Gitter

Emu is a framework/compiler for GPU acceleration of Rust, GPU programming. It is a procedural macro that accept pure, safe Rust code as input, identifies portions to attempt to accelerate, and automatically writes in code to run portions on the GPU instead of the CPU.

features

  • ease of use
    • download a library, not a whole new compiler
    • work with cargo test, cargo doc, crates.io
    • work with rustfmt, racer, rls
    • switch between CPU and GPU with 1 line
  • safety guarantees
    • no null pointer errors
    • no type mismatch errors
    • no syntax errors
  • more fun
    • up to 80% less code
    • up to 300x speedup
    • as fast as single-GPU, single-threaded, idiomatic usage of OpenCL

an example

#[macro_use]
extern crate em;
use em::*;

#[gpu_use]
fn main() {
    let mut x = vec![0.0; 1000];
    gpu_do!(load(x)); // move data to the GPU
    
    gpu_do!(launch()); // off-load to run on the GPU
    for i in 0..1000 {
        x[i] = x[i] * 10.0;
    }

    gpu_do!(read(x)); // move data back from the GPU
    println!("{:?}", x);
}

usage

You can use Emu in your Rust projects by doing the following-

  1. Add em = 0.3.0 to Cargo.toml
  2. Confirm that an OpenCL library is installed for your platform

Learn how to get started with Emu by looking at the documentation.

contributing

Emu currently works very well (robust, well-documented, OK-ish baseline performance) but only with a small subset of Rust. The roadmap for what to do next is pretty straightforward - expand that subset of Rust that we look at. Here is an up-to-date (but not necessarily complete) list of things to work on.

  • Constant address space by default
  • Data race safety with Rayon
  • Multiple GPU usage
  • Multiple thread usage (from host)
  • Support for methods (details in CONTRIBUTING.md)
  • Support for block algorithms
  • Support for reduction algorithms
  • Support for for x in &data
  • Support for for x in &mut data
  • Support for variables
  • Support for if statements
  • Support for if/else-if/else statements
  • Support for all Rust with NVPTX
  • insert your super-cool idea here

We want people to be able to implement all sorts of cool things (simulations, AI, image processing) with Rust + Emu. If you are excited about building a framework for accelerating Rust code with GPUs, create a GitHub issue for whatever you want to work on and/or discuss on Gitter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.