#![cfg(feature = "gpu_accel")] use std::time::Instant; mod test_parameters; use test_parameters::P; use gpurs::Result; use gpurs::geo::{ Vec3h, Transform3h }; use gpurs::geogpu::GPUTransformer; #[test] fn stress_test() -> Result<()> { let test_vectors: Vec> = vec![Vec3h::

::i(); 1000000]; let rotate: Transform3h

= Transform3h::

::rotation_z(std::f64::consts::PI as P / 2.0); let scale: Transform3h

= Transform3h::

::scale(2.0); let translate: Transform3h

= Transform3h::

::translate(-1.0, 0.0, 1.0); let transform: Transform3h

= translate * (scale * rotate); let cpu_sample: Vec3h

= &transform * &Vec3h::

::i(); let mut transformer: GPUTransformer

= GPUTransformer::

::init()?; let transform_idx: usize = transformer.store_transform3h(transform)?; let transform_start = Instant::now(); let transformed_vecs: Vec> = transformer.mass_transform_3h(transform_idx, &test_vectors)?; println!("Transformation Time: {:?}", transform_start.elapsed()); println!("GPU Sample: {:?}", transformed_vecs[3]); println!("CPU Sample: {:?}", cpu_sample); Ok(()) }