From 04e41c17e1c6a818b59eaf04e37b21aa279229da Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Tue, 18 Feb 2025 16:33:09 -0600 Subject: [PATCH] just use aligned-vec directly in test crates --- Cargo.lock | 1 + hercules_samples/dot/Cargo.toml | 1 + hercules_samples/dot/src/main.rs | 10 ++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1973fbbe..0cad8e19 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 9b11ddc1..ab35cbaf 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 19743150..7bcaaeba 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); -- GitLab