Skip to content
a language for programming GPUs
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
book/archives/0.1.0 archived old book and old examples Jun 18, 2019
docs implemented converting numbers between different precisions Jun 4, 2019
examples/archives/0.1.0 archived old book and old examples Jun 18, 2019
playground re-implemented emu macro Jun 18, 2019
src
.gitignore Removing /target folders in subfolders too Jun 3, 2019
CODE_OF_CONDUCT.md changed code of conduct to Rust's code of conduct Jun 18, 2019
CONTRIBUTING.md added CONTRIBUTING Jun 4, 2019
Cargo.toml re-implemented emu macro Jun 18, 2019
LICENSE added license Apr 2, 2019
README.md

README.md

a picture of a real-world emu

Emu is a high-level language for programming GPUs.

// The "emu!" macro accepts a chunk of Emu code and
// generates Rust functions that can be called to perform computation on the GPU
emu! {
    // Multiply any element in given data by given coefficient
    function multiply(data [f32], coeff f32) {
        data[..] *= coeff;
    }
    
    // Apply sigmoid function to any element in given data
    function sig(data [f32]) {
        let elem: f32 = data[...];
        let res: f32 = 1 / (1 + E ^ -elem);
        data[..] = res;
    }

    /// Multiplies each element in given data by given coefficient
    fn multiply(data: &mut Vec<f32>, coeff: &f32);
    /// Applies sigmoid to each element in given data
    fn sig(data: &mut Vec<f32>);
}

Emu - unlike OpenCL/CUDA/Halide/Futhark - is embedded in Rust. This lets it take advantage of the ecosystem (cargo build, cargo test, cargo doc, rustc, crates.io, docs.rs) in ways that let it provide a far more streamlined system for programming GPUs. And consequently, Emu makes Rust ideal - compared to Python/Julia/C++ - for writing minimalistic programs that do robust, data-intensive computation.

fn main() {
    // Vector of data to be operated on
    let mut my_data = vec![0.9, 3.8, 3.9, 8.2, 2.5];
    
    // Multiply data by 10 and take sigmoid
    multiply(&mut my_data, &10.0)
    sig(&mut my_data);
}

To get started programming GPUs with Emu, check out the book, the examples, and the crate itself.

You can’t perform that action at this time.