Crates.io | em |
lib.rs | em |
version | 0.3.0 |
source | src |
created_at | 2019-05-27 21:34:23.084923 |
updated_at | 2019-10-21 09:41:08.486848 |
description | A procedural macro for GPU acceleration, GPU programming |
homepage | https://www.github.com/calebwin/emu |
repository | https://www.github.com/calebwin/emu |
max_upload_size | |
id | 137411 |
size | 11,076 |
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.
cargo test
, cargo doc
, crates.io
rustfmt
, racer
, rls
#[macro_use]
extern crate em;
use em::*;
#[gpu_use]
fn main() {
let mut x = vec![0.0; 1000];
gpu_do!(load(x)); // load data to the GPU
// this code gets identified as accelerate-able
// the compiler will insert calls to OpenCL to run this on the GPU
gpu_do!(launch());
for i in 0..1000 {
x[i] = x[i] * 10;
}
gpu_do!(read(x)); // read data back from the GPU
println!("{:?}", x);
}
You can use Emu in your Rust projects by doing the following-
em = 0.3.0
to Cargo.toml
Learn how to get started with Emu by looking at the documentation.