Skip to content

Commit

Permalink
feat/cuda: add CUDA support for all existing operations
Browse files Browse the repository at this point in the history
  • Loading branch information
hobofan committed Feb 22, 2016
1 parent 0ba6796 commit 6e98efb
Show file tree
Hide file tree
Showing 10 changed files with 685 additions and 303 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ keywords = ["blas", "collenchyma", "computation", "hpc", "plugin"]
license = "MIT"

[dependencies]
collenchyma = { version = "0.0.6", default-features = false }
collenchyma = { version = "0.0.8", default-features = false }
lazy_static = "0.1"

# native
rblas = { version = "0.0.11", optional = true }

# cuda
cublas = { version = "0.2.0", optional = true }

clippy = { version = "0.0.27", optional = true }

[dev-dependencies]
Expand All @@ -27,7 +32,7 @@ rand = "0.3"
[features]
default = ["native", "cuda", "opencl"]
native = ["collenchyma/native", "rblas"]
cuda = ["collenchyma/cuda"]
cuda = ["collenchyma/cuda", "cublas"]
opencl = ["collenchyma/opencl"]

travis = ["native"]
Expand Down
20 changes: 6 additions & 14 deletions benches/rblas_overhead.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(test)]
#![feature(clone_from_slice)]

extern crate test;
extern crate collenchyma as co;
Expand All @@ -8,20 +7,13 @@ extern crate rblas;
extern crate rand;

use test::Bencher;
use co::backend::{Backend, BackendConfig};
use co::frameworks::Native;
use co::framework::IFramework;
use co::tensor::SharedTensor;
use co::prelude::*;
use co_blas::plugin::*;
use rblas::Dot;

use rand::{thread_rng, Rng};

fn backend() -> Backend<Native> {
let framework = Native::new();
let hardwares = framework.hardwares();
let backend_config = BackendConfig::new(framework, hardwares);
Backend::new(backend_config).unwrap()
Backend::<Native>::default().unwrap()
}

#[bench]
Expand All @@ -32,7 +24,7 @@ fn bench_1000_dot_100_rblas(b: &mut Bencher) {

b.iter(|| {
for _ in 0..1000 {
let res = Dot::dot(&slice_a, &slice_b);
let res = rblas::Dot::dot(&slice_a, &slice_b);
test::black_box(res);
}
});
Expand Down Expand Up @@ -108,7 +100,7 @@ fn bench_100_dot_1000_rblas(b: &mut Bencher) {

b.iter(|| {
for _ in 0..100 {
let res = Dot::dot(&slice_a, &slice_b);
let res = rblas::Dot::dot(&slice_a, &slice_b);
test::black_box(res);
}
});
Expand Down Expand Up @@ -184,7 +176,7 @@ fn bench_10_dot_10000_rblas(b: &mut Bencher) {

b.iter(|| {
for _ in 0..10 {
let res = Dot::dot(&slice_a, &slice_b);
let res = rblas::Dot::dot(&slice_a, &slice_b);
test::black_box(res);
}
});
Expand Down Expand Up @@ -229,7 +221,7 @@ fn bench_5_dot_20000_rblas(b: &mut Bencher) {

b.iter(|| {
for _ in 0..5 {
let res = Dot::dot(&slice_a, &slice_b);
let res = rblas::Dot::dot(&slice_a, &slice_b);
test::black_box(res);
}
});
Expand Down
103 changes: 0 additions & 103 deletions src/frameworks/cuda.rs

This file was deleted.

Loading

0 comments on commit 6e98efb

Please sign in to comment.