diff --git a/Cargo.lock b/Cargo.lock index 1973fbbeb88622cb01fe3ddfc191aae796a00f54..0cad8e19b64d4f6279c1d25594e5c61ef1ceb1a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -670,6 +670,7 @@ dependencies = [ name = "dot" version = "0.1.0" dependencies = [ + "aligned-vec", "async-std", "clap", "hercules_rt", diff --git a/hercules_samples/dot/Cargo.toml b/hercules_samples/dot/Cargo.toml index 9b11ddc10b5d185e020d639e677f5b56a2c3b8d0..ab35cbaf02237b49aca0a344ec611e77fb55bb11 100644 --- a/hercules_samples/dot/Cargo.toml +++ b/hercules_samples/dot/Cargo.toml @@ -17,3 +17,4 @@ hercules_rt = { path = "../../hercules_rt" } rand = "*" async-std = "*" with_builtin_macros = "0.1.0" +aligned-vec = "*" diff --git a/hercules_samples/dot/src/main.rs b/hercules_samples/dot/src/main.rs index 197431507fd0c9246e07527d3f58081df25757b8..7bcaaebaf6694fb29a8fba4fe883500f90034c26 100644 --- a/hercules_samples/dot/src/main.rs +++ b/hercules_samples/dot/src/main.rs @@ -4,14 +4,16 @@ use hercules_rt::CUDABox; use hercules_rt::{runner, HerculesImmBox, HerculesImmBoxTo}; +use aligned_vec::ABox; + juno_build::juno!("dot"); fn main() { async_std::task::block_on(async { - let a: [f32; 8] = [0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0]; - let b: [f32; 8] = [0.0, 5.0, 0.0, 6.0, 0.0, 7.0, 0.0, 8.0]; - let a = HerculesImmBox::from(&a as &[f32]); - let b = HerculesImmBox::from(&b as &[f32]); + let a: ABox<[f32; 8]> = ABox::new(32, [0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0]); + let b: ABox<[f32; 8]> = ABox::new(32, [0.0, 5.0, 0.0, 6.0, 0.0, 7.0, 0.0, 8.0]); + let a = HerculesImmBox::from(a.as_ref() as &[f32]); + let b = HerculesImmBox::from(b.as_ref() as &[f32]); let mut r = runner!(dot); let c = r.run(8, a.to(), b.to()).await; println!("{}", c);