From b0ec35705b63d9ea3361c9dc8499f7dca47260af Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 22 Nov 2018 17:12:33 +0300 Subject: [PATCH 01/48] the initial bench version --- vm/vm_bench/fib_recursive/Cargo.toml | 7 ++++ vm/vm_bench/fib_recursive/src/lib.rs | 20 +++++++++++ vm/vm_bench/matrix_product/src/lib.rs | 0 vm/vm_bench/pollard_rho_128/Cargo.toml | 10 ++++++ vm/vm_bench/pollard_rho_128/src/lib.rs | 49 ++++++++++++++++++++++++++ vm/vm_bench/snappy_compress/Cargo.toml | 10 ++++++ vm/vm_bench/snappy_compress/src/lib.rs | 9 +++++ 7 files changed, 105 insertions(+) create mode 100644 vm/vm_bench/fib_recursive/Cargo.toml create mode 100644 vm/vm_bench/fib_recursive/src/lib.rs create mode 100644 vm/vm_bench/matrix_product/src/lib.rs create mode 100644 vm/vm_bench/pollard_rho_128/Cargo.toml create mode 100644 vm/vm_bench/pollard_rho_128/src/lib.rs create mode 100644 vm/vm_bench/snappy_compress/Cargo.toml create mode 100644 vm/vm_bench/snappy_compress/src/lib.rs diff --git a/vm/vm_bench/fib_recursive/Cargo.toml b/vm/vm_bench/fib_recursive/Cargo.toml new file mode 100644 index 0000000000..4e9db2bceb --- /dev/null +++ b/vm/vm_bench/fib_recursive/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "fibonacci" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] diff --git a/vm/vm_bench/fib_recursive/src/lib.rs b/vm/vm_bench/fib_recursive/src/lib.rs new file mode 100644 index 0000000000..857b92695f --- /dev/null +++ b/vm/vm_bench/fib_recursive/src/lib.rs @@ -0,0 +1,20 @@ +const FIB_NUMBER : i64 = 40; +const ITERATION_COUNT : i32 = 100; + +#[no_mangle] +pub extern "C" fn fib(num: i64) -> i64 { + if num == 1 || num == 2 { + return 1 + } + + fib(num - 1) * fib(num - 2) +} + +#[no_mangle] +pub extern "C" fn test() -> i64 { + for _ in 1..ITERATION_COUNT { + fib(FIB_NUMBER); + } + + fib(FIB_NUMBER) +} diff --git a/vm/vm_bench/matrix_product/src/lib.rs b/vm/vm_bench/matrix_product/src/lib.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vm/vm_bench/pollard_rho_128/Cargo.toml b/vm/vm_bench/pollard_rho_128/Cargo.toml new file mode 100644 index 0000000000..447a2fe25d --- /dev/null +++ b/vm/vm_bench/pollard_rho_128/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "pollard_rho_128" +version = "0.1.0" +authors = ["losfair "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +num-bigint = "0.2" diff --git a/vm/vm_bench/pollard_rho_128/src/lib.rs b/vm/vm_bench/pollard_rho_128/src/lib.rs new file mode 100644 index 0000000000..771a3a77ff --- /dev/null +++ b/vm/vm_bench/pollard_rho_128/src/lib.rs @@ -0,0 +1,49 @@ +fn pollard_rho_factor_i64(n: i64) -> (i64, i64) { + let n = n as i128; + + #[inline] + fn g(x: i128, n: i128) -> i128 { + ((x * x) + 1) % n + } + + #[inline] + fn gcd(mut m: i128, mut n: i128) -> i128 { + while m != 0 { + let old_m = m; + m = n % m; + n = old_m; + } + + n.abs() + } + + let mut x: i128 = 5 /*::rand::random::() as i128 % 10*/; + let mut y: i128 = x; + let mut d: i128 = 1; + + while d == 1 { + x = g(x, n); + y = g(g(y, n), n); + d = gcd((x - y).abs(), n); + } + + if d == n { + return (1, n as i64); + } else { + return (d as i64, (n / d) as i64); + } +} + +#[no_mangle] +pub extern "C" fn app_main() -> i64 { + let a: i64 = 613676879; + let b: i64 = 895640371; + + let (mut r1, mut r2) = pollard_rho_factor_i64(a * b); + if r1 > r2 { + let t = r1; + r1 = r2; + r2 = t; + } + (r1 << 32) | r2 +} \ No newline at end of file diff --git a/vm/vm_bench/snappy_compress/Cargo.toml b/vm/vm_bench/snappy_compress/Cargo.toml new file mode 100644 index 0000000000..2bd6b9e0f7 --- /dev/null +++ b/vm/vm_bench/snappy_compress/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "snappy_compress" +version = "0.1.0" +authors = ["losfair "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +snap = "0.2" diff --git a/vm/vm_bench/snappy_compress/src/lib.rs b/vm/vm_bench/snappy_compress/src/lib.rs new file mode 100644 index 0000000000..3244e938aa --- /dev/null +++ b/vm/vm_bench/snappy_compress/src/lib.rs @@ -0,0 +1,9 @@ +extern crate snap; + +#[no_mangle] +pub extern "C" fn app_main() -> i32 { + const SIZE: usize = 1048576 * 8; + let bytes: Vec = vec! [ 0; SIZE ]; + let encoded = snap::Encoder::new().compress_vec(&bytes).unwrap(); + encoded.len() as i32 +} From 9037b1a8fc32503edbf811d9e3976b621c6dce0f Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 23 Nov 2018 11:07:33 +0300 Subject: [PATCH 02/48] add evd decomposition --- .../matrix_evd_decomposition/Cargo.toml | 13 ++++++++ .../matrix_evd_decomposition/src/lib.rs | 30 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 vm/vm_bench/matrix_evd_decomposition/Cargo.toml create mode 100644 vm/vm_bench/matrix_evd_decomposition/src/lib.rs diff --git a/vm/vm_bench/matrix_evd_decomposition/Cargo.toml b/vm/vm_bench/matrix_evd_decomposition/Cargo.toml new file mode 100644 index 0000000000..066a78c675 --- /dev/null +++ b/vm/vm_bench/matrix_evd_decomposition/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "matrix_evd_decomposition" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +nalgebra = "0.6.0" +num-bigint = {version = "*", default_features = false} +num-traits = {version = "*", default_features = false} +num-integer = {version = "*", default_features = false} \ No newline at end of file diff --git a/vm/vm_bench/matrix_evd_decomposition/src/lib.rs b/vm/vm_bench/matrix_evd_decomposition/src/lib.rs new file mode 100644 index 0000000000..47c56b74cd --- /dev/null +++ b/vm/vm_bench/matrix_evd_decomposition/src/lib.rs @@ -0,0 +1,30 @@ +extern crate rand +extern crate mersenne_twister; + +use mersenne_twister::MersenneTwister; +use rand::{Rng, SeedableRng}; + +// this seed is used for deterministic operation count on different launches +const SEED : i32 = 17 +const MATRIX_ROWS : i32 = 10 +const MATRIX_COLS : i32 = 10 + +// 1117 due to prevent overflow in matrix multiplication +const GENERATION_INTERVAL = 1117 + +// todo define matrix template for i64 and f64 +type Matrix = na::DMatrix + +#[no_mangle] +fn create_matrix(rows_number: u32, columns_count: u32, seed: i32) -> Matrix { + let mut rng = SeedableRng::from_seed(seed); + Matrix::from_fn(rows_number, columns_count, |_, _| rng.gen()) +} + +#[no_mangle] +pub extern "C" fn test() -> i64 { + let matrix_A = create_matrix() + let matrix_B = create_matrix() + + matrix_C = matrix_A.mul(matrix_B) +} From d71ae448d69c27062f4942a311f6c120774c469d Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 26 Nov 2018 01:05:12 +0300 Subject: [PATCH 03/48] update fibonacci --- vm/vm_bench/fib_recursive/src/lib.rs | 4 +-- vm/vm_bench/fib_recursive/src/settings.rs | 2 ++ .../matrix_evd_decomposition/src/lib.rs | 29 +++++++++---------- .../matrix_evd_decomposition/src/settings.rs | 15 ++++++++++ vm/vm_bench/recursive_hash/Cargo.toml | 7 +++++ vm/vm_bench/recursive_hash/src/lib.rs | 7 +++++ vm/vm_bench/snappy_compress/Cargo.toml | 2 +- vm/vm_bench/snappy_compress/src/lib.rs | 17 +++++++++-- vm/vm_bench/snappy_compress/src/settings.rs | 8 +++++ 9 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 vm/vm_bench/fib_recursive/src/settings.rs create mode 100644 vm/vm_bench/matrix_evd_decomposition/src/settings.rs create mode 100644 vm/vm_bench/recursive_hash/Cargo.toml create mode 100644 vm/vm_bench/recursive_hash/src/lib.rs create mode 100644 vm/vm_bench/snappy_compress/src/settings.rs diff --git a/vm/vm_bench/fib_recursive/src/lib.rs b/vm/vm_bench/fib_recursive/src/lib.rs index 857b92695f..2b0fcbe514 100644 --- a/vm/vm_bench/fib_recursive/src/lib.rs +++ b/vm/vm_bench/fib_recursive/src/lib.rs @@ -1,5 +1,5 @@ -const FIB_NUMBER : i64 = 40; -const ITERATION_COUNT : i32 = 100; +mod settings; +use settings::{ITERATION_COUNT, FIB_NUMBER}; #[no_mangle] pub extern "C" fn fib(num: i64) -> i64 { diff --git a/vm/vm_bench/fib_recursive/src/settings.rs b/vm/vm_bench/fib_recursive/src/settings.rs new file mode 100644 index 0000000000..d7324b285c --- /dev/null +++ b/vm/vm_bench/fib_recursive/src/settings.rs @@ -0,0 +1,2 @@ +pub const FIB_NUMBER: i64 = 40; +pub const ITERATION_COUNT: i32 = 100; diff --git a/vm/vm_bench/matrix_evd_decomposition/src/lib.rs b/vm/vm_bench/matrix_evd_decomposition/src/lib.rs index 47c56b74cd..ba7d7d2248 100644 --- a/vm/vm_bench/matrix_evd_decomposition/src/lib.rs +++ b/vm/vm_bench/matrix_evd_decomposition/src/lib.rs @@ -1,19 +1,10 @@ -extern crate rand +extern crate rand; extern crate mersenne_twister; use mersenne_twister::MersenneTwister; use rand::{Rng, SeedableRng}; -// this seed is used for deterministic operation count on different launches -const SEED : i32 = 17 -const MATRIX_ROWS : i32 = 10 -const MATRIX_COLS : i32 = 10 - -// 1117 due to prevent overflow in matrix multiplication -const GENERATION_INTERVAL = 1117 - -// todo define matrix template for i64 and f64 -type Matrix = na::DMatrix +mod settings; #[no_mangle] fn create_matrix(rows_number: u32, columns_count: u32, seed: i32) -> Matrix { @@ -21,10 +12,18 @@ fn create_matrix(rows_number: u32, columns_count: u32, seed: i32) -> Matrix { Matrix::from_fn(rows_number, columns_count, |_, _| rng.gen()) } +fn compute_matrix_hash(matrix: Matrix) -> i64 { + +} + #[no_mangle] -pub extern "C" fn test() -> i64 { - let matrix_A = create_matrix() - let matrix_B = create_matrix() +pub extern "C" fn benchmark_entry() -> i64 { + + let matrix_a = create_matrix(MATRIX_ROWS, MATRIX_COLS, SEED); + let matrix_b = create_matrix(MATRIX_ROWS, MATRIX_COLS, SEED); - matrix_C = matrix_A.mul(matrix_B) + for _ in 1..ITERATIONS_COUNT { + let matrix_c = matrix_a * matrix_b; + } + 1 } diff --git a/vm/vm_bench/matrix_evd_decomposition/src/settings.rs b/vm/vm_bench/matrix_evd_decomposition/src/settings.rs new file mode 100644 index 0000000000..4ca4178c1c --- /dev/null +++ b/vm/vm_bench/matrix_evd_decomposition/src/settings.rs @@ -0,0 +1,15 @@ +// this seed is used for deterministic operation count on different launches +const SEED : i32 = 17; + +// matrix size +const MATRIX_ROWS : i32 = 10; +const MATRIX_COLS : i32 = 10; + +// count of test iterations +const ITERATIONS_COUNT : i32 = 1000; + +// 1117 due to prevent overflow in matrix multiplication +const GENERATION_INTERVAL : i32 = 1117; + +// exactly matrix type +type Matrix = na::DMatrix; diff --git a/vm/vm_bench/recursive_hash/Cargo.toml b/vm/vm_bench/recursive_hash/Cargo.toml new file mode 100644 index 0000000000..0e29bdac28 --- /dev/null +++ b/vm/vm_bench/recursive_hash/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "recursive_hash" +version = "0.1.0" +authors = ["vms "] +edition = "2018" + +[dependencies] diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs new file mode 100644 index 0000000000..31e1bb209f --- /dev/null +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/vm/vm_bench/snappy_compress/Cargo.toml b/vm/vm_bench/snappy_compress/Cargo.toml index 2bd6b9e0f7..3f5c7235d2 100644 --- a/vm/vm_bench/snappy_compress/Cargo.toml +++ b/vm/vm_bench/snappy_compress/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "snappy_compress" version = "0.1.0" -authors = ["losfair "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/vm/vm_bench/snappy_compress/src/lib.rs b/vm/vm_bench/snappy_compress/src/lib.rs index 3244e938aa..28a0d6189f 100644 --- a/vm/vm_bench/snappy_compress/src/lib.rs +++ b/vm/vm_bench/snappy_compress/src/lib.rs @@ -1,9 +1,22 @@ extern crate snap; +use settings; + +type Sequence = Vec; #[no_mangle] -pub extern "C" fn app_main() -> i32 { +pub extern "C" fn generate_sequence(size : i64) -> Sequence { + +} + +#[no_mangle] +pub extern "C" fn benchmark_entry() -> i64 { const SIZE: usize = 1048576 * 8; let bytes: Vec = vec! [ 0; SIZE ]; let encoded = snap::Encoder::new().compress_vec(&bytes).unwrap(); - encoded.len() as i32 + + for _ in 1..ITERATIONS_COUNT { + let sequence = generate_sequence() + } + + encoded.len() as i64 } diff --git a/vm/vm_bench/snappy_compress/src/settings.rs b/vm/vm_bench/snappy_compress/src/settings.rs new file mode 100644 index 0000000000..fffd67f8e1 --- /dev/null +++ b/vm/vm_bench/snappy_compress/src/settings.rs @@ -0,0 +1,8 @@ +// this seed is used for deterministic operation count on different launches +const SEED : i32 = 17; + +// count of test iterations +const ITERATIONS_COUNT : i32 = 1000; + +// size of sequence that will be compressed on each iteration +const SEQUENCE_SIZE : i32 = 1024*1024*1024; // 1 Gb From 264c18457634c8932ea67fcfd52a2dd07d69c6d1 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 26 Nov 2018 10:31:37 +0300 Subject: [PATCH 04/48] update recursive hash --- vm/vm_bench/recursive_hash/Cargo.toml | 3 ++- vm/vm_bench/recursive_hash/src/lib.rs | 21 +++++++++++++++------ vm/vm_bench/recursive_hash/src/settings.rs | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 vm/vm_bench/recursive_hash/src/settings.rs diff --git a/vm/vm_bench/recursive_hash/Cargo.toml b/vm/vm_bench/recursive_hash/Cargo.toml index 0e29bdac28..e518d446fd 100644 --- a/vm/vm_bench/recursive_hash/Cargo.toml +++ b/vm/vm_bench/recursive_hash/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "recursive_hash" version = "0.1.0" -authors = ["vms "] +authors = ["M. Voronov "] edition = "2018" [dependencies] +sha = "0.3.2" diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index 31e1bb209f..f744e3b10f 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -1,7 +1,16 @@ -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } +mod settings; + +use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; +use sha3::{Digest, Sha3_256}; + +#[no_mangle] +pub fn bench_test() { + let mut hasher = Sha3_256::new(); + hasher.input(b"asd"); + +// for _ in 1..ITERATIONS_COUNT { +// result = hasher.input(result); +// } + + let result = hasher.result(); } diff --git a/vm/vm_bench/recursive_hash/src/settings.rs b/vm/vm_bench/recursive_hash/src/settings.rs new file mode 100644 index 0000000000..9f2484c31d --- /dev/null +++ b/vm/vm_bench/recursive_hash/src/settings.rs @@ -0,0 +1,2 @@ +pub const ITERATIONS_COUNT: i64 = 1000; +pub const INITIAL_VALUE: i64 = 0; \ No newline at end of file From 75feb1b0eae80cbcde24b2efda5ebde5c62bd236 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 26 Nov 2018 23:09:53 +0300 Subject: [PATCH 05/48] introduce a new look of recursive hash test --- vm/vm_bench/recursive_hash/Cargo.toml | 4 ++-- vm/vm_bench/recursive_hash/src/lib.rs | 28 ++++++++++++++++------ vm/vm_bench/recursive_hash/src/settings.rs | 7 ++++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/vm/vm_bench/recursive_hash/Cargo.toml b/vm/vm_bench/recursive_hash/Cargo.toml index e518d446fd..23539ed518 100644 --- a/vm/vm_bench/recursive_hash/Cargo.toml +++ b/vm/vm_bench/recursive_hash/Cargo.toml @@ -2,7 +2,7 @@ name = "recursive_hash" version = "0.1.0" authors = ["M. Voronov "] -edition = "2018" [dependencies] -sha = "0.3.2" +sha3 = "0.8.1" +reduce = "0.1.1" diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index f744e3b10f..627237769e 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -1,16 +1,30 @@ +#![feature(core_intrinsics)] + mod settings; +extern crate sha3; +extern crate reduce; use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; use sha3::{Digest, Sha3_256}; +use std::mem; +use reduce::Reduce; + +// Now Rust doesn't have any const function that can +// determine size of const variable in compile-time +#[no_mangle] +const fn static_size_of_val(_: &T) -> usize { + mem::size_of::() +} #[no_mangle] -pub fn bench_test() { - let mut hasher = Sha3_256::new(); - hasher.input(b"asd"); +pub fn bench_test() -> u8 { + let seed_as_byte_array: [u8; static_size_of_val(&INITIAL_VALUE)] = + unsafe { mem::transmute(INITIAL_VALUE.to_le()) }; + let mut hash_result = Sha3_256::digest(&seed_as_byte_array); -// for _ in 1..ITERATIONS_COUNT { -// result = hasher.input(result); -// } + for _ in 1..ITERATIONS_COUNT { + hash_result = Sha3_256::digest(&hash_result); + } - let result = hasher.result(); + hash_result.into_iter().reduce(|x1 ,x2| x1 ^ x2).unwrap() } diff --git a/vm/vm_bench/recursive_hash/src/settings.rs b/vm/vm_bench/recursive_hash/src/settings.rs index 9f2484c31d..c6bccb4414 100644 --- a/vm/vm_bench/recursive_hash/src/settings.rs +++ b/vm/vm_bench/recursive_hash/src/settings.rs @@ -1,2 +1,5 @@ -pub const ITERATIONS_COUNT: i64 = 1000; -pub const INITIAL_VALUE: i64 = 0; \ No newline at end of file +// count of iterations that +pub const ITERATIONS_COUNT: i64 = 100;//env!("ITERATIONS_COUNT"); + +// an initial value for computed hash chain +pub const INITIAL_VALUE: i64 = 0;//env!("INITIAL_VALUE"); From 17b30553766e068b8cca44ca907197ba1b1de37b Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 00:17:45 +0300 Subject: [PATCH 06/48] fibonacci and recursive hash final look --- vm/vm_bench/fib_recursive/src/lib.rs | 20 ------------- vm/vm_bench/fib_recursive/src/settings.rs | 2 -- .../Cargo.toml | 6 +++- vm/vm_bench/fibonacci_bigint/src/lib.rs | 28 +++++++++++++++++++ vm/vm_bench/fibonacci_bigint/src/settings.rs | 2 ++ vm/vm_bench/recursive_hash/Cargo.toml | 6 ++-- vm/vm_bench/recursive_hash/src/lib.rs | 21 ++++---------- vm/vm_bench/recursive_hash/src/settings.rs | 6 ++-- 8 files changed, 48 insertions(+), 43 deletions(-) delete mode 100644 vm/vm_bench/fib_recursive/src/lib.rs delete mode 100644 vm/vm_bench/fib_recursive/src/settings.rs rename vm/vm_bench/{fib_recursive => fibonacci_bigint}/Cargo.toml (57%) create mode 100644 vm/vm_bench/fibonacci_bigint/src/lib.rs create mode 100644 vm/vm_bench/fibonacci_bigint/src/settings.rs diff --git a/vm/vm_bench/fib_recursive/src/lib.rs b/vm/vm_bench/fib_recursive/src/lib.rs deleted file mode 100644 index 2b0fcbe514..0000000000 --- a/vm/vm_bench/fib_recursive/src/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -mod settings; -use settings::{ITERATION_COUNT, FIB_NUMBER}; - -#[no_mangle] -pub extern "C" fn fib(num: i64) -> i64 { - if num == 1 || num == 2 { - return 1 - } - - fib(num - 1) * fib(num - 2) -} - -#[no_mangle] -pub extern "C" fn test() -> i64 { - for _ in 1..ITERATION_COUNT { - fib(FIB_NUMBER); - } - - fib(FIB_NUMBER) -} diff --git a/vm/vm_bench/fib_recursive/src/settings.rs b/vm/vm_bench/fib_recursive/src/settings.rs deleted file mode 100644 index d7324b285c..0000000000 --- a/vm/vm_bench/fib_recursive/src/settings.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub const FIB_NUMBER: i64 = 40; -pub const ITERATION_COUNT: i32 = 100; diff --git a/vm/vm_bench/fib_recursive/Cargo.toml b/vm/vm_bench/fibonacci_bigint/Cargo.toml similarity index 57% rename from vm/vm_bench/fib_recursive/Cargo.toml rename to vm/vm_bench/fibonacci_bigint/Cargo.toml index 4e9db2bceb..939addef5e 100644 --- a/vm/vm_bench/fib_recursive/Cargo.toml +++ b/vm/vm_bench/fibonacci_bigint/Cargo.toml @@ -1,7 +1,11 @@ [package] -name = "fibonacci" +name = "fibonacci_bench" version = "0.1.0" authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] + +[dependencies] +num-bigint = "0.2" +num-traits = "0.2" diff --git a/vm/vm_bench/fibonacci_bigint/src/lib.rs b/vm/vm_bench/fibonacci_bigint/src/lib.rs new file mode 100644 index 0000000000..9c46e1df05 --- /dev/null +++ b/vm/vm_bench/fibonacci_bigint/src/lib.rs @@ -0,0 +1,28 @@ +mod settings; +extern crate num_bigint; +extern crate num_traits; + +use settings::{FIB_NUMBER}; +use num_bigint::{BigInt}; +use num_traits::{One, Zero}; + +#[no_mangle] +pub extern "C" fn fib(num: u64) -> BigInt { + let mut f_0: BigInt = Zero::zero(); + let mut f_1: BigInt = One::one(); + + for _ in 0..num { + let f_2 = f_0 + &f_1; + f_0 = f_1; + f_1 = f_2; + } + + f_0 +} + +#[no_mangle] +pub extern "C" fn bench_test() -> u8 { + let fib_number : u64 = FIB_NUMBER.parse::().unwrap(); + + fib(fib_number).to_bytes_le().1.iter().fold(0, |x1, x2| x1 ^ x2) +} diff --git a/vm/vm_bench/fibonacci_bigint/src/settings.rs b/vm/vm_bench/fibonacci_bigint/src/settings.rs new file mode 100644 index 0000000000..18d947590b --- /dev/null +++ b/vm/vm_bench/fibonacci_bigint/src/settings.rs @@ -0,0 +1,2 @@ +// the requested fibonacci number that would be computed +pub const FIB_NUMBER: &'static str = env!("FIB_NUMBER"); diff --git a/vm/vm_bench/recursive_hash/Cargo.toml b/vm/vm_bench/recursive_hash/Cargo.toml index 23539ed518..f5ea138f85 100644 --- a/vm/vm_bench/recursive_hash/Cargo.toml +++ b/vm/vm_bench/recursive_hash/Cargo.toml @@ -1,8 +1,10 @@ [package] -name = "recursive_hash" +name = "recursive_hash_bench" version = "0.1.0" authors = ["M. Voronov "] +[lib] +crate-type = ["cdylib"] + [dependencies] sha3 = "0.8.1" -reduce = "0.1.1" diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index 627237769e..70e18ae6e5 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -1,30 +1,21 @@ -#![feature(core_intrinsics)] - mod settings; extern crate sha3; -extern crate reduce; use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; use sha3::{Digest, Sha3_256}; use std::mem; -use reduce::Reduce; -// Now Rust doesn't have any const function that can -// determine size of const variable in compile-time #[no_mangle] -const fn static_size_of_val(_: &T) -> usize { - mem::size_of::() -} +pub extern "C" fn bench_test() -> u8 { + let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); + let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); -#[no_mangle] -pub fn bench_test() -> u8 { - let seed_as_byte_array: [u8; static_size_of_val(&INITIAL_VALUE)] = - unsafe { mem::transmute(INITIAL_VALUE.to_le()) }; + let seed_as_byte_array: [u8; mem::size_of::()] = unsafe { mem::transmute(initial_value.to_le()) }; let mut hash_result = Sha3_256::digest(&seed_as_byte_array); - for _ in 1..ITERATIONS_COUNT { + for _ in 1..iterations_count { hash_result = Sha3_256::digest(&hash_result); } - hash_result.into_iter().reduce(|x1 ,x2| x1 ^ x2).unwrap() + hash_result.iter().fold(0, |x1 ,x2| x1 ^ x2) } diff --git a/vm/vm_bench/recursive_hash/src/settings.rs b/vm/vm_bench/recursive_hash/src/settings.rs index c6bccb4414..1c552b984e 100644 --- a/vm/vm_bench/recursive_hash/src/settings.rs +++ b/vm/vm_bench/recursive_hash/src/settings.rs @@ -1,5 +1,5 @@ -// count of iterations that -pub const ITERATIONS_COUNT: i64 = 100;//env!("ITERATIONS_COUNT"); +// count of recursive sha3 that would be computed +pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); // an initial value for computed hash chain -pub const INITIAL_VALUE: i64 = 0;//env!("INITIAL_VALUE"); +pub const INITIAL_VALUE: &'static str = env!("INITIAL_VALUE"); From ff2ee077977bd6ddb4be981eedb12e1a1d913365 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 03:49:29 +0300 Subject: [PATCH 07/48] some little improvements --- vm/vm_bench/fibonacci_bigint/Cargo.toml | 2 +- vm/vm_bench/fibonacci_bigint/src/lib.rs | 25 ++++------ .../matrix_evd_decomposition/Cargo.toml | 4 +- vm/vm_bench/recursive_hash/src/lib.rs | 2 +- vm/vm_bench/snappy_compress/src/lib.rs | 22 --------- vm/vm_bench/snappy_compress/src/settings.rs | 8 ---- .../Cargo.toml | 4 +- vm/vm_bench/snappy_compression/src/lib.rs | 48 +++++++++++++++++++ .../snappy_compression/src/settings.rs | 8 ++++ 9 files changed, 73 insertions(+), 50 deletions(-) delete mode 100644 vm/vm_bench/snappy_compress/src/lib.rs delete mode 100644 vm/vm_bench/snappy_compress/src/settings.rs rename vm/vm_bench/{snappy_compress => snappy_compression}/Cargo.toml (65%) create mode 100644 vm/vm_bench/snappy_compression/src/lib.rs create mode 100644 vm/vm_bench/snappy_compression/src/settings.rs diff --git a/vm/vm_bench/fibonacci_bigint/Cargo.toml b/vm/vm_bench/fibonacci_bigint/Cargo.toml index 939addef5e..aaa58b3371 100644 --- a/vm/vm_bench/fibonacci_bigint/Cargo.toml +++ b/vm/vm_bench/fibonacci_bigint/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fibonacci_bench" +name = "fibonacci_bigint_bench" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/fibonacci_bigint/src/lib.rs b/vm/vm_bench/fibonacci_bigint/src/lib.rs index 9c46e1df05..b6af70aae5 100644 --- a/vm/vm_bench/fibonacci_bigint/src/lib.rs +++ b/vm/vm_bench/fibonacci_bigint/src/lib.rs @@ -2,27 +2,22 @@ mod settings; extern crate num_bigint; extern crate num_traits; -use settings::{FIB_NUMBER}; -use num_bigint::{BigInt}; -use num_traits::{One, Zero}; +use settings::FIB_NUMBER; +use num_bigint::BigUint; +use num_traits::One; +use std::ops::Sub; -#[no_mangle] -pub extern "C" fn fib(num: u64) -> BigInt { - let mut f_0: BigInt = Zero::zero(); - let mut f_1: BigInt = One::one(); - - for _ in 0..num { - let f_2 = f_0 + &f_1; - f_0 = f_1; - f_1 = f_2; +fn fib(num: &BigUint) -> BigUint { + if num.le(&BigUint::from(2u32)) { + return One::one(); } - f_0 + fib(&num.sub(1u32)) + fib(&num.sub(2u32)) } #[no_mangle] pub extern "C" fn bench_test() -> u8 { - let fib_number : u64 = FIB_NUMBER.parse::().unwrap(); + let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); - fib(fib_number).to_bytes_le().1.iter().fold(0, |x1, x2| x1 ^ x2) + fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) } diff --git a/vm/vm_bench/matrix_evd_decomposition/Cargo.toml b/vm/vm_bench/matrix_evd_decomposition/Cargo.toml index 066a78c675..6e65f89a9e 100644 --- a/vm/vm_bench/matrix_evd_decomposition/Cargo.toml +++ b/vm/vm_bench/matrix_evd_decomposition/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "matrix_evd_decomposition" +name = "matrix_evd_decomposition_bench" version = "0.1.0" authors = ["M. Voronov "] @@ -10,4 +10,4 @@ crate-type = ["cdylib"] nalgebra = "0.6.0" num-bigint = {version = "*", default_features = false} num-traits = {version = "*", default_features = false} -num-integer = {version = "*", default_features = false} \ No newline at end of file +num-integer = {version = "*", default_features = false} diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index 70e18ae6e5..31d7deada3 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -13,7 +13,7 @@ pub extern "C" fn bench_test() -> u8 { let seed_as_byte_array: [u8; mem::size_of::()] = unsafe { mem::transmute(initial_value.to_le()) }; let mut hash_result = Sha3_256::digest(&seed_as_byte_array); - for _ in 1..iterations_count { + for _ in 0..iterations_count { hash_result = Sha3_256::digest(&hash_result); } diff --git a/vm/vm_bench/snappy_compress/src/lib.rs b/vm/vm_bench/snappy_compress/src/lib.rs deleted file mode 100644 index 28a0d6189f..0000000000 --- a/vm/vm_bench/snappy_compress/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate snap; -use settings; - -type Sequence = Vec; - -#[no_mangle] -pub extern "C" fn generate_sequence(size : i64) -> Sequence { - -} - -#[no_mangle] -pub extern "C" fn benchmark_entry() -> i64 { - const SIZE: usize = 1048576 * 8; - let bytes: Vec = vec! [ 0; SIZE ]; - let encoded = snap::Encoder::new().compress_vec(&bytes).unwrap(); - - for _ in 1..ITERATIONS_COUNT { - let sequence = generate_sequence() - } - - encoded.len() as i64 -} diff --git a/vm/vm_bench/snappy_compress/src/settings.rs b/vm/vm_bench/snappy_compress/src/settings.rs deleted file mode 100644 index fffd67f8e1..0000000000 --- a/vm/vm_bench/snappy_compress/src/settings.rs +++ /dev/null @@ -1,8 +0,0 @@ -// this seed is used for deterministic operation count on different launches -const SEED : i32 = 17; - -// count of test iterations -const ITERATIONS_COUNT : i32 = 1000; - -// size of sequence that will be compressed on each iteration -const SEQUENCE_SIZE : i32 = 1024*1024*1024; // 1 Gb diff --git a/vm/vm_bench/snappy_compress/Cargo.toml b/vm/vm_bench/snappy_compression/Cargo.toml similarity index 65% rename from vm/vm_bench/snappy_compress/Cargo.toml rename to vm/vm_bench/snappy_compression/Cargo.toml index 3f5c7235d2..b750cecbf3 100644 --- a/vm/vm_bench/snappy_compress/Cargo.toml +++ b/vm/vm_bench/snappy_compression/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snappy_compress" +name = "snappy_compression_bench" version = "0.1.0" authors = ["M. Voronov "] @@ -8,3 +8,5 @@ crate-type = ["cdylib"] [dependencies] snap = "0.2" +rand = "0.6.1" +rand_isaac = "0.1.0" diff --git a/vm/vm_bench/snappy_compression/src/lib.rs b/vm/vm_bench/snappy_compression/src/lib.rs new file mode 100644 index 0000000000..bdff7ee309 --- /dev/null +++ b/vm/vm_bench/snappy_compression/src/lib.rs @@ -0,0 +1,48 @@ +mod settings; + +extern crate snap; +extern crate rand; +extern crate rand_isaac; + +use settings::{SEED, ITERATIONS_COUNT, SEQUENCE_SIZE}; +use rand::{Rng, SeedableRng}; +use rand_isaac::IsaacRng; +use std::mem; + +type Sequence = Vec; + +fn generate_sequence(seed : u64, size : u64) -> Sequence { + let mut seed_as_vec : [u8; 32] = [0;32]; + let tt : [u8; 8] = unsafe { mem::transmute(seed.to_le()) }; + // TODO : rewrite this ugly code + for i in 0..8 { + seed_as_vec[i] += tt[i]; + } + + let mut rng: IsaacRng = SeedableRng::from_seed(seed_as_vec); + let mut result_sequence = Sequence::with_capacity(size as usize); + + for _ in 0..size { + result_sequence.push(rng.gen::()); + } + result_sequence +} + +#[no_mangle] +pub extern "C" fn bench_test() -> u64 { + let seed : u64 = SEED.parse::().unwrap(); + let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); + let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); + + let mut sequence : Sequence = generate_sequence(seed, sequence_size); + let mut compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); + + for _ in 1..iterations_count { + let new_seed = compressed_sequence.len() + + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; + sequence = generate_sequence(new_seed as u64, sequence_size); + compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); + } + + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 +} diff --git a/vm/vm_bench/snappy_compression/src/settings.rs b/vm/vm_bench/snappy_compression/src/settings.rs new file mode 100644 index 0000000000..677885e1d2 --- /dev/null +++ b/vm/vm_bench/snappy_compression/src/settings.rs @@ -0,0 +1,8 @@ +// this values is used as a seed to pseudo-random generator for sequence generation +pub const SEED : &'static str = env!("SEED"); + +// count of test iterations +pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); + +// size of sequence that should be compressed in each iteration +pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); From e846aaa7be6b93c5aa1e49bf58046150376ffb4e Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 15:17:14 +0300 Subject: [PATCH 08/48] introduce matrix tests --- vm/vm_bench/factorization_reikna/Cargo.toml | 10 ++++ vm/vm_bench/factorization_reikna/src/lib.rs | 11 +++++ .../factorization_reikna/src/settings.rs | 1 + .../matrix_evd_decomposition/Cargo.toml | 13 ----- .../matrix_evd_decomposition/src/lib.rs | 29 ----------- .../matrix_evd_decomposition/src/settings.rs | 15 ------ vm/vm_bench/matrix_product/Cargo.toml | 12 +++++ vm/vm_bench/matrix_product/src/lib.rs | 41 ++++++++++++++++ vm/vm_bench/matrix_product/src/settings.rs | 16 ++++++ vm/vm_bench/matrix_qr_decompostion/Cargo.toml | 12 +++++ vm/vm_bench/matrix_qr_decompostion/src/lib.rs | 38 ++++++++++++++ .../matrix_qr_decompostion/src/settings.rs | 16 ++++++ .../matrix_svd_decomposition/Cargo.toml | 12 +++++ .../matrix_svd_decomposition/src/lib.rs | 29 +++++++++++ .../matrix_svd_decomposition/src/settings.rs | 16 ++++++ vm/vm_bench/pollard_rho_128/Cargo.toml | 10 ---- vm/vm_bench/pollard_rho_128/src/lib.rs | 49 ------------------- vm/vm_bench/snappy_compression/src/lib.rs | 14 ++---- 18 files changed, 217 insertions(+), 127 deletions(-) create mode 100644 vm/vm_bench/factorization_reikna/Cargo.toml create mode 100644 vm/vm_bench/factorization_reikna/src/lib.rs create mode 100644 vm/vm_bench/factorization_reikna/src/settings.rs delete mode 100644 vm/vm_bench/matrix_evd_decomposition/Cargo.toml delete mode 100644 vm/vm_bench/matrix_evd_decomposition/src/lib.rs delete mode 100644 vm/vm_bench/matrix_evd_decomposition/src/settings.rs create mode 100644 vm/vm_bench/matrix_product/Cargo.toml create mode 100644 vm/vm_bench/matrix_product/src/settings.rs create mode 100644 vm/vm_bench/matrix_qr_decompostion/Cargo.toml create mode 100644 vm/vm_bench/matrix_qr_decompostion/src/lib.rs create mode 100644 vm/vm_bench/matrix_qr_decompostion/src/settings.rs create mode 100644 vm/vm_bench/matrix_svd_decomposition/Cargo.toml create mode 100644 vm/vm_bench/matrix_svd_decomposition/src/lib.rs create mode 100644 vm/vm_bench/matrix_svd_decomposition/src/settings.rs delete mode 100644 vm/vm_bench/pollard_rho_128/Cargo.toml delete mode 100644 vm/vm_bench/pollard_rho_128/src/lib.rs diff --git a/vm/vm_bench/factorization_reikna/Cargo.toml b/vm/vm_bench/factorization_reikna/Cargo.toml new file mode 100644 index 0000000000..85f5dced55 --- /dev/null +++ b/vm/vm_bench/factorization_reikna/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "factorization_reikna_bench" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +reikna = "0.6.0" diff --git a/vm/vm_bench/factorization_reikna/src/lib.rs b/vm/vm_bench/factorization_reikna/src/lib.rs new file mode 100644 index 0000000000..3b1ade5f87 --- /dev/null +++ b/vm/vm_bench/factorization_reikna/src/lib.rs @@ -0,0 +1,11 @@ +mod settings; +extern crate reikna; + +use settings::NUMBER; +use reikna::prime; + +#[no_mangle] +pub extern "C" fn bench_test() -> u64 { + let factors = prime::factorize(NUMBER); + factors[0] +} \ No newline at end of file diff --git a/vm/vm_bench/factorization_reikna/src/settings.rs b/vm/vm_bench/factorization_reikna/src/settings.rs new file mode 100644 index 0000000000..1051f10373 --- /dev/null +++ b/vm/vm_bench/factorization_reikna/src/settings.rs @@ -0,0 +1 @@ +pub const NUMBER : u64 = 9223372036854775807/1000000000; \ No newline at end of file diff --git a/vm/vm_bench/matrix_evd_decomposition/Cargo.toml b/vm/vm_bench/matrix_evd_decomposition/Cargo.toml deleted file mode 100644 index 6e65f89a9e..0000000000 --- a/vm/vm_bench/matrix_evd_decomposition/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "matrix_evd_decomposition_bench" -version = "0.1.0" -authors = ["M. Voronov "] - -[lib] -crate-type = ["cdylib"] - -[dependencies] -nalgebra = "0.6.0" -num-bigint = {version = "*", default_features = false} -num-traits = {version = "*", default_features = false} -num-integer = {version = "*", default_features = false} diff --git a/vm/vm_bench/matrix_evd_decomposition/src/lib.rs b/vm/vm_bench/matrix_evd_decomposition/src/lib.rs deleted file mode 100644 index ba7d7d2248..0000000000 --- a/vm/vm_bench/matrix_evd_decomposition/src/lib.rs +++ /dev/null @@ -1,29 +0,0 @@ -extern crate rand; -extern crate mersenne_twister; - -use mersenne_twister::MersenneTwister; -use rand::{Rng, SeedableRng}; - -mod settings; - -#[no_mangle] -fn create_matrix(rows_number: u32, columns_count: u32, seed: i32) -> Matrix { - let mut rng = SeedableRng::from_seed(seed); - Matrix::from_fn(rows_number, columns_count, |_, _| rng.gen()) -} - -fn compute_matrix_hash(matrix: Matrix) -> i64 { - -} - -#[no_mangle] -pub extern "C" fn benchmark_entry() -> i64 { - - let matrix_a = create_matrix(MATRIX_ROWS, MATRIX_COLS, SEED); - let matrix_b = create_matrix(MATRIX_ROWS, MATRIX_COLS, SEED); - - for _ in 1..ITERATIONS_COUNT { - let matrix_c = matrix_a * matrix_b; - } - 1 -} diff --git a/vm/vm_bench/matrix_evd_decomposition/src/settings.rs b/vm/vm_bench/matrix_evd_decomposition/src/settings.rs deleted file mode 100644 index 4ca4178c1c..0000000000 --- a/vm/vm_bench/matrix_evd_decomposition/src/settings.rs +++ /dev/null @@ -1,15 +0,0 @@ -// this seed is used for deterministic operation count on different launches -const SEED : i32 = 17; - -// matrix size -const MATRIX_ROWS : i32 = 10; -const MATRIX_COLS : i32 = 10; - -// count of test iterations -const ITERATIONS_COUNT : i32 = 1000; - -// 1117 due to prevent overflow in matrix multiplication -const GENERATION_INTERVAL : i32 = 1117; - -// exactly matrix type -type Matrix = na::DMatrix; diff --git a/vm/vm_bench/matrix_product/Cargo.toml b/vm/vm_bench/matrix_product/Cargo.toml new file mode 100644 index 0000000000..e96c5139d6 --- /dev/null +++ b/vm/vm_bench/matrix_product/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "matrix_product_bench" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +nalgebra = { version = "0.16", features = [ "alloc" ] } +rand = "0.6.1" +rand_isaac = "0.1.0" diff --git a/vm/vm_bench/matrix_product/src/lib.rs b/vm/vm_bench/matrix_product/src/lib.rs index e69de29bb2..8e4f146cab 100644 --- a/vm/vm_bench/matrix_product/src/lib.rs +++ b/vm/vm_bench/matrix_product/src/lib.rs @@ -0,0 +1,41 @@ +mod settings; + +extern crate rand; +extern crate rand_isaac; + +use rand::{Rng, SeedableRng}; +use rand_isaac::IsaacRng; +use settings::*; + +fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { + let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) +} + +fn compute_matrix_hash(matrix: &Matrix) -> u64 { + let mut trace : u64 = 0; + for i in 0..matrix.ncols() { + trace += matrix[(i,i)] + } + + trace +} + +#[no_mangle] +pub extern "C" fn bench_test() -> u64 { + let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); + let seed : u64 = SEED.parse::().unwrap(); + let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); + + let mut matrix_hash : u64 = seed; + for _ in 1..iterations_count { + let matrix_a = create_matrix(matrix_size, matrix_size, matrix_hash); + matrix_hash = compute_matrix_hash(&matrix_a); + let matrix_b = create_matrix(matrix_size, matrix_size, matrix_hash); + + let matrix_c = matrix_a * matrix_b; + matrix_hash = compute_matrix_hash(&matrix_c); + } + + matrix_hash +} diff --git a/vm/vm_bench/matrix_product/src/settings.rs b/vm/vm_bench/matrix_product/src/settings.rs new file mode 100644 index 0000000000..45e5d1c1ed --- /dev/null +++ b/vm/vm_bench/matrix_product/src/settings.rs @@ -0,0 +1,16 @@ +// this seed is used for deterministic operation count on different launches +pub const SEED : &'static str = env!("SEED"); + +// matrix size +pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); + +// count of test iterations +pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); + +// 1117 due to prevent overflow in matrix multiplication +pub const GENERATION_INTERVAL : u64 = 1117; + +pub extern crate nalgebra; +use nalgebra::DMatrix; +// exactly matrix type +pub type Matrix = DMatrix; diff --git a/vm/vm_bench/matrix_qr_decompostion/Cargo.toml b/vm/vm_bench/matrix_qr_decompostion/Cargo.toml new file mode 100644 index 0000000000..7dab7ef804 --- /dev/null +++ b/vm/vm_bench/matrix_qr_decompostion/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "matrix_qr_decomposition_bench" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +nalgebra = { version = "0.16", features = [ "alloc" ] } +rand = "0.6.1" +rand_isaac = "0.1.0" diff --git a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs new file mode 100644 index 0000000000..4c09af8460 --- /dev/null +++ b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs @@ -0,0 +1,38 @@ +mod settings; + +extern crate rand; +extern crate rand_isaac; + +use rand::{Rng, SeedableRng}; +use rand_isaac::IsaacRng; +use settings::*; + +fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { + let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) +} + +fn compute_matrix_hash(matrix: &Matrix) -> f64 { + let mut trace : f64 = 0.0; + for i in 0..matrix.ncols() { + trace += matrix[(i,i)] + } + + trace +} + +#[no_mangle] +pub extern "C" fn bench_test() -> u64 { + let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); + let seed : u64 = SEED.parse::().unwrap(); + let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); + + let mut matrix_hash : u64 = seed; + for _ in 1..iterations_count { + let matrix = create_matrix(matrix_size, matrix_size, matrix_hash); + let qr = matrix.qr(); + matrix_hash = compute_matrix_hash(&qr.r()).to_bits(); + } + + matrix_hash +} diff --git a/vm/vm_bench/matrix_qr_decompostion/src/settings.rs b/vm/vm_bench/matrix_qr_decompostion/src/settings.rs new file mode 100644 index 0000000000..14bc61f193 --- /dev/null +++ b/vm/vm_bench/matrix_qr_decompostion/src/settings.rs @@ -0,0 +1,16 @@ +// this seed is used for deterministic operation count on different launches +pub const SEED : &'static str = env!("SEED"); + +// matrix size +pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); + +// count of test iterations +pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); + +// 1117 due to prevent overflow in matrix multiplication +pub const GENERATION_INTERVAL : f64 = 1117.0; + +pub extern crate nalgebra; +use nalgebra::DMatrix; +// exactly matrix type +pub type Matrix = DMatrix; diff --git a/vm/vm_bench/matrix_svd_decomposition/Cargo.toml b/vm/vm_bench/matrix_svd_decomposition/Cargo.toml new file mode 100644 index 0000000000..37fd72af52 --- /dev/null +++ b/vm/vm_bench/matrix_svd_decomposition/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "matrix_svd_decomposition_bench" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +nalgebra = { version = "0.16", features = [ "alloc" ] } +rand = "0.6.1" +rand_isaac = "0.1.0" diff --git a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs new file mode 100644 index 0000000000..7915e97916 --- /dev/null +++ b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs @@ -0,0 +1,29 @@ +mod settings; + +extern crate rand; +extern crate rand_isaac; + +use rand::{Rng, SeedableRng}; +use rand_isaac::IsaacRng; +use settings::*; + +fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { + let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) +} + +#[no_mangle] +pub extern "C" fn bench_test() -> u64 { + let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); + let seed : u64 = SEED.parse::().unwrap(); + let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); + + let mut matrix_hash : u64 = seed; + for _ in 1..iterations_count { + let matrix = create_matrix(matrix_size, matrix_size, matrix_hash); + let svd = matrix.svd(true, true); + matrix_hash = svd.singular_values.iter().fold(0u64, |x1, x2| x1 ^ x2.to_bits()); + } + + matrix_hash +} diff --git a/vm/vm_bench/matrix_svd_decomposition/src/settings.rs b/vm/vm_bench/matrix_svd_decomposition/src/settings.rs new file mode 100644 index 0000000000..3ba9a90334 --- /dev/null +++ b/vm/vm_bench/matrix_svd_decomposition/src/settings.rs @@ -0,0 +1,16 @@ +// this seed is used for deterministic operation count on different launches +pub const SEED : &'static str = env!("SEED"); + +// matrix size +pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); + +// count of test iterations +pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); + +// maximum value of matrix element +pub const GENERATION_INTERVAL : f64 = 1117.0; + +pub extern crate nalgebra; +use nalgebra::DMatrix; +// exactly matrix type +pub type Matrix = DMatrix; diff --git a/vm/vm_bench/pollard_rho_128/Cargo.toml b/vm/vm_bench/pollard_rho_128/Cargo.toml deleted file mode 100644 index 447a2fe25d..0000000000 --- a/vm/vm_bench/pollard_rho_128/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "pollard_rho_128" -version = "0.1.0" -authors = ["losfair "] - -[lib] -crate-type = ["cdylib"] - -[dependencies] -num-bigint = "0.2" diff --git a/vm/vm_bench/pollard_rho_128/src/lib.rs b/vm/vm_bench/pollard_rho_128/src/lib.rs deleted file mode 100644 index 771a3a77ff..0000000000 --- a/vm/vm_bench/pollard_rho_128/src/lib.rs +++ /dev/null @@ -1,49 +0,0 @@ -fn pollard_rho_factor_i64(n: i64) -> (i64, i64) { - let n = n as i128; - - #[inline] - fn g(x: i128, n: i128) -> i128 { - ((x * x) + 1) % n - } - - #[inline] - fn gcd(mut m: i128, mut n: i128) -> i128 { - while m != 0 { - let old_m = m; - m = n % m; - n = old_m; - } - - n.abs() - } - - let mut x: i128 = 5 /*::rand::random::() as i128 % 10*/; - let mut y: i128 = x; - let mut d: i128 = 1; - - while d == 1 { - x = g(x, n); - y = g(g(y, n), n); - d = gcd((x - y).abs(), n); - } - - if d == n { - return (1, n as i64); - } else { - return (d as i64, (n / d) as i64); - } -} - -#[no_mangle] -pub extern "C" fn app_main() -> i64 { - let a: i64 = 613676879; - let b: i64 = 895640371; - - let (mut r1, mut r2) = pollard_rho_factor_i64(a * b); - if r1 > r2 { - let t = r1; - r1 = r2; - r2 = t; - } - (r1 << 32) | r2 -} \ No newline at end of file diff --git a/vm/vm_bench/snappy_compression/src/lib.rs b/vm/vm_bench/snappy_compression/src/lib.rs index bdff7ee309..b6257f1cff 100644 --- a/vm/vm_bench/snappy_compression/src/lib.rs +++ b/vm/vm_bench/snappy_compression/src/lib.rs @@ -7,19 +7,11 @@ extern crate rand_isaac; use settings::{SEED, ITERATIONS_COUNT, SEQUENCE_SIZE}; use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; -use std::mem; type Sequence = Vec; fn generate_sequence(seed : u64, size : u64) -> Sequence { - let mut seed_as_vec : [u8; 32] = [0;32]; - let tt : [u8; 8] = unsafe { mem::transmute(seed.to_le()) }; - // TODO : rewrite this ugly code - for i in 0..8 { - seed_as_vec[i] += tt[i]; - } - - let mut rng: IsaacRng = SeedableRng::from_seed(seed_as_vec); + let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); let mut result_sequence = Sequence::with_capacity(size as usize); for _ in 0..size { @@ -34,8 +26,8 @@ pub extern "C" fn bench_test() -> u64 { let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); - let mut sequence : Sequence = generate_sequence(seed, sequence_size); - let mut compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); + let mut sequence = generate_sequence(seed, sequence_size); + let mut compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); for _ in 1..iterations_count { let new_seed = compressed_sequence.len() + From 637cbc9c84436a94da2ada6295f9e34bd60d27d6 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 15:18:24 +0300 Subject: [PATCH 09/48] add eof --- vm/vm_bench/factorization_reikna/src/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_bench/factorization_reikna/src/settings.rs b/vm/vm_bench/factorization_reikna/src/settings.rs index 1051f10373..4d5968ca3a 100644 --- a/vm/vm_bench/factorization_reikna/src/settings.rs +++ b/vm/vm_bench/factorization_reikna/src/settings.rs @@ -1 +1 @@ -pub const NUMBER : u64 = 9223372036854775807/1000000000; \ No newline at end of file +pub const NUMBER : u64 = 9223372036854775807/1000000000; From fc08f80fc42494a2ee5e46296a5427d0979981fc Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 15:53:24 +0300 Subject: [PATCH 10/48] update factorization test --- vm/vm_bench/factorization_reikna/src/lib.rs | 5 +++-- vm/vm_bench/recursive_hash/src/lib.rs | 2 +- vm/vm_bench/snappy_compression/src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vm/vm_bench/factorization_reikna/src/lib.rs b/vm/vm_bench/factorization_reikna/src/lib.rs index 3b1ade5f87..0fdd86c4ef 100644 --- a/vm/vm_bench/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/factorization_reikna/src/lib.rs @@ -6,6 +6,7 @@ use reikna::prime; #[no_mangle] pub extern "C" fn bench_test() -> u64 { - let factors = prime::factorize(NUMBER); + let number : u32 = NUMBER.parse::().unwrap(); + let factors = prime::factorize(number); factors[0] -} \ No newline at end of file +} diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index 31d7deada3..eeb28d7e1a 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -6,7 +6,7 @@ use sha3::{Digest, Sha3_256}; use std::mem; #[no_mangle] -pub extern "C" fn bench_test() -> u8 { +pub extern "C" fn main() -> u8 { let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); diff --git a/vm/vm_bench/snappy_compression/src/lib.rs b/vm/vm_bench/snappy_compression/src/lib.rs index b6257f1cff..087702782c 100644 --- a/vm/vm_bench/snappy_compression/src/lib.rs +++ b/vm/vm_bench/snappy_compression/src/lib.rs @@ -21,7 +21,7 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { } #[no_mangle] -pub extern "C" fn bench_test() -> u64 { +pub extern "C" fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); From 18711b20bd7ea4919da31dc4bd69f97f64e5b0e9 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 15:54:10 +0300 Subject: [PATCH 11/48] update factorization test --- vm/vm_bench/factorization_reikna/src/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_bench/factorization_reikna/src/settings.rs b/vm/vm_bench/factorization_reikna/src/settings.rs index 4d5968ca3a..62ebf5262e 100644 --- a/vm/vm_bench/factorization_reikna/src/settings.rs +++ b/vm/vm_bench/factorization_reikna/src/settings.rs @@ -1 +1 @@ -pub const NUMBER : u64 = 9223372036854775807/1000000000; +pub const NUMBER : &'static str = env!("NUMBER"); From 4b188a2397cecbc4c4c310bee84cd1e6daa71183 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 16:04:56 +0300 Subject: [PATCH 12/48] rename bench_test to main because of wasmer doesn't support other function names --- vm/vm_bench/factorization_reikna/src/lib.rs | 2 +- vm/vm_bench/fibonacci_bigint/src/lib.rs | 2 +- vm/vm_bench/matrix_product/src/lib.rs | 2 +- vm/vm_bench/matrix_qr_decompostion/src/lib.rs | 2 +- vm/vm_bench/matrix_svd_decomposition/src/lib.rs | 2 +- vm/vm_bench/recursive_hash/src/settings.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vm/vm_bench/factorization_reikna/src/lib.rs b/vm/vm_bench/factorization_reikna/src/lib.rs index 0fdd86c4ef..d88db09c88 100644 --- a/vm/vm_bench/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/factorization_reikna/src/lib.rs @@ -5,7 +5,7 @@ use settings::NUMBER; use reikna::prime; #[no_mangle] -pub extern "C" fn bench_test() -> u64 { +pub extern "C" fn main() -> u64 { let number : u32 = NUMBER.parse::().unwrap(); let factors = prime::factorize(number); factors[0] diff --git a/vm/vm_bench/fibonacci_bigint/src/lib.rs b/vm/vm_bench/fibonacci_bigint/src/lib.rs index b6af70aae5..5b5dee3f10 100644 --- a/vm/vm_bench/fibonacci_bigint/src/lib.rs +++ b/vm/vm_bench/fibonacci_bigint/src/lib.rs @@ -16,7 +16,7 @@ fn fib(num: &BigUint) -> BigUint { } #[no_mangle] -pub extern "C" fn bench_test() -> u8 { +pub extern "C" fn main() -> u8 { let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) diff --git a/vm/vm_bench/matrix_product/src/lib.rs b/vm/vm_bench/matrix_product/src/lib.rs index 8e4f146cab..b05de1f906 100644 --- a/vm/vm_bench/matrix_product/src/lib.rs +++ b/vm/vm_bench/matrix_product/src/lib.rs @@ -22,7 +22,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { } #[no_mangle] -pub extern "C" fn bench_test() -> u64 { +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs index 4c09af8460..28a7fa9335 100644 --- a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs +++ b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs @@ -22,7 +22,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { } #[no_mangle] -pub extern "C" fn bench_test() -> u64 { +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs index 7915e97916..8b14872c71 100644 --- a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs +++ b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs @@ -13,7 +13,7 @@ fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { } #[no_mangle] -pub extern "C" fn bench_test() -> u64 { +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/vm/vm_bench/recursive_hash/src/settings.rs b/vm/vm_bench/recursive_hash/src/settings.rs index 1c552b984e..9fe5927ae7 100644 --- a/vm/vm_bench/recursive_hash/src/settings.rs +++ b/vm/vm_bench/recursive_hash/src/settings.rs @@ -1,5 +1,5 @@ // count of recursive sha3 that would be computed pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); -// an initial value for computed hash chain +// the initial value for computed hash chain pub const INITIAL_VALUE: &'static str = env!("INITIAL_VALUE"); From 9465e89656d3376a48db6d1d4281ca3c31f55a1a Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 16:06:22 +0300 Subject: [PATCH 13/48] a little fix of cycle in recursive_hash test --- vm/vm_bench/recursive_hash/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/recursive_hash/src/lib.rs index eeb28d7e1a..4490cea363 100644 --- a/vm/vm_bench/recursive_hash/src/lib.rs +++ b/vm/vm_bench/recursive_hash/src/lib.rs @@ -13,7 +13,7 @@ pub extern "C" fn main() -> u8 { let seed_as_byte_array: [u8; mem::size_of::()] = unsafe { mem::transmute(initial_value.to_le()) }; let mut hash_result = Sha3_256::digest(&seed_as_byte_array); - for _ in 0..iterations_count { + for _ in 1..iterations_count { hash_result = Sha3_256::digest(&hash_result); } From 08443b80dee2996e36a42a82d04c4273d13e7cd7 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 16:15:28 +0300 Subject: [PATCH 14/48] add some comments --- vm/vm_bench/factorization_reikna/src/lib.rs | 2 ++ vm/vm_bench/matrix_product/src/lib.rs | 9 ++++++--- vm/vm_bench/matrix_qr_decompostion/src/lib.rs | 7 +++++-- vm/vm_bench/matrix_svd_decomposition/src/lib.rs | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/vm/vm_bench/factorization_reikna/src/lib.rs b/vm/vm_bench/factorization_reikna/src/lib.rs index d88db09c88..b7e8eb6257 100644 --- a/vm/vm_bench/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/factorization_reikna/src/lib.rs @@ -7,6 +7,8 @@ use reikna::prime; #[no_mangle] pub extern "C" fn main() -> u64 { let number : u32 = NUMBER.parse::().unwrap(); + // reikna uses Atkin or Eratosthenes seive to factorize given number let factors = prime::factorize(number); + factors[0] } diff --git a/vm/vm_bench/matrix_product/src/lib.rs b/vm/vm_bench/matrix_product/src/lib.rs index b05de1f906..6384dd2783 100644 --- a/vm/vm_bench/matrix_product/src/lib.rs +++ b/vm/vm_bench/matrix_product/src/lib.rs @@ -7,13 +7,16 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) } +// computes hash of a matrix as its trace fn compute_matrix_hash(matrix: &Matrix) -> u64 { let mut trace : u64 = 0; + + // it is assumed that matrix is squared for i in 0..matrix.ncols() { trace += matrix[(i,i)] } @@ -29,9 +32,9 @@ pub extern "C" fn main() -> u64 { let mut matrix_hash : u64 = seed; for _ in 1..iterations_count { - let matrix_a = create_matrix(matrix_size, matrix_size, matrix_hash); + let matrix_a = generate_random_matrix(matrix_size, matrix_size, matrix_hash); matrix_hash = compute_matrix_hash(&matrix_a); - let matrix_b = create_matrix(matrix_size, matrix_size, matrix_hash); + let matrix_b = generate_random_matrix(matrix_size, matrix_size, matrix_hash); let matrix_c = matrix_a * matrix_b; matrix_hash = compute_matrix_hash(&matrix_c); diff --git a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs index 28a7fa9335..c851336894 100644 --- a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs +++ b/vm/vm_bench/matrix_qr_decompostion/src/lib.rs @@ -7,13 +7,16 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } +// computes hash of a matrix as its trace fn compute_matrix_hash(matrix: &Matrix) -> f64 { let mut trace : f64 = 0.0; + + // it is assumed that matrix is squared for i in 0..matrix.ncols() { trace += matrix[(i,i)] } @@ -29,7 +32,7 @@ pub extern "C" fn main() -> u64 { let mut matrix_hash : u64 = seed; for _ in 1..iterations_count { - let matrix = create_matrix(matrix_size, matrix_size, matrix_hash); + let matrix = generate_random_matrix(matrix_size, matrix_size, matrix_hash); let qr = matrix.qr(); matrix_hash = compute_matrix_hash(&qr.r()).to_bits(); } diff --git a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs index 8b14872c71..a816ba0aef 100644 --- a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs +++ b/vm/vm_bench/matrix_svd_decomposition/src/lib.rs @@ -7,7 +7,7 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -fn create_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } @@ -20,7 +20,7 @@ pub extern "C" fn main() -> u64 { let mut matrix_hash : u64 = seed; for _ in 1..iterations_count { - let matrix = create_matrix(matrix_size, matrix_size, matrix_hash); + let matrix = generate_random_matrix(matrix_size, matrix_size, matrix_hash); let svd = matrix.svd(true, true); matrix_hash = svd.singular_values.iter().fold(0u64, |x1, x2| x1 ^ x2.to_bits()); } From e10c04c69c31ad50edd3a79552f4ed4366f65122 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 27 Nov 2018 19:49:57 +0300 Subject: [PATCH 15/48] add deflate test --- vm/vm_bench/deflate_compression/Cargo.toml | 12 ++++++ vm/vm_bench/deflate_compression/src/lib.rs | 41 +++++++++++++++++++ .../deflate_compression/src/settings.rs | 8 ++++ 3 files changed, 61 insertions(+) create mode 100644 vm/vm_bench/deflate_compression/Cargo.toml create mode 100644 vm/vm_bench/deflate_compression/src/lib.rs create mode 100644 vm/vm_bench/deflate_compression/src/settings.rs diff --git a/vm/vm_bench/deflate_compression/Cargo.toml b/vm/vm_bench/deflate_compression/Cargo.toml new file mode 100644 index 0000000000..b215271adf --- /dev/null +++ b/vm/vm_bench/deflate_compression/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "snappy_compression_bench" +version = "0.1.0" +authors = ["M. Voronov "] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +deflate = "0.7.19" +rand = "0.6.1" +rand_isaac = "0.1.0" diff --git a/vm/vm_bench/deflate_compression/src/lib.rs b/vm/vm_bench/deflate_compression/src/lib.rs new file mode 100644 index 0000000000..e6156fda3d --- /dev/null +++ b/vm/vm_bench/deflate_compression/src/lib.rs @@ -0,0 +1,41 @@ +mod settings; + +extern crate deflate; +extern crate rand; +extern crate rand_isaac; + +use settings::{SEED, ITERATIONS_COUNT, SEQUENCE_SIZE}; +use rand::{Rng, SeedableRng}; +use rand_isaac::IsaacRng; +use deflate::deflate_bytes; + +type Sequence = Vec; + +fn generate_sequence(seed : u64, size : u64) -> Sequence { + let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + let mut result_sequence = Sequence::with_capacity(size as usize); + + for _ in 0..size { + result_sequence.push(rng.gen::()); + } + result_sequence +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + let seed : u64 = SEED.parse::().unwrap(); + let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); + let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); + + let mut sequence = generate_sequence(seed, sequence_size); + let mut compressed_sequence = deflate_bytes(&sequence); + + for _ in 1..iterations_count { + let new_seed = compressed_sequence.len() + + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; + sequence = generate_sequence(new_seed as u64, sequence_size); + compressed_sequence = deflate_bytes(&sequence); + } + + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 +} diff --git a/vm/vm_bench/deflate_compression/src/settings.rs b/vm/vm_bench/deflate_compression/src/settings.rs new file mode 100644 index 0000000000..677885e1d2 --- /dev/null +++ b/vm/vm_bench/deflate_compression/src/settings.rs @@ -0,0 +1,8 @@ +// this values is used as a seed to pseudo-random generator for sequence generation +pub const SEED : &'static str = env!("SEED"); + +// count of test iterations +pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); + +// size of sequence that should be compressed in each iteration +pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); From 617c98f4aed23eaf67c5c9b432a8056f02211615 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 29 Nov 2018 08:11:56 +0300 Subject: [PATCH 16/48] add bencher --- vm/vm_bench/README.md | 0 vm/vm_bench/bencher/BenchTestGenerator.py | 117 ++++++++++++++++++ vm/vm_bench/bencher/VMDescriptor.py | 6 + vm/vm_bench/bencher/WasmVMBencher.py | 50 ++++++++ vm/vm_bench/bencher/main.py | 39 ++++++ vm/vm_bench/bencher/settings.py | 34 +++++ .../deflate_compression/Cargo.toml | 2 +- .../deflate_compression/src/lib.rs | 0 .../deflate_compression/src/settings.rs | 0 .../factorization_reikna/Cargo.toml | 2 +- .../factorization_reikna/src/lib.rs | 0 .../factorization_reikna/src/settings.rs | 0 .../{ => tests}/fibonacci_bigint/Cargo.toml | 2 +- .../{ => tests}/fibonacci_bigint/src/lib.rs | 0 .../fibonacci_bigint/src/settings.rs | 0 .../{ => tests}/matrix_product/Cargo.toml | 2 +- .../{ => tests}/matrix_product/src/lib.rs | 0 .../matrix_product/src/settings.rs | 0 .../matrix_qr_decomposition}/Cargo.toml | 2 +- .../matrix_qr_decomposition}/src/lib.rs | 0 .../matrix_qr_decomposition}/src/settings.rs | 0 .../matrix_svd_decomposition/Cargo.toml | 2 +- .../matrix_svd_decomposition/src/lib.rs | 0 .../matrix_svd_decomposition/src/settings.rs | 0 .../{ => tests}/recursive_hash/Cargo.toml | 2 +- .../{ => tests}/recursive_hash/src/lib.rs | 0 .../recursive_hash/src/settings.rs | 0 .../{ => tests}/snappy_compression/Cargo.toml | 2 +- .../{ => tests}/snappy_compression/src/lib.rs | 0 .../snappy_compression/src/settings.rs | 0 30 files changed, 254 insertions(+), 8 deletions(-) create mode 100644 vm/vm_bench/README.md create mode 100644 vm/vm_bench/bencher/BenchTestGenerator.py create mode 100644 vm/vm_bench/bencher/VMDescriptor.py create mode 100644 vm/vm_bench/bencher/WasmVMBencher.py create mode 100644 vm/vm_bench/bencher/main.py create mode 100644 vm/vm_bench/bencher/settings.py rename vm/vm_bench/{ => tests}/deflate_compression/Cargo.toml (83%) rename vm/vm_bench/{ => tests}/deflate_compression/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/deflate_compression/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/factorization_reikna/Cargo.toml (79%) rename vm/vm_bench/{ => tests}/factorization_reikna/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/factorization_reikna/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/fibonacci_bigint/Cargo.toml (83%) rename vm/vm_bench/{ => tests}/fibonacci_bigint/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/fibonacci_bigint/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/matrix_product/Cargo.toml (87%) rename vm/vm_bench/{ => tests}/matrix_product/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/matrix_product/src/settings.rs (100%) rename vm/vm_bench/{matrix_qr_decompostion => tests/matrix_qr_decomposition}/Cargo.toml (84%) rename vm/vm_bench/{matrix_qr_decompostion => tests/matrix_qr_decomposition}/src/lib.rs (100%) rename vm/vm_bench/{matrix_qr_decompostion => tests/matrix_qr_decomposition}/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/matrix_svd_decomposition/Cargo.toml (84%) rename vm/vm_bench/{ => tests}/matrix_svd_decomposition/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/matrix_svd_decomposition/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/recursive_hash/Cargo.toml (82%) rename vm/vm_bench/{ => tests}/recursive_hash/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/recursive_hash/src/settings.rs (100%) rename vm/vm_bench/{ => tests}/snappy_compression/Cargo.toml (83%) rename vm/vm_bench/{ => tests}/snappy_compression/src/lib.rs (100%) rename vm/vm_bench/{ => tests}/snappy_compression/src/settings.rs (100%) diff --git a/vm/vm_bench/README.md b/vm/vm_bench/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vm/vm_bench/bencher/BenchTestGenerator.py b/vm/vm_bench/bencher/BenchTestGenerator.py new file mode 100644 index 0000000000..969102d263 --- /dev/null +++ b/vm/vm_bench/bencher/BenchTestGenerator.py @@ -0,0 +1,117 @@ +from os.path import join +from settings import * +from subprocess import call + + +class BenchTestGenerator: + + def __init__(self, test_dir): + self.tests_dir = test_dir + self.generated_tests_dir = "bench_tests" + self.rename_cmd = "" + + # compiles test with chosen parameters + def generate_tests(self, out_dir): + snappy_full_path = join(self.tests_dir, snappy_compression_test_name) + deflate_full_path = join(self.tests_dir, deflate_compression_test_name) + fibonacci_full_path = join(self.tests_dir, fibonacci_bigint_test_name) + hash_full_path = join(self.tests_dir, recursive_hash_test_name) + factorization_full_path = join(self.tests_dir, factorization_test_name) + product_full_path = join(self.tests_dir, matrix_product_test_name) + qr_full_path = join(self.tests_dir, qr_decompostion_test_name) + svd_full_path = join(self.tests_dir, svd_decompostion_test_name) + + call("mkdir {}".format(join(out_dir,self.generated_tests_dir)),shell=True) + + self.rename_cmd = "mv " + join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm") + " " \ + + join(out_dir, self.generated_tests_dir, "{}.wasm") + + generated_test_paths = [] + + # compressions tests are generated both for a small sequence with a lot of iterations + # and for a huge sequence with a few iterations + generated_test_paths.append(self.__compile_compression_test(5, 1000000, 1024, snappy_full_path, out_dir, + snappy_compression_test_name)) + generated_test_paths.append(self.__compile_compression_test(5, 1000, 10*1024*1024, snappy_full_path, out_dir, + snappy_compression_test_name)) + + generated_test_paths.append(self.__compile_compression_test(5, 1000000, 1024, deflate_full_path, out_dir, + deflate_compression_test_name)) + generated_test_paths.append(self.__compile_compression_test(5, 1000, 10*1024*1024, deflate_full_path, out_dir, + deflate_compression_test_name)) + + generated_test_paths.append(self.__compile_fibonacci_test(47, fibonacci_full_path, out_dir)) + + generated_test_paths.append(self.__compile_hash_test(1000000, 0, hash_full_path, out_dir)) + + generated_test_paths.append(self.__compile_factorization_test(1000000, factorization_full_path, out_dir)) + + # matrix tests are generated both for a small matrix with a lot of iterations + # and for a huge matrix with a few iterations + generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, product_full_path, out_dir, + matrix_product_test_name)) + generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, product_full_path, out_dir, + matrix_product_test_name)) + + generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, qr_full_path, out_dir, + qr_decompostion_test_name)) + generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, qr_full_path, out_dir, + qr_decompostion_test_name)) + + generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, svd_full_path, out_dir, + svd_decompostion_test_name)) + generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, svd_full_path, out_dir, + svd_decompostion_test_name)) + + # collect garbage + call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) + call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) + + return generated_test_paths + + def __compile_compression_test(self, seed, iterations_count, sequence_size, test_full_path, out_dir, + compression_test_name): + compression_compile_string = "SEED={} ITERATIONS_COUNT={} SEQUENCE_SIZE={} cargo build --manifest-path {}/Cargo.toml " \ + "--target-dir {} --release --target wasm32-unknown-unknown" + call(compression_compile_string.format(seed, iterations_count, sequence_size, test_full_path, out_dir), + shell=True) + + test_name = f"{compression_test_name}_{seed}_{iterations_count}_{sequence_size}" + call(self.rename_cmd.format(compression_test_name, test_name), shell=True) + return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" + + def __compile_fibonacci_test(self, fib_number, test_full_path, out_dir): + fibonacci_compile_string = "FIB_NUMBER={} cargo build --manifest-path {}/Cargo.toml " \ + "--target-dir {} --release --target wasm32-unknown-unknown" + call(fibonacci_compile_string.format(fib_number, test_full_path, out_dir), shell=True) + + test_name = f"{fibonacci_bigint_test_name}_{fib_number}" + call(self.rename_cmd.format(fibonacci_bigint_test_name, test_name), shell=True) + return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" + + def __compile_factorization_test(self, factorized_number, test_full_path, out_dir): + factorization_compile_string = "FACTORIZED_NUMBER={} cargo build --manifest-path {}/Cargo.toml " \ + "--target-dir {} --release --target wasm32-unknown-unknown" + call(factorization_compile_string.format(factorized_number, test_full_path, out_dir), shell=True) + + test_name = f"{fibonacci_bigint_test_name}_{factorized_number}" + call(self.rename_cmd.format(factorization_test_name, test_name), shell=True) + return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" + + def __compile_hash_test(self, iterations_count, initial_value, test_full_path, out_dir): + hash_compile_string = "ITERATIONS_COUNT={} INITIAL_VALUE={} cargo build --manifest-path {}/Cargo.toml " \ + "--target-dir {} --release --target wasm32-unknown-unknown" + call(hash_compile_string.format(iterations_count, initial_value, test_full_path, out_dir), shell=True) + + test_name = f"{recursive_hash_test_name}_{iterations_count}_{initial_value}" + call(self.rename_cmd.format(recursive_hash_test_name, test_name), shell=True) + return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" + + def __compile_matrix_test(self, seed, matrix_size, iterations_count, test_full_path, out_dir, matrix_test_name): + matrix_compile_string = "SEED={} MATRIX_SIZE={} ITERATIONS_COUNT={} cargo build --manifest-path {}/Cargo.toml " \ + "--target-dir {} --release --target wasm32-unknown-unknown" + call(matrix_compile_string.format(seed, matrix_size, iterations_count, test_full_path, out_dir), shell=True) + + test_name = f"{matrix_test_name}_{seed}_{matrix_size}_{iterations_count}" + call(self.rename_cmd.format(matrix_test_name, test_name), shell=True) + return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" diff --git a/vm/vm_bench/bencher/VMDescriptor.py b/vm/vm_bench/bencher/VMDescriptor.py new file mode 100644 index 0000000000..de7d155f88 --- /dev/null +++ b/vm/vm_bench/bencher/VMDescriptor.py @@ -0,0 +1,6 @@ +class VMDescriptor: + def __init__(self, vm_name="", relative_vm_binary_path="", arg_str="", is_compiler_type=True): + self.vm_name = vm_name + self.relative_vm_binary_path = relative_vm_binary_path + self.arg_str = arg_str + self.is_compiler_type = is_compiler_type diff --git a/vm/vm_bench/bencher/WasmVMBencher.py b/vm/vm_bench/bencher/WasmVMBencher.py new file mode 100644 index 0000000000..1f75e3db47 --- /dev/null +++ b/vm/vm_bench/bencher/WasmVMBencher.py @@ -0,0 +1,50 @@ +from settings import interpretator_launch_count, compiler_launch_count, test_function_name + +from os import listdir +from os.path import join +from time import time +from subprocess import Popen +from collections import defaultdict + + +class Record: + def __init__(self, time=0, cpuLoad=0): + self.time = time + self.cpuLoad = cpuLoad # TODO + + +class WasmVMBencher: + + def __init__(self, vm_dir): + self.vm_dir = vm_dir + self.enabled_vm = listdir(vm_dir) + + def run_tests(self, tests_path, vm_descriptors): + # {{[]}} + results = defaultdict(lambda: defaultdict(list)) + + for test_path in tests_path: + print(": launch test", test_path) + for vm in self.enabled_vm: + if vm not in vm_descriptors: + pass + + vm_binary_full_path = join(self.vm_dir, vm, vm_descriptors[vm].relative_vm_binary_path) + cmd = vm_binary_full_path + " " + vm_descriptors[vm].arg_str.format(wasm_file_path=test_path, + function_name=test_function_name) + + launch_count = compiler_launch_count if vm_descriptors[vm].is_compiler_type \ + else interpretator_launch_count + for _ in range(launch_count): + print(": launch cmd", cmd) + result_record = self.__do_one_test(cmd) + results[vm][test_path].append(result_record) + print(": result collected: time={}".format(result_record.time)) + + return results + + def __do_one_test(self, vm_cmd): + start_time = time() + Popen(vm_cmd, shell=True).wait(None) + end_time = time() + return Record(end_time - start_time) diff --git a/vm/vm_bench/bencher/main.py b/vm/vm_bench/bencher/main.py new file mode 100644 index 0000000000..c347603ee5 --- /dev/null +++ b/vm/vm_bench/bencher/main.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +from BenchTestGenerator import BenchTestGenerator +from WasmVMBencher import WasmVMBencher +from settings import vm_descriptors +import click +import csv + + +def save_test_results(results): + for vm in results: + with open(vm + ".csv", 'w', newline='') as vm_file: + fieldnames = ['test_path', 'elapsed_time'] + writer = csv.DictWriter(vm_file, fieldnames=fieldnames) + writer.writeheader() + + for test_path, result_descriptor in results[vm].iteritems(): + writer.writerow({"test_path" : test_path, "elapsed_time" : result_descriptor.time}) + + +@click.command() +@click.option("--vm_dir", help="directory with Webassembly virtual machines") +@click.option("--tests_dir", help="directory with benchmark tests") +@click.option("--out_dir", help="directory where results will be saved") +def main(vm_dir, tests_dir, out_dir): + print(": starting tests generation") + test_generator = BenchTestGenerator(tests_dir) + tests_path = test_generator.generate_tests(out_dir) + + print(": starting vm launching") + vm_bencher = WasmVMBencher(vm_dir) + test_results = vm_bencher.run_tests(tests_path, vm_descriptors) + + print(": starting tests result collection") + save_test_results(test_results) + + +if __name__ == '__main__': + main() diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py new file mode 100644 index 0000000000..893686743c --- /dev/null +++ b/vm/vm_bench/bencher/settings.py @@ -0,0 +1,34 @@ +from VMDescriptor import VMDescriptor +from os.path import join + +# paths of Wasm VMs root directories +vm_descriptors = { + "wavm" : VMDescriptor("wavm", join("build_", "bin", "wavm-run"), + "{wasm_file_path} -f {function_name}", True), + "life" : VMDescriptor("life", join("life"), "entry '{function_name}' {wasm_file_path}", False), + "wasmi" : VMDescriptor("wasmi", join("target", "release", "examples", "invoke"), + "{function_name} {wasm_file_path}", False), + "wasmer" : VMDescriptor("wasmer", join("target", "release", "wasmer"), "run {wasm_file_path}", True), + "wagon" : VMDescriptor("wagon", "", "", False), + "asmble" : VMDescriptor("asmble", join("asmble", "bin", "asmble"), + "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) +} + +# launch count of interpretator-based VMs +interpretator_launch_count = 0 + +# launch count of compiler-based VMs +compiler_launch_count = 1 + +# export function name that should be called from Wasm module +test_function_name = "main" + +# paths of benchmark tests +snappy_compression_test_name = "snappy_compression" +deflate_compression_test_name = "deflate_compression" +fibonacci_bigint_test_name = "fibonacci_bigint" +factorization_test_name = "factorization_reikna" +recursive_hash_test_name = "recursive_hash" +matrix_product_test_name = "matrix_product" +qr_decompostion_test_name = "matrix_qr_decomposition" +svd_decompostion_test_name = "matrix_svd_decomposition" diff --git a/vm/vm_bench/deflate_compression/Cargo.toml b/vm/vm_bench/tests/deflate_compression/Cargo.toml similarity index 83% rename from vm/vm_bench/deflate_compression/Cargo.toml rename to vm/vm_bench/tests/deflate_compression/Cargo.toml index b215271adf..a3ab0571f3 100644 --- a/vm/vm_bench/deflate_compression/Cargo.toml +++ b/vm/vm_bench/tests/deflate_compression/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snappy_compression_bench" +name = "snappy_compression" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/deflate_compression/src/lib.rs b/vm/vm_bench/tests/deflate_compression/src/lib.rs similarity index 100% rename from vm/vm_bench/deflate_compression/src/lib.rs rename to vm/vm_bench/tests/deflate_compression/src/lib.rs diff --git a/vm/vm_bench/deflate_compression/src/settings.rs b/vm/vm_bench/tests/deflate_compression/src/settings.rs similarity index 100% rename from vm/vm_bench/deflate_compression/src/settings.rs rename to vm/vm_bench/tests/deflate_compression/src/settings.rs diff --git a/vm/vm_bench/factorization_reikna/Cargo.toml b/vm/vm_bench/tests/factorization_reikna/Cargo.toml similarity index 79% rename from vm/vm_bench/factorization_reikna/Cargo.toml rename to vm/vm_bench/tests/factorization_reikna/Cargo.toml index 85f5dced55..fc49f1aa07 100644 --- a/vm/vm_bench/factorization_reikna/Cargo.toml +++ b/vm/vm_bench/tests/factorization_reikna/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "factorization_reikna_bench" +name = "factorization_reikna" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/factorization_reikna/src/lib.rs b/vm/vm_bench/tests/factorization_reikna/src/lib.rs similarity index 100% rename from vm/vm_bench/factorization_reikna/src/lib.rs rename to vm/vm_bench/tests/factorization_reikna/src/lib.rs diff --git a/vm/vm_bench/factorization_reikna/src/settings.rs b/vm/vm_bench/tests/factorization_reikna/src/settings.rs similarity index 100% rename from vm/vm_bench/factorization_reikna/src/settings.rs rename to vm/vm_bench/tests/factorization_reikna/src/settings.rs diff --git a/vm/vm_bench/fibonacci_bigint/Cargo.toml b/vm/vm_bench/tests/fibonacci_bigint/Cargo.toml similarity index 83% rename from vm/vm_bench/fibonacci_bigint/Cargo.toml rename to vm/vm_bench/tests/fibonacci_bigint/Cargo.toml index aaa58b3371..35b430a3d6 100644 --- a/vm/vm_bench/fibonacci_bigint/Cargo.toml +++ b/vm/vm_bench/tests/fibonacci_bigint/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fibonacci_bigint_bench" +name = "fibonacci_bigint" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/fibonacci_bigint/src/lib.rs b/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs similarity index 100% rename from vm/vm_bench/fibonacci_bigint/src/lib.rs rename to vm/vm_bench/tests/fibonacci_bigint/src/lib.rs diff --git a/vm/vm_bench/fibonacci_bigint/src/settings.rs b/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs similarity index 100% rename from vm/vm_bench/fibonacci_bigint/src/settings.rs rename to vm/vm_bench/tests/fibonacci_bigint/src/settings.rs diff --git a/vm/vm_bench/matrix_product/Cargo.toml b/vm/vm_bench/tests/matrix_product/Cargo.toml similarity index 87% rename from vm/vm_bench/matrix_product/Cargo.toml rename to vm/vm_bench/tests/matrix_product/Cargo.toml index e96c5139d6..2422b1415f 100644 --- a/vm/vm_bench/matrix_product/Cargo.toml +++ b/vm/vm_bench/tests/matrix_product/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "matrix_product_bench" +name = "matrix_product" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/matrix_product/src/lib.rs b/vm/vm_bench/tests/matrix_product/src/lib.rs similarity index 100% rename from vm/vm_bench/matrix_product/src/lib.rs rename to vm/vm_bench/tests/matrix_product/src/lib.rs diff --git a/vm/vm_bench/matrix_product/src/settings.rs b/vm/vm_bench/tests/matrix_product/src/settings.rs similarity index 100% rename from vm/vm_bench/matrix_product/src/settings.rs rename to vm/vm_bench/tests/matrix_product/src/settings.rs diff --git a/vm/vm_bench/matrix_qr_decompostion/Cargo.toml b/vm/vm_bench/tests/matrix_qr_decomposition/Cargo.toml similarity index 84% rename from vm/vm_bench/matrix_qr_decompostion/Cargo.toml rename to vm/vm_bench/tests/matrix_qr_decomposition/Cargo.toml index 7dab7ef804..4142c17c9d 100644 --- a/vm/vm_bench/matrix_qr_decompostion/Cargo.toml +++ b/vm/vm_bench/tests/matrix_qr_decomposition/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "matrix_qr_decomposition_bench" +name = "matrix_qr_decomposition" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/matrix_qr_decompostion/src/lib.rs b/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs similarity index 100% rename from vm/vm_bench/matrix_qr_decompostion/src/lib.rs rename to vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs diff --git a/vm/vm_bench/matrix_qr_decompostion/src/settings.rs b/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs similarity index 100% rename from vm/vm_bench/matrix_qr_decompostion/src/settings.rs rename to vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs diff --git a/vm/vm_bench/matrix_svd_decomposition/Cargo.toml b/vm/vm_bench/tests/matrix_svd_decomposition/Cargo.toml similarity index 84% rename from vm/vm_bench/matrix_svd_decomposition/Cargo.toml rename to vm/vm_bench/tests/matrix_svd_decomposition/Cargo.toml index 37fd72af52..bc18c35e97 100644 --- a/vm/vm_bench/matrix_svd_decomposition/Cargo.toml +++ b/vm/vm_bench/tests/matrix_svd_decomposition/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "matrix_svd_decomposition_bench" +name = "matrix_svd_decomposition" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs similarity index 100% rename from vm/vm_bench/matrix_svd_decomposition/src/lib.rs rename to vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs diff --git a/vm/vm_bench/matrix_svd_decomposition/src/settings.rs b/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs similarity index 100% rename from vm/vm_bench/matrix_svd_decomposition/src/settings.rs rename to vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs diff --git a/vm/vm_bench/recursive_hash/Cargo.toml b/vm/vm_bench/tests/recursive_hash/Cargo.toml similarity index 82% rename from vm/vm_bench/recursive_hash/Cargo.toml rename to vm/vm_bench/tests/recursive_hash/Cargo.toml index f5ea138f85..6801a1225e 100644 --- a/vm/vm_bench/recursive_hash/Cargo.toml +++ b/vm/vm_bench/tests/recursive_hash/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "recursive_hash_bench" +name = "recursive_hash" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/recursive_hash/src/lib.rs b/vm/vm_bench/tests/recursive_hash/src/lib.rs similarity index 100% rename from vm/vm_bench/recursive_hash/src/lib.rs rename to vm/vm_bench/tests/recursive_hash/src/lib.rs diff --git a/vm/vm_bench/recursive_hash/src/settings.rs b/vm/vm_bench/tests/recursive_hash/src/settings.rs similarity index 100% rename from vm/vm_bench/recursive_hash/src/settings.rs rename to vm/vm_bench/tests/recursive_hash/src/settings.rs diff --git a/vm/vm_bench/snappy_compression/Cargo.toml b/vm/vm_bench/tests/snappy_compression/Cargo.toml similarity index 83% rename from vm/vm_bench/snappy_compression/Cargo.toml rename to vm/vm_bench/tests/snappy_compression/Cargo.toml index b750cecbf3..6af12da206 100644 --- a/vm/vm_bench/snappy_compression/Cargo.toml +++ b/vm/vm_bench/tests/snappy_compression/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snappy_compression_bench" +name = "snappy_compression" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/snappy_compression/src/lib.rs b/vm/vm_bench/tests/snappy_compression/src/lib.rs similarity index 100% rename from vm/vm_bench/snappy_compression/src/lib.rs rename to vm/vm_bench/tests/snappy_compression/src/lib.rs diff --git a/vm/vm_bench/snappy_compression/src/settings.rs b/vm/vm_bench/tests/snappy_compression/src/settings.rs similarity index 100% rename from vm/vm_bench/snappy_compression/src/settings.rs rename to vm/vm_bench/tests/snappy_compression/src/settings.rs From 96741c7ba96593444075f8e206cb0d308356eab8 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 29 Nov 2018 10:27:10 +0300 Subject: [PATCH 17/48] a little refactoring --- vm/vm_bench/bencher/BenchTestGenerator.py | 108 +++-------------- vm/vm_bench/bencher/TestDescriptor.py | 6 + vm/vm_bench/bencher/VMDescriptor.py | 3 +- vm/vm_bench/bencher/WasmVMBencher.py | 13 ++- vm/vm_bench/bencher/main.py | 14 +-- vm/vm_bench/bencher/settings.py | 110 +++++++++++++++--- .../tests/deflate_compression/Cargo.toml | 2 +- .../tests/factorization_reikna/src/lib.rs | 6 +- .../factorization_reikna/src/settings.rs | 2 +- 9 files changed, 135 insertions(+), 129 deletions(-) create mode 100644 vm/vm_bench/bencher/TestDescriptor.py diff --git a/vm/vm_bench/bencher/BenchTestGenerator.py b/vm/vm_bench/bencher/BenchTestGenerator.py index 969102d263..8d818181fa 100644 --- a/vm/vm_bench/bencher/BenchTestGenerator.py +++ b/vm/vm_bench/bencher/BenchTestGenerator.py @@ -11,107 +11,25 @@ def __init__(self, test_dir): self.rename_cmd = "" # compiles test with chosen parameters - def generate_tests(self, out_dir): - snappy_full_path = join(self.tests_dir, snappy_compression_test_name) - deflate_full_path = join(self.tests_dir, deflate_compression_test_name) - fibonacci_full_path = join(self.tests_dir, fibonacci_bigint_test_name) - hash_full_path = join(self.tests_dir, recursive_hash_test_name) - factorization_full_path = join(self.tests_dir, factorization_test_name) - product_full_path = join(self.tests_dir, matrix_product_test_name) - qr_full_path = join(self.tests_dir, qr_decompostion_test_name) - svd_full_path = join(self.tests_dir, svd_decompostion_test_name) - + def generate_tests(self, out_dir, test_descriptors): call("mkdir {}".format(join(out_dir,self.generated_tests_dir)),shell=True) + generated_tests_dir_full_path = join(out_dir, self.generated_tests_dir) + test_mv_cmd = "mv " + join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm") + " " \ + + join(generated_tests_dir_full_path, "{}.wasm") - self.rename_cmd = "mv " + join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm") + " " \ - + join(out_dir, self.generated_tests_dir, "{}.wasm") - - generated_test_paths = [] - - # compressions tests are generated both for a small sequence with a lot of iterations - # and for a huge sequence with a few iterations - generated_test_paths.append(self.__compile_compression_test(5, 1000000, 1024, snappy_full_path, out_dir, - snappy_compression_test_name)) - generated_test_paths.append(self.__compile_compression_test(5, 1000, 10*1024*1024, snappy_full_path, out_dir, - snappy_compression_test_name)) - - generated_test_paths.append(self.__compile_compression_test(5, 1000000, 1024, deflate_full_path, out_dir, - deflate_compression_test_name)) - generated_test_paths.append(self.__compile_compression_test(5, 1000, 10*1024*1024, deflate_full_path, out_dir, - deflate_compression_test_name)) - - generated_test_paths.append(self.__compile_fibonacci_test(47, fibonacci_full_path, out_dir)) + for test_name, test_descriptor in test_descriptors.items(): + test_full_path = join(self.tests_dir, test_descriptor.test_folder_name) + test_cmd = test_descriptor.test_generator_cmd.format(test_full_path, out_dir) - generated_test_paths.append(self.__compile_hash_test(1000000, 0, hash_full_path, out_dir)) + for key, value in test_descriptor.test_generator_params.items(): + test_cmd = "{}={} {}".format(key, value, test_cmd) - generated_test_paths.append(self.__compile_factorization_test(1000000, factorization_full_path, out_dir)) - - # matrix tests are generated both for a small matrix with a lot of iterations - # and for a huge matrix with a few iterations - generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, product_full_path, out_dir, - matrix_product_test_name)) - generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, product_full_path, out_dir, - matrix_product_test_name)) - - generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, qr_full_path, out_dir, - qr_decompostion_test_name)) - generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, qr_full_path, out_dir, - qr_decompostion_test_name)) - - generated_test_paths.append(self.__compile_matrix_test(1, 10, 1000000, svd_full_path, out_dir, - svd_decompostion_test_name)) - generated_test_paths.append(self.__compile_matrix_test(1, 200, 100, svd_full_path, out_dir, - svd_decompostion_test_name)) + call(test_cmd, shell=True) + call(test_mv_cmd.format(test_descriptor.test_folder_name, test_name), shell=True) + test_descriptors[test_name].test_full_path = join(generated_tests_dir_full_path, "{}.wasm").format(test_name) # collect garbage call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) - return generated_test_paths - - def __compile_compression_test(self, seed, iterations_count, sequence_size, test_full_path, out_dir, - compression_test_name): - compression_compile_string = "SEED={} ITERATIONS_COUNT={} SEQUENCE_SIZE={} cargo build --manifest-path {}/Cargo.toml " \ - "--target-dir {} --release --target wasm32-unknown-unknown" - call(compression_compile_string.format(seed, iterations_count, sequence_size, test_full_path, out_dir), - shell=True) - - test_name = f"{compression_test_name}_{seed}_{iterations_count}_{sequence_size}" - call(self.rename_cmd.format(compression_test_name, test_name), shell=True) - return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" - - def __compile_fibonacci_test(self, fib_number, test_full_path, out_dir): - fibonacci_compile_string = "FIB_NUMBER={} cargo build --manifest-path {}/Cargo.toml " \ - "--target-dir {} --release --target wasm32-unknown-unknown" - call(fibonacci_compile_string.format(fib_number, test_full_path, out_dir), shell=True) - - test_name = f"{fibonacci_bigint_test_name}_{fib_number}" - call(self.rename_cmd.format(fibonacci_bigint_test_name, test_name), shell=True) - return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" - - def __compile_factorization_test(self, factorized_number, test_full_path, out_dir): - factorization_compile_string = "FACTORIZED_NUMBER={} cargo build --manifest-path {}/Cargo.toml " \ - "--target-dir {} --release --target wasm32-unknown-unknown" - call(factorization_compile_string.format(factorized_number, test_full_path, out_dir), shell=True) - - test_name = f"{fibonacci_bigint_test_name}_{factorized_number}" - call(self.rename_cmd.format(factorization_test_name, test_name), shell=True) - return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" - - def __compile_hash_test(self, iterations_count, initial_value, test_full_path, out_dir): - hash_compile_string = "ITERATIONS_COUNT={} INITIAL_VALUE={} cargo build --manifest-path {}/Cargo.toml " \ - "--target-dir {} --release --target wasm32-unknown-unknown" - call(hash_compile_string.format(iterations_count, initial_value, test_full_path, out_dir), shell=True) - - test_name = f"{recursive_hash_test_name}_{iterations_count}_{initial_value}" - call(self.rename_cmd.format(recursive_hash_test_name, test_name), shell=True) - return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" - - def __compile_matrix_test(self, seed, matrix_size, iterations_count, test_full_path, out_dir, matrix_test_name): - matrix_compile_string = "SEED={} MATRIX_SIZE={} ITERATIONS_COUNT={} cargo build --manifest-path {}/Cargo.toml " \ - "--target-dir {} --release --target wasm32-unknown-unknown" - call(matrix_compile_string.format(seed, matrix_size, iterations_count, test_full_path, out_dir), shell=True) - - test_name = f"{matrix_test_name}_{seed}_{matrix_size}_{iterations_count}" - call(self.rename_cmd.format(matrix_test_name, test_name), shell=True) - return join(out_dir, self.generated_tests_dir, test_name) + ".wasm" + return test_descriptors diff --git a/vm/vm_bench/bencher/TestDescriptor.py b/vm/vm_bench/bencher/TestDescriptor.py new file mode 100644 index 0000000000..cbc22a990b --- /dev/null +++ b/vm/vm_bench/bencher/TestDescriptor.py @@ -0,0 +1,6 @@ +class TestDescriptor: + def __init__(self, test_folder_name="", test_generator_cmd="", test_generator_params={}): + self.test_folder_name = test_folder_name + self.test_generator_cmd = test_generator_cmd + self.test_generator_params = test_generator_params + self.test_full_path = "" diff --git a/vm/vm_bench/bencher/VMDescriptor.py b/vm/vm_bench/bencher/VMDescriptor.py index de7d155f88..429723b009 100644 --- a/vm/vm_bench/bencher/VMDescriptor.py +++ b/vm/vm_bench/bencher/VMDescriptor.py @@ -1,6 +1,5 @@ class VMDescriptor: - def __init__(self, vm_name="", relative_vm_binary_path="", arg_str="", is_compiler_type=True): - self.vm_name = vm_name + def __init__(self, relative_vm_binary_path="", arg_str="", is_compiler_type=True): self.relative_vm_binary_path = relative_vm_binary_path self.arg_str = arg_str self.is_compiler_type = is_compiler_type diff --git a/vm/vm_bench/bencher/WasmVMBencher.py b/vm/vm_bench/bencher/WasmVMBencher.py index 1f75e3db47..131884947b 100644 --- a/vm/vm_bench/bencher/WasmVMBencher.py +++ b/vm/vm_bench/bencher/WasmVMBencher.py @@ -19,26 +19,27 @@ def __init__(self, vm_dir): self.vm_dir = vm_dir self.enabled_vm = listdir(vm_dir) - def run_tests(self, tests_path, vm_descriptors): + def run_tests(self, test_descriptors, vm_descriptors): # {{[]}} results = defaultdict(lambda: defaultdict(list)) - for test_path in tests_path: - print(": launch test", test_path) + for test_name, test_descriptor in test_descriptors.items(): + print(": launch test", test_name) for vm in self.enabled_vm: if vm not in vm_descriptors: pass vm_binary_full_path = join(self.vm_dir, vm, vm_descriptors[vm].relative_vm_binary_path) - cmd = vm_binary_full_path + " " + vm_descriptors[vm].arg_str.format(wasm_file_path=test_path, - function_name=test_function_name) + cmd = vm_binary_full_path + " " \ + + vm_descriptors[vm].arg_str.format(wasm_file_path=test_descriptor.test_full_path, + function_name=test_function_name) launch_count = compiler_launch_count if vm_descriptors[vm].is_compiler_type \ else interpretator_launch_count for _ in range(launch_count): print(": launch cmd", cmd) result_record = self.__do_one_test(cmd) - results[vm][test_path].append(result_record) + results[vm][test_name].append(result_record) print(": result collected: time={}".format(result_record.time)) return results diff --git a/vm/vm_bench/bencher/main.py b/vm/vm_bench/bencher/main.py index c347603ee5..c6d1db6f2d 100644 --- a/vm/vm_bench/bencher/main.py +++ b/vm/vm_bench/bencher/main.py @@ -2,7 +2,7 @@ from BenchTestGenerator import BenchTestGenerator from WasmVMBencher import WasmVMBencher -from settings import vm_descriptors +from settings import vm_descriptors, test_descriptors import click import csv @@ -14,7 +14,7 @@ def save_test_results(results): writer = csv.DictWriter(vm_file, fieldnames=fieldnames) writer.writeheader() - for test_path, result_descriptor in results[vm].iteritems(): + for test_path, result_descriptor in results[vm].items(): writer.writerow({"test_path" : test_path, "elapsed_time" : result_descriptor.time}) @@ -23,15 +23,15 @@ def save_test_results(results): @click.option("--tests_dir", help="directory with benchmark tests") @click.option("--out_dir", help="directory where results will be saved") def main(vm_dir, tests_dir, out_dir): - print(": starting tests generation") + print(": starting generation tests") test_generator = BenchTestGenerator(tests_dir) - tests_path = test_generator.generate_tests(out_dir) + filled_tests_descriptors = test_generator.generate_tests(out_dir, test_descriptors) - print(": starting vm launching") + print(": starting vm tests") vm_bencher = WasmVMBencher(vm_dir) - test_results = vm_bencher.run_tests(tests_path, vm_descriptors) + test_results = vm_bencher.run_tests(filled_tests_descriptors, vm_descriptors) - print(": starting tests result collection") + print(": starting collection of test results") save_test_results(test_results) diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py index 893686743c..e2c67c3ab2 100644 --- a/vm/vm_bench/bencher/settings.py +++ b/vm/vm_bench/bencher/settings.py @@ -1,16 +1,17 @@ from VMDescriptor import VMDescriptor +from TestDescriptor import TestDescriptor from os.path import join # paths of Wasm VMs root directories vm_descriptors = { - "wavm" : VMDescriptor("wavm", join("build_", "bin", "wavm-run"), + "wavm" : VMDescriptor(join("build_", "bin", "wavm-run"), "{wasm_file_path} -f {function_name}", True), - "life" : VMDescriptor("life", join("life"), "entry '{function_name}' {wasm_file_path}", False), - "wasmi" : VMDescriptor("wasmi", join("target", "release", "examples", "invoke"), + "life" : VMDescriptor(join("life"), "entry '{function_name}' {wasm_file_path}", False), + "wasmi" : VMDescriptor(join("target", "release", "examples", "invoke"), "{function_name} {wasm_file_path}", False), - "wasmer" : VMDescriptor("wasmer", join("target", "release", "wasmer"), "run {wasm_file_path}", True), - "wagon" : VMDescriptor("wagon", "", "", False), - "asmble" : VMDescriptor("asmble", join("asmble", "bin", "asmble"), + "wasmer" : VMDescriptor(join("target", "release", "wasmer"), "run {wasm_file_path}", True), + "wagon" : VMDescriptor("", "", False), + "asmble" : VMDescriptor(join("asmble", "bin", "asmble"), "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) } @@ -24,11 +25,92 @@ test_function_name = "main" # paths of benchmark tests -snappy_compression_test_name = "snappy_compression" -deflate_compression_test_name = "deflate_compression" -fibonacci_bigint_test_name = "fibonacci_bigint" -factorization_test_name = "factorization_reikna" -recursive_hash_test_name = "recursive_hash" -matrix_product_test_name = "matrix_product" -qr_decompostion_test_name = "matrix_qr_decomposition" -svd_decompostion_test_name = "matrix_svd_decomposition" +test_descriptors = { + # compressions tests are generated both for a small sequence with a lot of iterations + # and for a huge sequence with a few iterations + "snappy_compression_5_1000000_1Kb" : + TestDescriptor("snappy_compression", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED" : 1, "ITERATIONS_COUNT" : 1000000, "SEQUENCE_SIZE" : 1024}), + + "snappy_compression_5_1000_10Mb" : + TestDescriptor("snappy_compression", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED" : 1, "ITERATIONS_COUNT" : 1000, "SEQUENCE_SIZE" : 10*1024*1024}), + + "deflate_compression_5_100000_1Kb" : + TestDescriptor("deflate_compression", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "ITERATIONS_COUNT": 100000, "SEQUENCE_SIZE": 1024}), + + "deflate_compression_5_10_10Mb" : + TestDescriptor("deflate_compression", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "ITERATIONS_COUNT": 10, "SEQUENCE_SIZE": 10 * 1024 * 1024}), + + "fibonacci_35" : + TestDescriptor("fibonacci_bigint", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"FIB_NUMBER": 35}), + + "fibonacci_42" : + TestDescriptor("fibonacci_bigint", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"FIB_NUMBER": 42}), + + "factorization_2147483647": + TestDescriptor("factorization_reikna", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"FACTORIZED_NUMBER": 2147483647}), + + "recursive_hash_1000000_0": + TestDescriptor("recursive_hash", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"ITERATIONS_COUNT": 1000000, "INITIAL_VALUE" : 0}), + + # matrix tests are generated both for a small matrix with a lot of iterations + # and for a huge matrix with a few iterations + "matrix_product_1_10_1000000": + TestDescriptor("matrix_product", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT" : 1000000}), + + "matrix_product_1_200_100": + TestDescriptor("matrix_product", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}), + + "svd_decomposition_1_10_1000000": + TestDescriptor("matrix_svd_decomposition", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT" : 1000000}), + + "svd_decomposition_1_200_100": + TestDescriptor("matrix_svd_decomposition", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}), + + "qr_decomposition_1_10_1000000": + TestDescriptor("matrix_qr_decomposition", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT": 1000000}), + + "qr_decomposition_1_200_100": + TestDescriptor("matrix_qr_decomposition", + "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " + "--target wasm32-unknown-unknown", + {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}) +} diff --git a/vm/vm_bench/tests/deflate_compression/Cargo.toml b/vm/vm_bench/tests/deflate_compression/Cargo.toml index a3ab0571f3..7a8ff8fc5a 100644 --- a/vm/vm_bench/tests/deflate_compression/Cargo.toml +++ b/vm/vm_bench/tests/deflate_compression/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snappy_compression" +name = "deflate_compression" version = "0.1.0" authors = ["M. Voronov "] diff --git a/vm/vm_bench/tests/factorization_reikna/src/lib.rs b/vm/vm_bench/tests/factorization_reikna/src/lib.rs index b7e8eb6257..3bac65f1e1 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/lib.rs @@ -1,14 +1,14 @@ mod settings; extern crate reikna; -use settings::NUMBER; +use settings::FACTORIZED_NUMBER; use reikna::prime; #[no_mangle] pub extern "C" fn main() -> u64 { - let number : u32 = NUMBER.parse::().unwrap(); + let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); // reikna uses Atkin or Eratosthenes seive to factorize given number - let factors = prime::factorize(number); + let factors = prime::factorize(factorized_number); factors[0] } diff --git a/vm/vm_bench/tests/factorization_reikna/src/settings.rs b/vm/vm_bench/tests/factorization_reikna/src/settings.rs index 62ebf5262e..c1a1317d76 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/settings.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/settings.rs @@ -1 +1 @@ -pub const NUMBER : &'static str = env!("NUMBER"); +pub const FACTORIZED_NUMBER : &'static str = env!("FACTORIZED_NUMBER"); From 9d110819e7133160e3bea4cc17fde3b5d7429994 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 29 Nov 2018 23:10:03 +0300 Subject: [PATCH 18/48] fix some minor bugs --- vm/vm_bench/bencher/WasmVMBencher.py | 3 +- vm/vm_bench/bencher/asmble.csv | 155 +++++++++++++++++++++++++++ vm/vm_bench/bencher/main.py | 5 +- vm/vm_bench/bencher/settings.py | 14 +-- vm/vm_bench/bencher/wasmer.csv | 155 +++++++++++++++++++++++++++ vm/vm_bench/bencher/wavm.csv | 155 +++++++++++++++++++++++++++ vm/vm_bench/wagon_run/wagon_main.go | 119 ++++++++++++++++++++ 7 files changed, 595 insertions(+), 11 deletions(-) create mode 100644 vm/vm_bench/bencher/asmble.csv create mode 100644 vm/vm_bench/bencher/wasmer.csv create mode 100644 vm/vm_bench/bencher/wavm.csv create mode 100644 vm/vm_bench/wagon_run/wagon_main.go diff --git a/vm/vm_bench/bencher/WasmVMBencher.py b/vm/vm_bench/bencher/WasmVMBencher.py index 131884947b..d4e73915be 100644 --- a/vm/vm_bench/bencher/WasmVMBencher.py +++ b/vm/vm_bench/bencher/WasmVMBencher.py @@ -37,10 +37,9 @@ def run_tests(self, test_descriptors, vm_descriptors): launch_count = compiler_launch_count if vm_descriptors[vm].is_compiler_type \ else interpretator_launch_count for _ in range(launch_count): - print(": launch cmd", cmd) result_record = self.__do_one_test(cmd) results[vm][test_name].append(result_record) - print(": result collected: time={}".format(result_record.time)) + print(": {} result collected: time={}".format(vm, result_record.time)) return results diff --git a/vm/vm_bench/bencher/asmble.csv b/vm/vm_bench/bencher/asmble.csv new file mode 100644 index 0000000000..aa07623465 --- /dev/null +++ b/vm/vm_bench/bencher/asmble.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,20.726524829864502 +snappy_compression_5_1000000_1Kb,21.03496503829956 +snappy_compression_5_1000000_1Kb,21.07230019569397 +snappy_compression_5_1000000_1Kb,21.279044151306152 +snappy_compression_5_1000000_1Kb,21.335103034973145 +snappy_compression_5_1000000_1Kb,21.234475135803223 +snappy_compression_5_1000000_1Kb,21.163483142852783 +snappy_compression_5_1000000_1Kb,21.064918994903564 +snappy_compression_5_1000000_1Kb,21.397541761398315 +snappy_compression_5_1000000_1Kb,21.149813890457153 +snappy_compression_5_1000000_1Kb,21.384167194366455 +snappy_compression_5_1000_10Mb,21.38349199295044 +snappy_compression_5_1000_10Mb,21.341899156570435 +snappy_compression_5_1000_10Mb,21.74799609184265 +snappy_compression_5_1000_10Mb,21.621104955673218 +snappy_compression_5_1000_10Mb,21.648022890090942 +snappy_compression_5_1000_10Mb,21.568861961364746 +snappy_compression_5_1000_10Mb,21.62322187423706 +snappy_compression_5_1000_10Mb,21.399152040481567 +snappy_compression_5_1000_10Mb,21.339909076690674 +snappy_compression_5_1000_10Mb,21.609938144683838 +snappy_compression_5_1000_10Mb,21.31721019744873 +deflate_compression_5_100000_1Kb,63.01013803482056 +deflate_compression_5_100000_1Kb,65.04713201522827 +deflate_compression_5_100000_1Kb,62.52873373031616 +deflate_compression_5_100000_1Kb,64.26173305511475 +deflate_compression_5_100000_1Kb,63.06211280822754 +deflate_compression_5_100000_1Kb,62.89547276496887 +deflate_compression_5_100000_1Kb,63.274219036102295 +deflate_compression_5_100000_1Kb,64.65362024307251 +deflate_compression_5_100000_1Kb,64.90634083747864 +deflate_compression_5_100000_1Kb,63.911845207214355 +deflate_compression_5_100000_1Kb,63.30595684051514 +deflate_compression_5_10_10Mb,63.04709720611572 +deflate_compression_5_10_10Mb,64.67240190505981 +deflate_compression_5_10_10Mb,64.5411970615387 +deflate_compression_5_10_10Mb,63.24651789665222 +deflate_compression_5_10_10Mb,62.48751997947693 +deflate_compression_5_10_10Mb,62.9459331035614 +deflate_compression_5_10_10Mb,64.79925513267517 +deflate_compression_5_10_10Mb,64.61253213882446 +deflate_compression_5_10_10Mb,63.227832078933716 +deflate_compression_5_10_10Mb,63.24809384346008 +deflate_compression_5_10_10Mb,64.21979308128357 +fibonacci_42,73.83689188957214 +fibonacci_42,72.73303985595703 +fibonacci_42,72.88571906089783 +fibonacci_42,72.67585396766663 +fibonacci_42,73.15689325332642 +fibonacci_42,73.23700308799744 +fibonacci_42,72.18646597862244 +fibonacci_42,73.53925585746765 +fibonacci_42,71.78964495658875 +fibonacci_42,74.36770486831665 +fibonacci_42,72.80925011634827 +fibonacci_50,72.10168790817261 +fibonacci_50,72.96367406845093 +fibonacci_50,72.70814824104309 +fibonacci_50,72.7207179069519 +fibonacci_50,71.75951981544495 +fibonacci_50,73.24424409866333 +fibonacci_50,72.13987803459167 +fibonacci_50,72.89511013031006 +fibonacci_50,73.10324811935425 +fibonacci_50,73.47930693626404 +fibonacci_50,72.53861975669861 +factorization_2147483647,13.22667384147644 +factorization_2147483647,13.605670928955078 +factorization_2147483647,13.293700218200684 +factorization_2147483647,13.016165018081665 +factorization_2147483647,13.581308841705322 +factorization_2147483647,13.912525177001953 +factorization_2147483647,15.045396089553833 +factorization_2147483647,14.744700908660889 +factorization_2147483647,14.344260931015015 +factorization_2147483647,13.789538621902466 +factorization_2147483647,13.76637887954712 +recursive_hash_10000000_0,17.889079809188843 +recursive_hash_10000000_0,18.56121277809143 +recursive_hash_10000000_0,18.46988868713379 +recursive_hash_10000000_0,21.0805561542511 +recursive_hash_10000000_0,21.279676914215088 +recursive_hash_10000000_0,19.35895299911499 +recursive_hash_10000000_0,19.368671894073486 +recursive_hash_10000000_0,17.923566818237305 +recursive_hash_10000000_0,17.709688901901245 +recursive_hash_10000000_0,17.54594612121582 +recursive_hash_10000000_0,17.478378772735596 +matrix_product_1_10_1000000,28.65305805206299 +matrix_product_1_10_1000000,28.046306133270264 +matrix_product_1_10_1000000,27.974605083465576 +matrix_product_1_10_1000000,28.0353262424469 +matrix_product_1_10_1000000,27.89697289466858 +matrix_product_1_10_1000000,28.20061492919922 +matrix_product_1_10_1000000,27.107964992523193 +matrix_product_1_10_1000000,26.898239135742188 +matrix_product_1_10_1000000,27.024434089660645 +matrix_product_1_10_1000000,26.906163930892944 +matrix_product_1_10_1000000,27.077481985092163 +matrix_product_1_200_100,28.122427225112915 +matrix_product_1_200_100,28.724907159805298 +matrix_product_1_200_100,29.15459108352661 +matrix_product_1_200_100,30.318928003311157 +matrix_product_1_200_100,29.829855918884277 +matrix_product_1_200_100,31.222463130950928 +matrix_product_1_200_100,29.227657318115234 +matrix_product_1_200_100,29.32576084136963 +matrix_product_1_200_100,27.436151027679443 +matrix_product_1_200_100,27.815643072128296 +matrix_product_1_200_100,29.732506275177002 +svd_decomposition_1_10_1000000,756.0404772758484 +svd_decomposition_1_10_1000000,655.4719252586365 +svd_decomposition_1_10_1000000,620.9246027469635 +svd_decomposition_1_10_1000000,630.0120990276337 +svd_decomposition_1_10_1000000,645.4520742893219 +svd_decomposition_1_10_1000000,655.5482919216156 +svd_decomposition_1_10_1000000,680.9745841026306 +svd_decomposition_1_10_1000000,682.4573440551758 +svd_decomposition_1_10_1000000,743.3740720748901 +svd_decomposition_1_10_1000000,721.9925141334534 +svd_decomposition_1_10_1000000,870.8123922348022 +svd_decomposition_1_200_100,629.2256848812103 +svd_decomposition_1_200_100,702.432363986969 +svd_decomposition_1_200_100,706.031455039978 +svd_decomposition_1_200_100,652.1148700714111 +svd_decomposition_1_200_100,800.6731190681458 +svd_decomposition_1_200_100,673.7515981197357 +svd_decomposition_1_200_100,629.6522281169891 +svd_decomposition_1_200_100,674.1115217208862 +svd_decomposition_1_200_100,677.715528011322 +svd_decomposition_1_200_100,650.3165521621704 +svd_decomposition_1_200_100,592.9430720806122 +qr_decomposition_1_10_1000000,12.601394891738892 +qr_decomposition_1_10_1000000,12.505298852920532 +qr_decomposition_1_10_1000000,12.378314971923828 +qr_decomposition_1_10_1000000,12.709280014038086 +qr_decomposition_1_10_1000000,12.491504907608032 +qr_decomposition_1_10_1000000,12.476433277130127 +qr_decomposition_1_10_1000000,12.480878829956055 +qr_decomposition_1_10_1000000,12.496170997619629 +qr_decomposition_1_10_1000000,12.4915189743042 +qr_decomposition_1_10_1000000,12.48329782485962 +qr_decomposition_1_10_1000000,13.333468198776245 +qr_decomposition_1_200_100,12.305270910263062 +qr_decomposition_1_200_100,12.298511981964111 +qr_decomposition_1_200_100,12.607870817184448 +qr_decomposition_1_200_100,12.451258897781372 +qr_decomposition_1_200_100,12.44648790359497 +qr_decomposition_1_200_100,12.511184215545654 +qr_decomposition_1_200_100,12.453485012054443 +qr_decomposition_1_200_100,12.490206003189087 +qr_decomposition_1_200_100,12.561767816543579 +qr_decomposition_1_200_100,12.536709070205688 +qr_decomposition_1_200_100,12.612308979034424 diff --git a/vm/vm_bench/bencher/main.py b/vm/vm_bench/bencher/main.py index c6d1db6f2d..f282dfb977 100644 --- a/vm/vm_bench/bencher/main.py +++ b/vm/vm_bench/bencher/main.py @@ -14,8 +14,9 @@ def save_test_results(results): writer = csv.DictWriter(vm_file, fieldnames=fieldnames) writer.writeheader() - for test_path, result_descriptor in results[vm].items(): - writer.writerow({"test_path" : test_path, "elapsed_time" : result_descriptor.time}) + for test_name, result_records in results[vm].items(): + for record in result_records: + writer.writerow({"test_path" : test_name, "elapsed_time" : record.time}) @click.command() diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py index e2c67c3ab2..f7e5c1f115 100644 --- a/vm/vm_bench/bencher/settings.py +++ b/vm/vm_bench/bencher/settings.py @@ -19,7 +19,7 @@ interpretator_launch_count = 0 # launch count of compiler-based VMs -compiler_launch_count = 1 +compiler_launch_count = 11 # export function name that should be called from Wasm module test_function_name = "main" @@ -52,17 +52,17 @@ "--target wasm32-unknown-unknown", {"SEED": 1, "ITERATIONS_COUNT": 10, "SEQUENCE_SIZE": 10 * 1024 * 1024}), - "fibonacci_35" : + "fibonacci_42" : TestDescriptor("fibonacci_bigint", "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " "--target wasm32-unknown-unknown", - {"FIB_NUMBER": 35}), + {"FIB_NUMBER": 42}), - "fibonacci_42" : + "fibonacci_50" : TestDescriptor("fibonacci_bigint", "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " "--target wasm32-unknown-unknown", - {"FIB_NUMBER": 42}), + {"FIB_NUMBER": 50}), "factorization_2147483647": TestDescriptor("factorization_reikna", @@ -70,11 +70,11 @@ "--target wasm32-unknown-unknown", {"FACTORIZED_NUMBER": 2147483647}), - "recursive_hash_1000000_0": + "recursive_hash_10000000_0": TestDescriptor("recursive_hash", "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " "--target wasm32-unknown-unknown", - {"ITERATIONS_COUNT": 1000000, "INITIAL_VALUE" : 0}), + {"ITERATIONS_COUNT": 10000000, "INITIAL_VALUE" : 0}), # matrix tests are generated both for a small matrix with a lot of iterations # and for a huge matrix with a few iterations diff --git a/vm/vm_bench/bencher/wasmer.csv b/vm/vm_bench/bencher/wasmer.csv new file mode 100644 index 0000000000..a8d257dddd --- /dev/null +++ b/vm/vm_bench/bencher/wasmer.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,27.7688729763031 +snappy_compression_5_1000000_1Kb,26.533982038497925 +snappy_compression_5_1000000_1Kb,27.23807382583618 +snappy_compression_5_1000000_1Kb,26.176867961883545 +snappy_compression_5_1000000_1Kb,26.974048137664795 +snappy_compression_5_1000000_1Kb,26.824512004852295 +snappy_compression_5_1000000_1Kb,26.878080129623413 +snappy_compression_5_1000000_1Kb,26.31573987007141 +snappy_compression_5_1000000_1Kb,26.931299209594727 +snappy_compression_5_1000000_1Kb,26.83073902130127 +snappy_compression_5_1000000_1Kb,26.94623613357544 +snappy_compression_5_1000_10Mb,27.440106868743896 +snappy_compression_5_1000_10Mb,27.279486894607544 +snappy_compression_5_1000_10Mb,27.282124042510986 +snappy_compression_5_1000_10Mb,27.217063903808594 +snappy_compression_5_1000_10Mb,26.576902866363525 +snappy_compression_5_1000_10Mb,27.34129285812378 +snappy_compression_5_1000_10Mb,26.686068058013916 +snappy_compression_5_1000_10Mb,27.54439902305603 +snappy_compression_5_1000_10Mb,26.73086380958557 +snappy_compression_5_1000_10Mb,27.655193090438843 +snappy_compression_5_1000_10Mb,27.71091365814209 +deflate_compression_5_100000_1Kb,51.91492414474487 +deflate_compression_5_100000_1Kb,52.40915584564209 +deflate_compression_5_100000_1Kb,51.83877921104431 +deflate_compression_5_100000_1Kb,52.196123123168945 +deflate_compression_5_100000_1Kb,52.09947395324707 +deflate_compression_5_100000_1Kb,52.233049154281616 +deflate_compression_5_100000_1Kb,52.53088712692261 +deflate_compression_5_100000_1Kb,52.34496307373047 +deflate_compression_5_100000_1Kb,52.566028118133545 +deflate_compression_5_100000_1Kb,52.1095712184906 +deflate_compression_5_100000_1Kb,51.89137506484985 +deflate_compression_5_10_10Mb,51.521625995635986 +deflate_compression_5_10_10Mb,51.96341681480408 +deflate_compression_5_10_10Mb,51.95174598693848 +deflate_compression_5_10_10Mb,51.80925178527832 +deflate_compression_5_10_10Mb,51.83757495880127 +deflate_compression_5_10_10Mb,51.80482196807861 +deflate_compression_5_10_10Mb,51.956703901290894 +deflate_compression_5_10_10Mb,52.037959814071655 +deflate_compression_5_10_10Mb,51.559319734573364 +deflate_compression_5_10_10Mb,51.97579598426819 +deflate_compression_5_10_10Mb,52.34390115737915 +fibonacci_42,100.81164908409119 +fibonacci_42,101.16505908966064 +fibonacci_42,100.84431481361389 +fibonacci_42,100.68627214431763 +fibonacci_42,101.1809868812561 +fibonacci_42,101.69194006919861 +fibonacci_42,100.91333818435669 +fibonacci_42,100.79982781410217 +fibonacci_42,100.47869420051575 +fibonacci_42,100.70616793632507 +fibonacci_42,101.67957496643066 +fibonacci_50,116.6637179851532 +fibonacci_50,101.13963961601257 +fibonacci_50,121.63424110412598 +fibonacci_50,112.28407311439514 +fibonacci_50,120.0039587020874 +fibonacci_50,100.49020099639893 +fibonacci_50,100.72807478904724 +fibonacci_50,100.23609924316406 +fibonacci_50,100.48474335670471 +fibonacci_50,99.95040988922119 +fibonacci_50,99.62434411048889 +factorization_2147483647,32.438026905059814 +factorization_2147483647,32.77140235900879 +factorization_2147483647,32.29816293716431 +factorization_2147483647,32.58162498474121 +factorization_2147483647,32.242013931274414 +factorization_2147483647,32.83728098869324 +factorization_2147483647,32.73626399040222 +factorization_2147483647,32.67961812019348 +factorization_2147483647,32.526639223098755 +factorization_2147483647,38.35708999633789 +factorization_2147483647,33.12419366836548 +recursive_hash_10000000_0,27.137101650238037 +recursive_hash_10000000_0,28.48113703727722 +recursive_hash_10000000_0,28.19929814338684 +recursive_hash_10000000_0,25.598351001739502 +recursive_hash_10000000_0,27.23847985267639 +recursive_hash_10000000_0,26.772608995437622 +recursive_hash_10000000_0,26.640592098236084 +recursive_hash_10000000_0,28.706769227981567 +recursive_hash_10000000_0,26.74534296989441 +recursive_hash_10000000_0,32.3120219707489 +recursive_hash_10000000_0,27.122738122940063 +matrix_product_1_10_1000000,33.509279012680054 +matrix_product_1_10_1000000,33.12192511558533 +matrix_product_1_10_1000000,36.25976800918579 +matrix_product_1_10_1000000,38.40919589996338 +matrix_product_1_10_1000000,34.89144778251648 +matrix_product_1_10_1000000,39.26520109176636 +matrix_product_1_10_1000000,39.95768404006958 +matrix_product_1_10_1000000,40.353346824645996 +matrix_product_1_10_1000000,40.81225395202637 +matrix_product_1_10_1000000,41.3707001209259 +matrix_product_1_10_1000000,40.06730890274048 +matrix_product_1_200_100,38.87716197967529 +matrix_product_1_200_100,38.140708923339844 +matrix_product_1_200_100,37.70765805244446 +matrix_product_1_200_100,37.89401721954346 +matrix_product_1_200_100,38.986080169677734 +matrix_product_1_200_100,38.78080892562866 +matrix_product_1_200_100,38.98625588417053 +matrix_product_1_200_100,38.90069103240967 +matrix_product_1_200_100,38.60413312911987 +matrix_product_1_200_100,38.84670686721802 +matrix_product_1_200_100,38.90734386444092 +svd_decomposition_1_10_1000000,59.21647500991821 +svd_decomposition_1_10_1000000,59.71688771247864 +svd_decomposition_1_10_1000000,59.90468716621399 +svd_decomposition_1_10_1000000,60.01904082298279 +svd_decomposition_1_10_1000000,66.24443316459656 +svd_decomposition_1_10_1000000,60.99016714096069 +svd_decomposition_1_10_1000000,65.94958114624023 +svd_decomposition_1_10_1000000,66.70589995384216 +svd_decomposition_1_10_1000000,67.48255681991577 +svd_decomposition_1_10_1000000,66.67217302322388 +svd_decomposition_1_10_1000000,70.90477585792542 +svd_decomposition_1_200_100,93.07028794288635 +svd_decomposition_1_200_100,95.85169005393982 +svd_decomposition_1_200_100,96.43082594871521 +svd_decomposition_1_200_100,100.78293299674988 +svd_decomposition_1_200_100,101.1863489151001 +svd_decomposition_1_200_100,79.8322582244873 +svd_decomposition_1_200_100,51.3191339969635 +svd_decomposition_1_200_100,52.0533390045166 +svd_decomposition_1_200_100,51.398340940475464 +svd_decomposition_1_200_100,51.76226878166199 +svd_decomposition_1_200_100,51.610076904296875 +qr_decomposition_1_10_1000000,14.803030967712402 +qr_decomposition_1_10_1000000,14.679723978042603 +qr_decomposition_1_10_1000000,14.856477975845337 +qr_decomposition_1_10_1000000,14.627059936523438 +qr_decomposition_1_10_1000000,14.897404909133911 +qr_decomposition_1_10_1000000,14.94599986076355 +qr_decomposition_1_10_1000000,14.588797092437744 +qr_decomposition_1_10_1000000,14.891240119934082 +qr_decomposition_1_10_1000000,14.77375602722168 +qr_decomposition_1_10_1000000,14.556878805160522 +qr_decomposition_1_10_1000000,14.910651922225952 +qr_decomposition_1_200_100,14.48614501953125 +qr_decomposition_1_200_100,14.738097906112671 +qr_decomposition_1_200_100,14.750440120697021 +qr_decomposition_1_200_100,14.761280059814453 +qr_decomposition_1_200_100,14.512586832046509 +qr_decomposition_1_200_100,14.682394981384277 +qr_decomposition_1_200_100,14.788942098617554 +qr_decomposition_1_200_100,14.659065008163452 +qr_decomposition_1_200_100,14.843371868133545 +qr_decomposition_1_200_100,14.787256956100464 +qr_decomposition_1_200_100,14.840179204940796 diff --git a/vm/vm_bench/bencher/wavm.csv b/vm/vm_bench/bencher/wavm.csv new file mode 100644 index 0000000000..025469e3f4 --- /dev/null +++ b/vm/vm_bench/bencher/wavm.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,9.717528104782104 +snappy_compression_5_1000000_1Kb,9.714651823043823 +snappy_compression_5_1000000_1Kb,9.758702039718628 +snappy_compression_5_1000000_1Kb,9.782424926757812 +snappy_compression_5_1000000_1Kb,9.807159900665283 +snappy_compression_5_1000000_1Kb,9.874746084213257 +snappy_compression_5_1000000_1Kb,9.84822702407837 +snappy_compression_5_1000000_1Kb,9.816054105758667 +snappy_compression_5_1000000_1Kb,9.799592971801758 +snappy_compression_5_1000000_1Kb,9.870435953140259 +snappy_compression_5_1000000_1Kb,9.838435888290405 +snappy_compression_5_1000_10Mb,10.060152053833008 +snappy_compression_5_1000_10Mb,10.011566162109375 +snappy_compression_5_1000_10Mb,9.852818012237549 +snappy_compression_5_1000_10Mb,9.899932861328125 +snappy_compression_5_1000_10Mb,9.92128610610962 +snappy_compression_5_1000_10Mb,9.787997961044312 +snappy_compression_5_1000_10Mb,9.880560874938965 +snappy_compression_5_1000_10Mb,9.990480184555054 +snappy_compression_5_1000_10Mb,9.948058128356934 +snappy_compression_5_1000_10Mb,10.00252103805542 +snappy_compression_5_1000_10Mb,9.932419776916504 +deflate_compression_5_100000_1Kb,15.143059015274048 +deflate_compression_5_100000_1Kb,15.175490140914917 +deflate_compression_5_100000_1Kb,15.066927909851074 +deflate_compression_5_100000_1Kb,15.213164806365967 +deflate_compression_5_100000_1Kb,15.033859729766846 +deflate_compression_5_100000_1Kb,15.027947902679443 +deflate_compression_5_100000_1Kb,15.24101209640503 +deflate_compression_5_100000_1Kb,15.108386039733887 +deflate_compression_5_100000_1Kb,15.153640985488892 +deflate_compression_5_100000_1Kb,15.335155963897705 +deflate_compression_5_100000_1Kb,15.0716872215271 +deflate_compression_5_10_10Mb,15.144837141036987 +deflate_compression_5_10_10Mb,14.776844263076782 +deflate_compression_5_10_10Mb,14.890641927719116 +deflate_compression_5_10_10Mb,15.1025230884552 +deflate_compression_5_10_10Mb,15.177051067352295 +deflate_compression_5_10_10Mb,15.010737180709839 +deflate_compression_5_10_10Mb,15.033567905426025 +deflate_compression_5_10_10Mb,15.203015089035034 +deflate_compression_5_10_10Mb,15.10928988456726 +deflate_compression_5_10_10Mb,15.081895112991333 +deflate_compression_5_10_10Mb,14.840280055999756 +fibonacci_42,39.673710107803345 +fibonacci_42,39.74281883239746 +fibonacci_42,39.6746039390564 +fibonacci_42,39.5506329536438 +fibonacci_42,39.14682698249817 +fibonacci_42,39.66048502922058 +fibonacci_42,39.47613787651062 +fibonacci_42,39.395100116729736 +fibonacci_42,39.7700080871582 +fibonacci_42,39.45085120201111 +fibonacci_42,39.67223882675171 +fibonacci_50,39.28877902030945 +fibonacci_50,39.23145389556885 +fibonacci_50,39.34680700302124 +fibonacci_50,38.918346881866455 +fibonacci_50,38.61098909378052 +fibonacci_50,38.390175104141235 +fibonacci_50,38.36805987358093 +fibonacci_50,38.310194969177246 +fibonacci_50,38.29951620101929 +fibonacci_50,38.28630995750427 +fibonacci_50,38.39356994628906 +factorization_2147483647,10.811481237411499 +factorization_2147483647,10.782574892044067 +factorization_2147483647,10.770956039428711 +factorization_2147483647,10.760880947113037 +factorization_2147483647,10.985636711120605 +factorization_2147483647,10.9326331615448 +factorization_2147483647,11.01753282546997 +factorization_2147483647,11.250012159347534 +factorization_2147483647,10.907017230987549 +factorization_2147483647,10.905230045318604 +factorization_2147483647,10.887682676315308 +recursive_hash_10000000_0,8.460553884506226 +recursive_hash_10000000_0,8.545917272567749 +recursive_hash_10000000_0,8.451397895812988 +recursive_hash_10000000_0,8.508644819259644 +recursive_hash_10000000_0,8.379414081573486 +recursive_hash_10000000_0,8.362284183502197 +recursive_hash_10000000_0,8.411664247512817 +recursive_hash_10000000_0,8.399206161499023 +recursive_hash_10000000_0,8.468336820602417 +recursive_hash_10000000_0,8.571569919586182 +recursive_hash_10000000_0,8.633066177368164 +matrix_product_1_10_1000000,14.90010380744934 +matrix_product_1_10_1000000,14.900184869766235 +matrix_product_1_10_1000000,14.720311641693115 +matrix_product_1_10_1000000,14.972039937973022 +matrix_product_1_10_1000000,15.10330581665039 +matrix_product_1_10_1000000,15.489886045455933 +matrix_product_1_10_1000000,15.45845103263855 +matrix_product_1_10_1000000,15.03793716430664 +matrix_product_1_10_1000000,15.239566087722778 +matrix_product_1_10_1000000,15.18182110786438 +matrix_product_1_10_1000000,15.357434034347534 +matrix_product_1_200_100,15.596153020858765 +matrix_product_1_200_100,15.224766969680786 +matrix_product_1_200_100,15.167222023010254 +matrix_product_1_200_100,15.564743041992188 +matrix_product_1_200_100,15.377501964569092 +matrix_product_1_200_100,15.192561864852905 +matrix_product_1_200_100,15.521537065505981 +matrix_product_1_200_100,15.389590978622437 +matrix_product_1_200_100,15.498884201049805 +matrix_product_1_200_100,16.241212129592896 +matrix_product_1_200_100,17.530209064483643 +svd_decomposition_1_10_1000000,30.873584032058716 +svd_decomposition_1_10_1000000,34.93633580207825 +svd_decomposition_1_10_1000000,32.45456004142761 +svd_decomposition_1_10_1000000,32.9636127948761 +svd_decomposition_1_10_1000000,32.11340093612671 +svd_decomposition_1_10_1000000,31.22289276123047 +svd_decomposition_1_10_1000000,31.276212215423584 +svd_decomposition_1_10_1000000,31.659153699874878 +svd_decomposition_1_10_1000000,31.92449688911438 +svd_decomposition_1_10_1000000,32.02426600456238 +svd_decomposition_1_10_1000000,32.75420904159546 +svd_decomposition_1_200_100,17.757825136184692 +svd_decomposition_1_200_100,17.767619848251343 +svd_decomposition_1_200_100,17.778232097625732 +svd_decomposition_1_200_100,17.72095489501953 +svd_decomposition_1_200_100,17.587416887283325 +svd_decomposition_1_200_100,17.643022775650024 +svd_decomposition_1_200_100,17.587465286254883 +svd_decomposition_1_200_100,17.71707797050476 +svd_decomposition_1_200_100,17.670255184173584 +svd_decomposition_1_200_100,17.64920401573181 +svd_decomposition_1_200_100,17.508506298065186 +qr_decomposition_1_10_1000000,5.659765005111694 +qr_decomposition_1_10_1000000,5.716536045074463 +qr_decomposition_1_10_1000000,5.698207855224609 +qr_decomposition_1_10_1000000,5.744373083114624 +qr_decomposition_1_10_1000000,5.777857780456543 +qr_decomposition_1_10_1000000,5.655165910720825 +qr_decomposition_1_10_1000000,5.630970001220703 +qr_decomposition_1_10_1000000,5.703395843505859 +qr_decomposition_1_10_1000000,5.664350986480713 +qr_decomposition_1_10_1000000,5.606341123580933 +qr_decomposition_1_10_1000000,5.682938098907471 +qr_decomposition_1_200_100,5.599729061126709 +qr_decomposition_1_200_100,5.676383018493652 +qr_decomposition_1_200_100,5.7370240688323975 +qr_decomposition_1_200_100,5.617890119552612 +qr_decomposition_1_200_100,5.682607173919678 +qr_decomposition_1_200_100,5.653961896896362 +qr_decomposition_1_200_100,5.609421014785767 +qr_decomposition_1_200_100,5.657746315002441 +qr_decomposition_1_200_100,5.621825218200684 +qr_decomposition_1_200_100,5.662790060043335 +qr_decomposition_1_200_100,5.689028978347778 diff --git a/vm/vm_bench/wagon_run/wagon_main.go b/vm/vm_bench/wagon_run/wagon_main.go new file mode 100644 index 0000000000..d70a87045a --- /dev/null +++ b/vm/vm_bench/wagon_run/wagon_main.go @@ -0,0 +1,119 @@ +// Modified from https://github.com/go-interpreter/wagon/blob/master/cmd/wasm-run/main.go + +// Copyright 2017 The go-interpreter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "flag" + "fmt" + "io" + "log" + "os" + + "github.com/go-interpreter/wagon/exec" + "github.com/go-interpreter/wagon/validate" + "github.com/go-interpreter/wagon/wasm" +) + +func main() { + log.SetPrefix("wasm-run: ") + log.SetFlags(0) + + verbose := flag.Bool("v", false, "enable/disable verbose mode") + verify := flag.Bool("verify-module", false, "run module verification") + entryName := flag.String("entry", "app_main", "entry function name") + + flag.Parse() + + if flag.NArg() < 1 { + flag.Usage() + flag.PrintDefaults() + os.Exit(1) + } + + wasm.SetDebugMode(*verbose) + + run(os.Stdout, flag.Arg(0), *verify, *entryName) +} + +func run(w io.Writer, fname string, verify bool, entryName string) { + f, err := os.Open(fname) + if err != nil { + log.Fatal(err) + } + defer f.Close() + + m, err := wasm.ReadModule(f, importer) + if err != nil { + log.Fatalf("could not read module: %v", err) + } + + if verify { + err = validate.VerifyModule(m) + if err != nil { + log.Fatalf("could not verify module: %v", err) + } + } + + if m.Export == nil { + log.Fatalf("module has no export section") + } + + vm, err := exec.NewVM(m) + if err != nil { + log.Fatalf("could not create VM: %v", err) + } + + e, ok := m.Export.Entries[entryName] + if !ok { + log.Fatalf("export not found") + } + + i := int64(e.Index) + fidx := m.Function.Types[int(i)] + ftype := m.Types.Entries[int(fidx)] + switch len(ftype.ReturnTypes) { + case 1: + fmt.Fprintf(w, "%s() %s => ", entryName, ftype.ReturnTypes[0]) + case 0: + fmt.Fprintf(w, "%s() => ", entryName) + default: + log.Printf("running exported functions with more than one return value is not supported") + return + } + if len(ftype.ParamTypes) > 0 { + log.Printf("running exported functions with input parameters is not supported") + return + } + o, err := vm.ExecCode(i) + if err != nil { + fmt.Fprintf(w, "\n") + log.Printf("err=%v", err) + return + } + if len(ftype.ReturnTypes) == 0 { + fmt.Fprintf(w, "\n") + return + } + fmt.Fprintf(w, "%[1]v (%[1]T)\n", o) +} + +func importer(name string) (*wasm.Module, error) { + f, err := os.Open(name + ".wasm") + if err != nil { + return nil, err + } + defer f.Close() + m, err := wasm.ReadModule(f, nil) + if err != nil { + return nil, err + } + err = validate.VerifyModule(m) + if err != nil { + return nil, err + } + return m, nil +} \ No newline at end of file From a5424e250b3d128202659048e6690c6ad029c7ec Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 30 Nov 2018 00:14:39 +0300 Subject: [PATCH 19/48] change export functions scheme in tests --- vm/vm_bench/tests/deflate_compression/src/lib.rs | 13 +++++++++++-- vm/vm_bench/tests/factorization_reikna/src/lib.rs | 13 +++++++++++-- vm/vm_bench/tests/fibonacci_bigint/src/lib.rs | 13 +++++++++++-- vm/vm_bench/tests/matrix_product/src/lib.rs | 13 +++++++++++-- .../tests/matrix_qr_decomposition/src/lib.rs | 13 +++++++++++-- .../tests/matrix_svd_decomposition/src/lib.rs | 13 +++++++++++-- vm/vm_bench/tests/recursive_hash/src/lib.rs | 13 +++++++++++-- vm/vm_bench/tests/snappy_compression/src/lib.rs | 13 +++++++++++-- 8 files changed, 88 insertions(+), 16 deletions(-) diff --git a/vm/vm_bench/tests/deflate_compression/src/lib.rs b/vm/vm_bench/tests/deflate_compression/src/lib.rs index e6156fda3d..a800fd262e 100644 --- a/vm/vm_bench/tests/deflate_compression/src/lib.rs +++ b/vm/vm_bench/tests/deflate_compression/src/lib.rs @@ -21,8 +21,7 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { result_sequence } -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); @@ -39,3 +38,13 @@ pub extern "C" fn main() -> u64 { compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} diff --git a/vm/vm_bench/tests/factorization_reikna/src/lib.rs b/vm/vm_bench/tests/factorization_reikna/src/lib.rs index 3bac65f1e1..144e1da54f 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/lib.rs @@ -4,11 +4,20 @@ extern crate reikna; use settings::FACTORIZED_NUMBER; use reikna::prime; -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); // reikna uses Atkin or Eratosthenes seive to factorize given number let factors = prime::factorize(factorized_number); factors[0] } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} diff --git a/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs b/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs index 5b5dee3f10..c356ddbc37 100644 --- a/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs +++ b/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs @@ -15,9 +15,18 @@ fn fib(num: &BigUint) -> BigUint { fib(&num.sub(1u32)) + fib(&num.sub(2u32)) } -#[no_mangle] -pub extern "C" fn main() -> u8 { +fn bench_test() -> u8 { let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) } + +#[no_mangle] +pub extern "C" fn app_main() -> u8 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u8 { + bench_test() +} diff --git a/vm/vm_bench/tests/matrix_product/src/lib.rs b/vm/vm_bench/tests/matrix_product/src/lib.rs index 6384dd2783..43d9502f1f 100644 --- a/vm/vm_bench/tests/matrix_product/src/lib.rs +++ b/vm/vm_bench/tests/matrix_product/src/lib.rs @@ -24,8 +24,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { trace } -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -42,3 +41,13 @@ pub extern "C" fn main() -> u64 { matrix_hash } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs b/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs index c851336894..3ee7a63bcd 100644 --- a/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs +++ b/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs @@ -24,8 +24,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { trace } -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -39,3 +38,13 @@ pub extern "C" fn main() -> u64 { matrix_hash } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs index a816ba0aef..cf26155e59 100644 --- a/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs +++ b/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs @@ -12,8 +12,7 @@ fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Ma Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -27,3 +26,13 @@ pub extern "C" fn main() -> u64 { matrix_hash } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} diff --git a/vm/vm_bench/tests/recursive_hash/src/lib.rs b/vm/vm_bench/tests/recursive_hash/src/lib.rs index 4490cea363..923e2dd57c 100644 --- a/vm/vm_bench/tests/recursive_hash/src/lib.rs +++ b/vm/vm_bench/tests/recursive_hash/src/lib.rs @@ -5,8 +5,7 @@ use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; use sha3::{Digest, Sha3_256}; use std::mem; -#[no_mangle] -pub extern "C" fn main() -> u8 { +fn bench_test() -> u8 { let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); @@ -19,3 +18,13 @@ pub extern "C" fn main() -> u8 { hash_result.iter().fold(0, |x1 ,x2| x1 ^ x2) } + +#[no_mangle] +pub extern "C" fn app_main() -> u8 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u8 { + bench_test() +} diff --git a/vm/vm_bench/tests/snappy_compression/src/lib.rs b/vm/vm_bench/tests/snappy_compression/src/lib.rs index 087702782c..4d3bdc5769 100644 --- a/vm/vm_bench/tests/snappy_compression/src/lib.rs +++ b/vm/vm_bench/tests/snappy_compression/src/lib.rs @@ -20,8 +20,7 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { result_sequence } -#[no_mangle] -pub extern "C" fn main() -> u64 { +fn bench_test() -> u64 { let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); @@ -38,3 +37,13 @@ pub extern "C" fn main() -> u64 { compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 } + +#[no_mangle] +pub extern "C" fn app_main() -> u64 { + bench_test() +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { + bench_test() +} From 095411c4c9e2263636eb86dfb46942a60f38d19b Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 30 Nov 2018 00:15:17 +0300 Subject: [PATCH 20/48] delete wagon runner --- vm/vm_bench/wagon_run/wagon_main.go | 119 ---------------------------- 1 file changed, 119 deletions(-) delete mode 100644 vm/vm_bench/wagon_run/wagon_main.go diff --git a/vm/vm_bench/wagon_run/wagon_main.go b/vm/vm_bench/wagon_run/wagon_main.go deleted file mode 100644 index d70a87045a..0000000000 --- a/vm/vm_bench/wagon_run/wagon_main.go +++ /dev/null @@ -1,119 +0,0 @@ -// Modified from https://github.com/go-interpreter/wagon/blob/master/cmd/wasm-run/main.go - -// Copyright 2017 The go-interpreter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - - "github.com/go-interpreter/wagon/exec" - "github.com/go-interpreter/wagon/validate" - "github.com/go-interpreter/wagon/wasm" -) - -func main() { - log.SetPrefix("wasm-run: ") - log.SetFlags(0) - - verbose := flag.Bool("v", false, "enable/disable verbose mode") - verify := flag.Bool("verify-module", false, "run module verification") - entryName := flag.String("entry", "app_main", "entry function name") - - flag.Parse() - - if flag.NArg() < 1 { - flag.Usage() - flag.PrintDefaults() - os.Exit(1) - } - - wasm.SetDebugMode(*verbose) - - run(os.Stdout, flag.Arg(0), *verify, *entryName) -} - -func run(w io.Writer, fname string, verify bool, entryName string) { - f, err := os.Open(fname) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - m, err := wasm.ReadModule(f, importer) - if err != nil { - log.Fatalf("could not read module: %v", err) - } - - if verify { - err = validate.VerifyModule(m) - if err != nil { - log.Fatalf("could not verify module: %v", err) - } - } - - if m.Export == nil { - log.Fatalf("module has no export section") - } - - vm, err := exec.NewVM(m) - if err != nil { - log.Fatalf("could not create VM: %v", err) - } - - e, ok := m.Export.Entries[entryName] - if !ok { - log.Fatalf("export not found") - } - - i := int64(e.Index) - fidx := m.Function.Types[int(i)] - ftype := m.Types.Entries[int(fidx)] - switch len(ftype.ReturnTypes) { - case 1: - fmt.Fprintf(w, "%s() %s => ", entryName, ftype.ReturnTypes[0]) - case 0: - fmt.Fprintf(w, "%s() => ", entryName) - default: - log.Printf("running exported functions with more than one return value is not supported") - return - } - if len(ftype.ParamTypes) > 0 { - log.Printf("running exported functions with input parameters is not supported") - return - } - o, err := vm.ExecCode(i) - if err != nil { - fmt.Fprintf(w, "\n") - log.Printf("err=%v", err) - return - } - if len(ftype.ReturnTypes) == 0 { - fmt.Fprintf(w, "\n") - return - } - fmt.Fprintf(w, "%[1]v (%[1]T)\n", o) -} - -func importer(name string) (*wasm.Module, error) { - f, err := os.Open(name + ".wasm") - if err != nil { - return nil, err - } - defer f.Close() - m, err := wasm.ReadModule(f, nil) - if err != nil { - return nil, err - } - err = validate.VerifyModule(m) - if err != nil { - return nil, err - } - return m, nil -} \ No newline at end of file From ee75d81a1c2f4895789e89ebbbd652d09d04c8e6 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 30 Nov 2018 00:32:10 +0300 Subject: [PATCH 21/48] delete wagon runner --- vm/vm_bench/wagon_run/wagon_main.go | 119 ---------------------------- 1 file changed, 119 deletions(-) delete mode 100644 vm/vm_bench/wagon_run/wagon_main.go diff --git a/vm/vm_bench/wagon_run/wagon_main.go b/vm/vm_bench/wagon_run/wagon_main.go deleted file mode 100644 index d70a87045a..0000000000 --- a/vm/vm_bench/wagon_run/wagon_main.go +++ /dev/null @@ -1,119 +0,0 @@ -// Modified from https://github.com/go-interpreter/wagon/blob/master/cmd/wasm-run/main.go - -// Copyright 2017 The go-interpreter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - - "github.com/go-interpreter/wagon/exec" - "github.com/go-interpreter/wagon/validate" - "github.com/go-interpreter/wagon/wasm" -) - -func main() { - log.SetPrefix("wasm-run: ") - log.SetFlags(0) - - verbose := flag.Bool("v", false, "enable/disable verbose mode") - verify := flag.Bool("verify-module", false, "run module verification") - entryName := flag.String("entry", "app_main", "entry function name") - - flag.Parse() - - if flag.NArg() < 1 { - flag.Usage() - flag.PrintDefaults() - os.Exit(1) - } - - wasm.SetDebugMode(*verbose) - - run(os.Stdout, flag.Arg(0), *verify, *entryName) -} - -func run(w io.Writer, fname string, verify bool, entryName string) { - f, err := os.Open(fname) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - m, err := wasm.ReadModule(f, importer) - if err != nil { - log.Fatalf("could not read module: %v", err) - } - - if verify { - err = validate.VerifyModule(m) - if err != nil { - log.Fatalf("could not verify module: %v", err) - } - } - - if m.Export == nil { - log.Fatalf("module has no export section") - } - - vm, err := exec.NewVM(m) - if err != nil { - log.Fatalf("could not create VM: %v", err) - } - - e, ok := m.Export.Entries[entryName] - if !ok { - log.Fatalf("export not found") - } - - i := int64(e.Index) - fidx := m.Function.Types[int(i)] - ftype := m.Types.Entries[int(fidx)] - switch len(ftype.ReturnTypes) { - case 1: - fmt.Fprintf(w, "%s() %s => ", entryName, ftype.ReturnTypes[0]) - case 0: - fmt.Fprintf(w, "%s() => ", entryName) - default: - log.Printf("running exported functions with more than one return value is not supported") - return - } - if len(ftype.ParamTypes) > 0 { - log.Printf("running exported functions with input parameters is not supported") - return - } - o, err := vm.ExecCode(i) - if err != nil { - fmt.Fprintf(w, "\n") - log.Printf("err=%v", err) - return - } - if len(ftype.ReturnTypes) == 0 { - fmt.Fprintf(w, "\n") - return - } - fmt.Fprintf(w, "%[1]v (%[1]T)\n", o) -} - -func importer(name string) (*wasm.Module, error) { - f, err := os.Open(name + ".wasm") - if err != nil { - return nil, err - } - defer f.Close() - m, err := wasm.ReadModule(f, nil) - if err != nil { - return nil, err - } - err = validate.VerifyModule(m) - if err != nil { - return nil, err - } - return m, nil -} \ No newline at end of file From 8982dd749fbbae002713be5b83b3e330f4e0ec55 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 30 Nov 2018 00:34:53 +0300 Subject: [PATCH 22/48] fix some bugs in vm launch --- vm/vm_bench/bencher/WasmVMBencher.py | 3 ++- vm/vm_bench/bencher/settings.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/vm/vm_bench/bencher/WasmVMBencher.py b/vm/vm_bench/bencher/WasmVMBencher.py index d4e73915be..2d7ab63810 100644 --- a/vm/vm_bench/bencher/WasmVMBencher.py +++ b/vm/vm_bench/bencher/WasmVMBencher.py @@ -27,7 +27,7 @@ def run_tests(self, test_descriptors, vm_descriptors): print(": launch test", test_name) for vm in self.enabled_vm: if vm not in vm_descriptors: - pass + continue vm_binary_full_path = join(self.vm_dir, vm, vm_descriptors[vm].relative_vm_binary_path) cmd = vm_binary_full_path + " " \ @@ -37,6 +37,7 @@ def run_tests(self, test_descriptors, vm_descriptors): launch_count = compiler_launch_count if vm_descriptors[vm].is_compiler_type \ else interpretator_launch_count for _ in range(launch_count): + print(cmd) result_record = self.__do_one_test(cmd) results[vm][test_name].append(result_record) print(": {} result collected: time={}".format(vm, result_record.time)) diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py index f7e5c1f115..035ef09069 100644 --- a/vm/vm_bench/bencher/settings.py +++ b/vm/vm_bench/bencher/settings.py @@ -5,18 +5,18 @@ # paths of Wasm VMs root directories vm_descriptors = { "wavm" : VMDescriptor(join("build_", "bin", "wavm-run"), - "{wasm_file_path} -f {function_name}", True), - "life" : VMDescriptor(join("life"), "entry '{function_name}' {wasm_file_path}", False), + "{wasm_file_path} -f {function_name}", True), + "life" : VMDescriptor(join("life"), "-entry {function_name} {wasm_file_path}", False), "wasmi" : VMDescriptor(join("target", "release", "examples", "invoke"), - "{function_name} {wasm_file_path}", False), + "{wasm_file_path} {function_name}", False), "wasmer" : VMDescriptor(join("target", "release", "wasmer"), "run {wasm_file_path}", True), - "wagon" : VMDescriptor("", "", False), +# "wagon" : VMDescriptor("", "", False), "asmble" : VMDescriptor(join("asmble", "bin", "asmble"), - "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) + "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) } # launch count of interpretator-based VMs -interpretator_launch_count = 0 +interpretator_launch_count = 3 # launch count of compiler-based VMs compiler_launch_count = 11 From 4c69f1ba9909c5fbcfd03719f6ee3a9fffbc426d Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 30 Nov 2018 01:23:25 +0300 Subject: [PATCH 23/48] a little project rearrange --- vm/vm_bench/bencher/BenchTestGenerator.py | 15 ++++++++++----- vm/vm_bench/bencher/settings.py | 6 +++--- vm/vm_bench/{bencher => results}/asmble.csv | 0 vm/vm_bench/{bencher => results}/wasmer.csv | 0 vm/vm_bench/{bencher => results}/wavm.csv | 0 5 files changed, 13 insertions(+), 8 deletions(-) rename vm/vm_bench/{bencher => results}/asmble.csv (100%) rename vm/vm_bench/{bencher => results}/wasmer.csv (100%) rename vm/vm_bench/{bencher => results}/wavm.csv (100%) diff --git a/vm/vm_bench/bencher/BenchTestGenerator.py b/vm/vm_bench/bencher/BenchTestGenerator.py index 8d818181fa..72e56b8bdf 100644 --- a/vm/vm_bench/bencher/BenchTestGenerator.py +++ b/vm/vm_bench/bencher/BenchTestGenerator.py @@ -13,6 +13,11 @@ def __init__(self, test_dir): # compiles test with chosen parameters def generate_tests(self, out_dir, test_descriptors): call("mkdir {}".format(join(out_dir,self.generated_tests_dir)),shell=True) + + # to clean possible previous unsuccessfully build results that prevent cargo to build new tests + call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) + call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) + generated_tests_dir_full_path = join(out_dir, self.generated_tests_dir) test_mv_cmd = "mv " + join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm") + " " \ + join(generated_tests_dir_full_path, "{}.wasm") @@ -23,13 +28,13 @@ def generate_tests(self, out_dir, test_descriptors): for key, value in test_descriptor.test_generator_params.items(): test_cmd = "{}={} {}".format(key, value, test_cmd) - call(test_cmd, shell=True) call(test_mv_cmd.format(test_descriptor.test_folder_name, test_name), shell=True) - test_descriptors[test_name].test_full_path = join(generated_tests_dir_full_path, "{}.wasm").format(test_name) - # collect garbage - call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) - call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) + # collect garbage to force cargo build the same test with different env params again + call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) + call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) + + test_descriptors[test_name].test_full_path = join(generated_tests_dir_full_path, "{}.wasm").format(test_name) return test_descriptors diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py index 035ef09069..1a42572c76 100644 --- a/vm/vm_bench/bencher/settings.py +++ b/vm/vm_bench/bencher/settings.py @@ -5,14 +5,14 @@ # paths of Wasm VMs root directories vm_descriptors = { "wavm" : VMDescriptor(join("build_", "bin", "wavm-run"), - "{wasm_file_path} -f {function_name}", True), + "{wasm_file_path} -f {function_name}", True), "life" : VMDescriptor(join("life"), "-entry {function_name} {wasm_file_path}", False), "wasmi" : VMDescriptor(join("target", "release", "examples", "invoke"), - "{wasm_file_path} {function_name}", False), + "{wasm_file_path} {function_name}", False), "wasmer" : VMDescriptor(join("target", "release", "wasmer"), "run {wasm_file_path}", True), # "wagon" : VMDescriptor("", "", False), "asmble" : VMDescriptor(join("asmble", "bin", "asmble"), - "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) + "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) } # launch count of interpretator-based VMs diff --git a/vm/vm_bench/bencher/asmble.csv b/vm/vm_bench/results/asmble.csv similarity index 100% rename from vm/vm_bench/bencher/asmble.csv rename to vm/vm_bench/results/asmble.csv diff --git a/vm/vm_bench/bencher/wasmer.csv b/vm/vm_bench/results/wasmer.csv similarity index 100% rename from vm/vm_bench/bencher/wasmer.csv rename to vm/vm_bench/results/wasmer.csv diff --git a/vm/vm_bench/bencher/wavm.csv b/vm/vm_bench/results/wavm.csv similarity index 100% rename from vm/vm_bench/bencher/wavm.csv rename to vm/vm_bench/results/wavm.csv From 3c4a08a3f6ab610040f972d7138cd19c7fd59b08 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 18:50:05 +0300 Subject: [PATCH 24/48] move toone compression file for test with defalte and snappy compressions --- .../Cargo.toml | 5 ++ .../src/lib.rs | 31 ++++++------ .../src/settings.rs | 0 .../tests/deflate_compression/Cargo.toml | 12 ----- .../tests/snappy_compression/src/lib.rs | 49 ------------------- .../tests/snappy_compression/src/settings.rs | 8 --- 6 files changed, 21 insertions(+), 84 deletions(-) rename vm/vm_bench/tests/{snappy_compression => compression}/Cargo.toml (74%) rename vm/vm_bench/tests/{deflate_compression => compression}/src/lib.rs (68%) rename vm/vm_bench/tests/{deflate_compression => compression}/src/settings.rs (100%) delete mode 100644 vm/vm_bench/tests/deflate_compression/Cargo.toml delete mode 100644 vm/vm_bench/tests/snappy_compression/src/lib.rs delete mode 100644 vm/vm_bench/tests/snappy_compression/src/settings.rs diff --git a/vm/vm_bench/tests/snappy_compression/Cargo.toml b/vm/vm_bench/tests/compression/Cargo.toml similarity index 74% rename from vm/vm_bench/tests/snappy_compression/Cargo.toml rename to vm/vm_bench/tests/compression/Cargo.toml index 6af12da206..eb1e5ab606 100644 --- a/vm/vm_bench/tests/snappy_compression/Cargo.toml +++ b/vm/vm_bench/tests/compression/Cargo.toml @@ -8,5 +8,10 @@ crate-type = ["cdylib"] [dependencies] snap = "0.2" +deflate = "0.7.19" rand = "0.6.1" rand_isaac = "0.1.0" + +[features] +default = [] +deflate_compression = [] diff --git a/vm/vm_bench/tests/deflate_compression/src/lib.rs b/vm/vm_bench/tests/compression/src/lib.rs similarity index 68% rename from vm/vm_bench/tests/deflate_compression/src/lib.rs rename to vm/vm_bench/tests/compression/src/lib.rs index a800fd262e..eb77cb68ef 100644 --- a/vm/vm_bench/tests/deflate_compression/src/lib.rs +++ b/vm/vm_bench/tests/compression/src/lib.rs @@ -1,5 +1,8 @@ + + mod settings; +extern crate snap; extern crate deflate; extern crate rand; extern crate rand_isaac; @@ -21,30 +24,28 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { result_sequence } -fn bench_test() -> u64 { +fn compress_sequence(sequence: &Sequence) -> Sequence { + if cfg!(feature = "deflate_compression") { + return deflate_bytes(&sequence); + } + + return snap::Encoder::new().compress_vec(&sequence).unwrap(); +} + +#[no_mangle] +pub extern "C" fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); - let mut sequence = generate_sequence(seed, sequence_size); - let mut compressed_sequence = deflate_bytes(&sequence); + let mut compressed_sequence = generate_sequence(seed, sequence_size); for _ in 1..iterations_count { let new_seed = compressed_sequence.len() + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; - sequence = generate_sequence(new_seed as u64, sequence_size); - compressed_sequence = deflate_bytes(&sequence); + compressed_sequence = generate_sequence(new_seed as u64, sequence_size); + compressed_sequence = compress_sequence(&compressed_sequence); } compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 } - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/deflate_compression/src/settings.rs b/vm/vm_bench/tests/compression/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/deflate_compression/src/settings.rs rename to vm/vm_bench/tests/compression/src/settings.rs diff --git a/vm/vm_bench/tests/deflate_compression/Cargo.toml b/vm/vm_bench/tests/deflate_compression/Cargo.toml deleted file mode 100644 index 7a8ff8fc5a..0000000000 --- a/vm/vm_bench/tests/deflate_compression/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "deflate_compression" -version = "0.1.0" -authors = ["M. Voronov "] - -[lib] -crate-type = ["cdylib"] - -[dependencies] -deflate = "0.7.19" -rand = "0.6.1" -rand_isaac = "0.1.0" diff --git a/vm/vm_bench/tests/snappy_compression/src/lib.rs b/vm/vm_bench/tests/snappy_compression/src/lib.rs deleted file mode 100644 index 4d3bdc5769..0000000000 --- a/vm/vm_bench/tests/snappy_compression/src/lib.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod settings; - -extern crate snap; -extern crate rand; -extern crate rand_isaac; - -use settings::{SEED, ITERATIONS_COUNT, SEQUENCE_SIZE}; -use rand::{Rng, SeedableRng}; -use rand_isaac::IsaacRng; - -type Sequence = Vec; - -fn generate_sequence(seed : u64, size : u64) -> Sequence { - let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - let mut result_sequence = Sequence::with_capacity(size as usize); - - for _ in 0..size { - result_sequence.push(rng.gen::()); - } - result_sequence -} - -fn bench_test() -> u64 { - let seed : u64 = SEED.parse::().unwrap(); - let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); - let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); - - let mut sequence = generate_sequence(seed, sequence_size); - let mut compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); - - for _ in 1..iterations_count { - let new_seed = compressed_sequence.len() + - compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; - sequence = generate_sequence(new_seed as u64, sequence_size); - compressed_sequence = snap::Encoder::new().compress_vec(&sequence).unwrap(); - } - - compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 -} - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/snappy_compression/src/settings.rs b/vm/vm_bench/tests/snappy_compression/src/settings.rs deleted file mode 100644 index 677885e1d2..0000000000 --- a/vm/vm_bench/tests/snappy_compression/src/settings.rs +++ /dev/null @@ -1,8 +0,0 @@ -// this values is used as a seed to pseudo-random generator for sequence generation -pub const SEED : &'static str = env!("SEED"); - -// count of test iterations -pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); - -// size of sequence that should be compressed in each iteration -pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); From e381ecfae993f6b8bb99e2a069e75a5f475f0b00 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 19:20:30 +0300 Subject: [PATCH 25/48] introduce compression test final look --- vm/vm_bench/tests/compression/src/lib.rs | 23 ++++++++++++++++++- vm/vm_bench/tests/compression/src/settings.rs | 22 +++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/vm/vm_bench/tests/compression/src/lib.rs b/vm/vm_bench/tests/compression/src/lib.rs index eb77cb68ef..e78929d001 100644 --- a/vm/vm_bench/tests/compression/src/lib.rs +++ b/vm/vm_bench/tests/compression/src/lib.rs @@ -1,4 +1,18 @@ - +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; @@ -14,6 +28,7 @@ use deflate::deflate_bytes; type Sequence = Vec; +/// generates pseudo-random byte sequence by given seed and given size fn generate_sequence(seed : u64, size : u64) -> Sequence { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); let mut result_sequence = Sequence::with_capacity(size as usize); @@ -24,6 +39,7 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { result_sequence } +/// compresses provided sequence by deflate or snappy algorithm fn compress_sequence(sequence: &Sequence) -> Sequence { if cfg!(feature = "deflate_compression") { return deflate_bytes(&sequence); @@ -32,6 +48,11 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { return snap::Encoder::new().compress_vec(&sequence).unwrap(); } +/// This test recursively compresses sequence of SEQUENCE_SIZE bytes randomly generated by +/// IsaacRng. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new +/// sequence is generated by seed that computed based on previously sequence. And as the first +/// seed SEED parameter is used. Also there are two supported compression algorithms (deflate +/// and snappy) that are choosed by "deflate_compression" feature. #[no_mangle] pub extern "C" fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); diff --git a/vm/vm_bench/tests/compression/src/settings.rs b/vm/vm_bench/tests/compression/src/settings.rs index 677885e1d2..42c8694fa9 100644 --- a/vm/vm_bench/tests/compression/src/settings.rs +++ b/vm/vm_bench/tests/compression/src/settings.rs @@ -1,8 +1,24 @@ -// this values is used as a seed to pseudo-random generator for sequence generation +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this value is used as the first seed of pseudo-random generator for sequence generation pub const SEED : &'static str = env!("SEED"); -// count of test iterations +// count of compression iterations pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); -// size of sequence that should be compressed in each iteration +// size of sequence that should be compressed on each iteration pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); From d891ab30c9f19c6d1e532f9c1142aebb6b07fe3a Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 20:20:22 +0300 Subject: [PATCH 26/48] add comments and copyright headers --- vm/vm_bench/tests/compression/src/lib.rs | 5 +-- vm/vm_bench/tests/compression/src/settings.rs | 7 ++-- .../tests/factorization_reikna/src/lib.rs | 31 +++++++++----- .../factorization_reikna/src/settings.rs | 16 ++++++++ vm/vm_bench/tests/fibonacci_bigint/src/lib.rs | 32 ++++++++++----- .../tests/fibonacci_bigint/src/settings.rs | 17 +++++++- vm/vm_bench/tests/matrix_product/src/lib.rs | 40 +++++++++++++------ .../tests/matrix_product/src/settings.rs | 15 +++++++ .../tests/matrix_qr_decomposition/src/lib.rs | 37 +++++++++++------ .../matrix_qr_decomposition/src/settings.rs | 25 +++++++++--- .../tests/matrix_svd_decomposition/src/lib.rs | 35 +++++++++++----- .../matrix_svd_decomposition/src/settings.rs | 23 +++++++++-- vm/vm_bench/tests/recursive_hash/src/lib.rs | 32 ++++++++++----- .../tests/recursive_hash/src/settings.rs | 19 ++++++++- 14 files changed, 247 insertions(+), 87 deletions(-) diff --git a/vm/vm_bench/tests/compression/src/lib.rs b/vm/vm_bench/tests/compression/src/lib.rs index e78929d001..91ec86df06 100644 --- a/vm/vm_bench/tests/compression/src/lib.rs +++ b/vm/vm_bench/tests/compression/src/lib.rs @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - mod settings; extern crate snap; @@ -48,8 +47,8 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { return snap::Encoder::new().compress_vec(&sequence).unwrap(); } -/// This test recursively compresses sequence of SEQUENCE_SIZE bytes randomly generated by -/// IsaacRng. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new +/// This test compresses sequence of SEQUENCE_SIZE bytes randomly generated by IsaacRng +/// in series. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new /// sequence is generated by seed that computed based on previously sequence. And as the first /// seed SEED parameter is used. Also there are two supported compression algorithms (deflate /// and snappy) that are choosed by "deflate_compression" feature. diff --git a/vm/vm_bench/tests/compression/src/settings.rs b/vm/vm_bench/tests/compression/src/settings.rs index 42c8694fa9..c59389c07c 100644 --- a/vm/vm_bench/tests/compression/src/settings.rs +++ b/vm/vm_bench/tests/compression/src/settings.rs @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -// this value is used as the first seed of pseudo-random generator for sequence generation +/// this value is used as the first seed of pseudo-random generator for sequence generation pub const SEED : &'static str = env!("SEED"); -// count of compression iterations +/// count of compression iterations pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); -// size of sequence that should be compressed on each iteration +/// size of sequence that should be compressed on each iteration pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); diff --git a/vm/vm_bench/tests/factorization_reikna/src/lib.rs b/vm/vm_bench/tests/factorization_reikna/src/lib.rs index 144e1da54f..f863f3b026 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/lib.rs @@ -1,23 +1,32 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate reikna; use settings::FACTORIZED_NUMBER; use reikna::prime; -fn bench_test() -> u64 { +/// This test simply factorizes given FACTORIZED_NUMBER by seievs from reikna library. +/// +/// Returns a prime delimiter of FACTORIZED_NUMBER to prevent possible aggressive optimizations. +#[no_mangle] +pub extern "C" fn main() -> u64 { let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); // reikna uses Atkin or Eratosthenes seive to factorize given number let factors = prime::factorize(factorized_number); factors[0] } - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/factorization_reikna/src/settings.rs b/vm/vm_bench/tests/factorization_reikna/src/settings.rs index c1a1317d76..fdc3b95ce5 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/settings.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/settings.rs @@ -1 +1,17 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// a number that should be factorized by this test pub const FACTORIZED_NUMBER : &'static str = env!("FACTORIZED_NUMBER"); diff --git a/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs b/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs index c356ddbc37..11d48402e7 100644 --- a/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs +++ b/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate num_bigint; extern crate num_traits; @@ -7,6 +22,7 @@ use num_bigint::BigUint; use num_traits::One; use std::ops::Sub; +/// recursively computes a fibonacci number F_num for the given num fn fib(num: &BigUint) -> BigUint { if num.le(&BigUint::from(2u32)) { return One::one(); @@ -15,18 +31,14 @@ fn fib(num: &BigUint) -> BigUint { fib(&num.sub(1u32)) + fib(&num.sub(2u32)) } -fn bench_test() -> u8 { +/// This test simply computes a given fibonacci number recursively (bigint is used to prevent +/// interger overflows). +/// +/// Returns a xor value of bytes in computed fibonacci number to prevent possible aggressive optimization. +#[no_mangle] +pub extern "C" fn main() -> u8 { let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) } -#[no_mangle] -pub extern "C" fn app_main() -> u8 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u8 { - bench_test() -} diff --git a/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs b/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs index 18d947590b..52691b2b3b 100644 --- a/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs +++ b/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs @@ -1,2 +1,17 @@ -// the requested fibonacci number that would be computed +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// a requested fibonacci number that would be computed pub const FIB_NUMBER: &'static str = env!("FIB_NUMBER"); diff --git a/vm/vm_bench/tests/matrix_product/src/lib.rs b/vm/vm_bench/tests/matrix_product/src/lib.rs index 43d9502f1f..ca49d79bed 100644 --- a/vm/vm_bench/tests/matrix_product/src/lib.rs +++ b/vm/vm_bench/tests/matrix_product/src/lib.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate rand; @@ -7,12 +22,14 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; +/// generates random matrix with given size by IsaacRng fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) + Matrix::from_fn(rows_number as usize, columns_count as usize, + |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) } -// computes hash of a matrix as its trace +/// computes hash of a matrix as its trace fn compute_matrix_hash(matrix: &Matrix) -> u64 { let mut trace : u64 = 0; @@ -24,7 +41,14 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { trace } -fn bench_test() -> u64 { +/// This test computes QR decomposition of randomly generated by IsaacRng square matrices of +/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new +/// matrices is generated by seed that computed as a xor of singular values of previously matrix +/// decomposition result. And as the first seed SEED parameter is used. +/// +/// Returns a final matrix_hash to prevent possible aggressive optimization. +#[no_mangle] +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -41,13 +65,3 @@ fn bench_test() -> u64 { matrix_hash } - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/matrix_product/src/settings.rs b/vm/vm_bench/tests/matrix_product/src/settings.rs index 45e5d1c1ed..0f90b04906 100644 --- a/vm/vm_bench/tests/matrix_product/src/settings.rs +++ b/vm/vm_bench/tests/matrix_product/src/settings.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ // this seed is used for deterministic operation count on different launches pub const SEED : &'static str = env!("SEED"); diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs b/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs index 3ee7a63bcd..1379c9c090 100644 --- a/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs +++ b/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate rand; @@ -7,12 +22,13 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; +/// generates random matrix with given size by IsaacRng fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } -// computes hash of a matrix as its trace +/// computes hash of a matrix as its trace fn compute_matrix_hash(matrix: &Matrix) -> f64 { let mut trace : f64 = 0.0; @@ -24,7 +40,14 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { trace } -fn bench_test() -> u64 { +/// This test computes QR decomposition of randomly generated by IsaacRng square matrices of +/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new +/// matrices is generated by seed that computed as a trace of previously matrix product result. And +/// as the first seed SEED parameter is used. +/// +/// Returns a final matrix_hash to prevent possible aggressive optimization. +#[no_mangle] +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -38,13 +61,3 @@ fn bench_test() -> u64 { matrix_hash } - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs b/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs index 14bc61f193..2532c80ef1 100644 --- a/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs +++ b/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs @@ -1,16 +1,31 @@ -// this seed is used for deterministic operation count on different launches +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// this seed is used for deterministic operation count on different launches pub const SEED : &'static str = env!("SEED"); -// matrix size +/// a matrix size pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); -// count of test iterations +/// count of test iterations pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); -// 1117 due to prevent overflow in matrix multiplication +/// 1117 due to prevent overflow in matrix multiplication pub const GENERATION_INTERVAL : f64 = 1117.0; pub extern crate nalgebra; use nalgebra::DMatrix; -// exactly matrix type +/// exactly matrix type pub type Matrix = DMatrix; diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs b/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs index cf26155e59..7f581c6232 100644 --- a/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs +++ b/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate rand; @@ -7,12 +22,20 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; +/// generates random matrix with given size by IsaacRng fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } -fn bench_test() -> u64 { +/// This test computes SVD decomposition of randomly generated by IsaacRng square matrices of +/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new +/// matrices is generated by seed that computed as a xor of singular values of previously matrix +/// decomposition result. And as the first seed SEED parameter is used. +/// +/// Returns a final matrix_hash to prevent possible aggressive optimization. +#[no_mangle] +pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); @@ -26,13 +49,3 @@ fn bench_test() -> u64 { matrix_hash } - -#[no_mangle] -pub extern "C" fn app_main() -> u64 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u64 { - bench_test() -} diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs b/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs index 3ba9a90334..3ae998a1a7 100644 --- a/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs +++ b/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs @@ -1,13 +1,28 @@ -// this seed is used for deterministic operation count on different launches +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// this seed is used for deterministic operation count on different launches pub const SEED : &'static str = env!("SEED"); -// matrix size +/// a matrix size pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); -// count of test iterations +/// count of test iterations pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); -// maximum value of matrix element +/// maximum value of matrix element pub const GENERATION_INTERVAL : f64 = 1117.0; pub extern crate nalgebra; diff --git a/vm/vm_bench/tests/recursive_hash/src/lib.rs b/vm/vm_bench/tests/recursive_hash/src/lib.rs index 923e2dd57c..b36f91374e 100644 --- a/vm/vm_bench/tests/recursive_hash/src/lib.rs +++ b/vm/vm_bench/tests/recursive_hash/src/lib.rs @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mod settings; extern crate sha3; @@ -5,7 +20,12 @@ use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; use sha3::{Digest, Sha3_256}; use std::mem; -fn bench_test() -> u8 { +/// This test compresses sequence of hashes (f(f(...f(initial_value)) ITERATIONS_COUNT times. As an +/// initial value INITIAL_VALUE is used. +/// +/// Returns a recursive xor of bytes of final hash result. +#[no_mangle] +pub extern "C" fn main() -> u8 { let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); @@ -18,13 +38,3 @@ fn bench_test() -> u8 { hash_result.iter().fold(0, |x1 ,x2| x1 ^ x2) } - -#[no_mangle] -pub extern "C" fn app_main() -> u8 { - bench_test() -} - -#[no_mangle] -pub extern "C" fn main() -> u8 { - bench_test() -} diff --git a/vm/vm_bench/tests/recursive_hash/src/settings.rs b/vm/vm_bench/tests/recursive_hash/src/settings.rs index 9fe5927ae7..be730bf7af 100644 --- a/vm/vm_bench/tests/recursive_hash/src/settings.rs +++ b/vm/vm_bench/tests/recursive_hash/src/settings.rs @@ -1,5 +1,20 @@ -// count of recursive sha3 that would be computed +/* + * Copyright 2018 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// count of recursive sha3 that would be computed pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); -// the initial value for computed hash chain +/// an initial value for computed hash chain pub const INITIAL_VALUE: &'static str = env!("INITIAL_VALUE"); From 334cf766d68a625c26772c318e886c9cb497cc38 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 23:37:56 +0300 Subject: [PATCH 27/48] update README.md --- vm/vm_bench/README.md | 101 ++++++++++++++++++ vm/vm_bench/tests/compression/src/lib.rs | 4 +- .../tests/factorization_reikna/src/lib.rs | 2 +- 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/vm/vm_bench/README.md b/vm/vm_bench/README.md index e69de29bb2..8484fd830c 100644 --- a/vm/vm_bench/README.md +++ b/vm/vm_bench/README.md @@ -0,0 +1,101 @@ +## VM benchmark tests + +This benchmark consists of seven tests that we used for perfomance tests of various Webassembly compiler and interpreter type virtual machines. Each test exports one function with name `main` (`main` because of `wasmer` doesn't support any other export function names) that should be called to bench. Also there are a few compile-time parameters in each test that can be adjusted on compilation by corresponding env variables (on the following part of readme upper-case naming will be used to mar them). + +### Compression + +This test compresses sequence of SEQUENCE_SIZE bytes randomly generated by IsaacRng in series. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new sequence is generated by seed that computed based on previously sequence. And as the first seed SEED parameter is used. Also there are two supported compression algorithms (deflate and snappy) that are chosen by "deflate_compression" feature. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +SEED= ITERATIONS_COUNT= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] +``` + +### Factorization + +This test simply factorizes given FACTORIZED_NUMBER by sieves from reikna library. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +FACTORIZED_NUMBER= cargo build --release --target wasm32-unknown-unknown +``` + +### Recursive fibonacci computing + +This test simply computes a given fibonacci number recursively. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +FIB_NUMBER= cargo build --release --target wasm32-unknown-unknown +``` + +### Matrix product + +This test computes QR decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a xor of singular values of previously matrix decomposition result. And as the first seed SEED parameter is used. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +``` + +### Matrix QR decomposition + +This test computes QR decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a trace of previously matrix product result. And as the first seed SEED parameter is used. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +``` + +### Matrix SVD decomposition + +This test computes SVD decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a xor of singular values of previously matrix decomposition result. And as the first seed SEED parameter is used. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +``` + +### Recursive hash computing + +This test computes a sequence of hashes `f(f(...f(initial_value))` ITERATIONS_COUNT times. As an initial value INITIAL_VALUE is used. + +To build this test on Linux/MacOS OS please use the following commands: + +```shell +git clone --recursive https://github.com/fluencelabs/fluence + +cd fluence/vm/vm_bench/tests/recursive_hash + +ITERATIONS_COUNT= INITIAL_VALUE= cargo +nightly build --release --target wasm32-unknown-unknown +``` diff --git a/vm/vm_bench/tests/compression/src/lib.rs b/vm/vm_bench/tests/compression/src/lib.rs index 91ec86df06..abfc30b6ae 100644 --- a/vm/vm_bench/tests/compression/src/lib.rs +++ b/vm/vm_bench/tests/compression/src/lib.rs @@ -51,7 +51,9 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { /// in series. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new /// sequence is generated by seed that computed based on previously sequence. And as the first /// seed SEED parameter is used. Also there are two supported compression algorithms (deflate -/// and snappy) that are choosed by "deflate_compression" feature. +/// and snappy) that are chosen by "deflate_compression" feature. +/// +/// Returns a final seed to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); diff --git a/vm/vm_bench/tests/factorization_reikna/src/lib.rs b/vm/vm_bench/tests/factorization_reikna/src/lib.rs index f863f3b026..13d590bf55 100644 --- a/vm/vm_bench/tests/factorization_reikna/src/lib.rs +++ b/vm/vm_bench/tests/factorization_reikna/src/lib.rs @@ -19,7 +19,7 @@ extern crate reikna; use settings::FACTORIZED_NUMBER; use reikna::prime; -/// This test simply factorizes given FACTORIZED_NUMBER by seievs from reikna library. +/// This test simply factorizes given FACTORIZED_NUMBER by sieves from reikna library. /// /// Returns a prime delimiter of FACTORIZED_NUMBER to prevent possible aggressive optimizations. #[no_mangle] From ab210ae1a9c0dd3222efbb62653f7a4de6094387 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 23:41:46 +0300 Subject: [PATCH 28/48] delete bencher and results --- vm/vm_bench/bencher/BenchTestGenerator.py | 40 ------ vm/vm_bench/bencher/TestDescriptor.py | 6 - vm/vm_bench/bencher/VMDescriptor.py | 5 - vm/vm_bench/bencher/WasmVMBencher.py | 51 ------- vm/vm_bench/bencher/main.py | 40 ------ vm/vm_bench/bencher/settings.py | 116 ---------------- vm/vm_bench/results/asmble.csv | 155 ---------------------- vm/vm_bench/results/wasmer.csv | 155 ---------------------- vm/vm_bench/results/wavm.csv | 155 ---------------------- 9 files changed, 723 deletions(-) delete mode 100644 vm/vm_bench/bencher/BenchTestGenerator.py delete mode 100644 vm/vm_bench/bencher/TestDescriptor.py delete mode 100644 vm/vm_bench/bencher/VMDescriptor.py delete mode 100644 vm/vm_bench/bencher/WasmVMBencher.py delete mode 100644 vm/vm_bench/bencher/main.py delete mode 100644 vm/vm_bench/bencher/settings.py delete mode 100644 vm/vm_bench/results/asmble.csv delete mode 100644 vm/vm_bench/results/wasmer.csv delete mode 100644 vm/vm_bench/results/wavm.csv diff --git a/vm/vm_bench/bencher/BenchTestGenerator.py b/vm/vm_bench/bencher/BenchTestGenerator.py deleted file mode 100644 index 72e56b8bdf..0000000000 --- a/vm/vm_bench/bencher/BenchTestGenerator.py +++ /dev/null @@ -1,40 +0,0 @@ -from os.path import join -from settings import * -from subprocess import call - - -class BenchTestGenerator: - - def __init__(self, test_dir): - self.tests_dir = test_dir - self.generated_tests_dir = "bench_tests" - self.rename_cmd = "" - - # compiles test with chosen parameters - def generate_tests(self, out_dir, test_descriptors): - call("mkdir {}".format(join(out_dir,self.generated_tests_dir)),shell=True) - - # to clean possible previous unsuccessfully build results that prevent cargo to build new tests - call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) - call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) - - generated_tests_dir_full_path = join(out_dir, self.generated_tests_dir) - test_mv_cmd = "mv " + join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm") + " " \ - + join(generated_tests_dir_full_path, "{}.wasm") - - for test_name, test_descriptor in test_descriptors.items(): - test_full_path = join(self.tests_dir, test_descriptor.test_folder_name) - test_cmd = test_descriptor.test_generator_cmd.format(test_full_path, out_dir) - - for key, value in test_descriptor.test_generator_params.items(): - test_cmd = "{}={} {}".format(key, value, test_cmd) - call(test_cmd, shell=True) - call(test_mv_cmd.format(test_descriptor.test_folder_name, test_name), shell=True) - - # collect garbage to force cargo build the same test with different env params again - call(("rm -rf " + join("{}", "wasm32-unknown-unknown")).format(out_dir), shell=True) - call(("rm -rf " + join("{}", "release")).format(out_dir), shell=True) - - test_descriptors[test_name].test_full_path = join(generated_tests_dir_full_path, "{}.wasm").format(test_name) - - return test_descriptors diff --git a/vm/vm_bench/bencher/TestDescriptor.py b/vm/vm_bench/bencher/TestDescriptor.py deleted file mode 100644 index cbc22a990b..0000000000 --- a/vm/vm_bench/bencher/TestDescriptor.py +++ /dev/null @@ -1,6 +0,0 @@ -class TestDescriptor: - def __init__(self, test_folder_name="", test_generator_cmd="", test_generator_params={}): - self.test_folder_name = test_folder_name - self.test_generator_cmd = test_generator_cmd - self.test_generator_params = test_generator_params - self.test_full_path = "" diff --git a/vm/vm_bench/bencher/VMDescriptor.py b/vm/vm_bench/bencher/VMDescriptor.py deleted file mode 100644 index 429723b009..0000000000 --- a/vm/vm_bench/bencher/VMDescriptor.py +++ /dev/null @@ -1,5 +0,0 @@ -class VMDescriptor: - def __init__(self, relative_vm_binary_path="", arg_str="", is_compiler_type=True): - self.relative_vm_binary_path = relative_vm_binary_path - self.arg_str = arg_str - self.is_compiler_type = is_compiler_type diff --git a/vm/vm_bench/bencher/WasmVMBencher.py b/vm/vm_bench/bencher/WasmVMBencher.py deleted file mode 100644 index 2d7ab63810..0000000000 --- a/vm/vm_bench/bencher/WasmVMBencher.py +++ /dev/null @@ -1,51 +0,0 @@ -from settings import interpretator_launch_count, compiler_launch_count, test_function_name - -from os import listdir -from os.path import join -from time import time -from subprocess import Popen -from collections import defaultdict - - -class Record: - def __init__(self, time=0, cpuLoad=0): - self.time = time - self.cpuLoad = cpuLoad # TODO - - -class WasmVMBencher: - - def __init__(self, vm_dir): - self.vm_dir = vm_dir - self.enabled_vm = listdir(vm_dir) - - def run_tests(self, test_descriptors, vm_descriptors): - # {{[]}} - results = defaultdict(lambda: defaultdict(list)) - - for test_name, test_descriptor in test_descriptors.items(): - print(": launch test", test_name) - for vm in self.enabled_vm: - if vm not in vm_descriptors: - continue - - vm_binary_full_path = join(self.vm_dir, vm, vm_descriptors[vm].relative_vm_binary_path) - cmd = vm_binary_full_path + " " \ - + vm_descriptors[vm].arg_str.format(wasm_file_path=test_descriptor.test_full_path, - function_name=test_function_name) - - launch_count = compiler_launch_count if vm_descriptors[vm].is_compiler_type \ - else interpretator_launch_count - for _ in range(launch_count): - print(cmd) - result_record = self.__do_one_test(cmd) - results[vm][test_name].append(result_record) - print(": {} result collected: time={}".format(vm, result_record.time)) - - return results - - def __do_one_test(self, vm_cmd): - start_time = time() - Popen(vm_cmd, shell=True).wait(None) - end_time = time() - return Record(end_time - start_time) diff --git a/vm/vm_bench/bencher/main.py b/vm/vm_bench/bencher/main.py deleted file mode 100644 index f282dfb977..0000000000 --- a/vm/vm_bench/bencher/main.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/python - -from BenchTestGenerator import BenchTestGenerator -from WasmVMBencher import WasmVMBencher -from settings import vm_descriptors, test_descriptors -import click -import csv - - -def save_test_results(results): - for vm in results: - with open(vm + ".csv", 'w', newline='') as vm_file: - fieldnames = ['test_path', 'elapsed_time'] - writer = csv.DictWriter(vm_file, fieldnames=fieldnames) - writer.writeheader() - - for test_name, result_records in results[vm].items(): - for record in result_records: - writer.writerow({"test_path" : test_name, "elapsed_time" : record.time}) - - -@click.command() -@click.option("--vm_dir", help="directory with Webassembly virtual machines") -@click.option("--tests_dir", help="directory with benchmark tests") -@click.option("--out_dir", help="directory where results will be saved") -def main(vm_dir, tests_dir, out_dir): - print(": starting generation tests") - test_generator = BenchTestGenerator(tests_dir) - filled_tests_descriptors = test_generator.generate_tests(out_dir, test_descriptors) - - print(": starting vm tests") - vm_bencher = WasmVMBencher(vm_dir) - test_results = vm_bencher.run_tests(filled_tests_descriptors, vm_descriptors) - - print(": starting collection of test results") - save_test_results(test_results) - - -if __name__ == '__main__': - main() diff --git a/vm/vm_bench/bencher/settings.py b/vm/vm_bench/bencher/settings.py deleted file mode 100644 index 1a42572c76..0000000000 --- a/vm/vm_bench/bencher/settings.py +++ /dev/null @@ -1,116 +0,0 @@ -from VMDescriptor import VMDescriptor -from TestDescriptor import TestDescriptor -from os.path import join - -# paths of Wasm VMs root directories -vm_descriptors = { - "wavm" : VMDescriptor(join("build_", "bin", "wavm-run"), - "{wasm_file_path} -f {function_name}", True), - "life" : VMDescriptor(join("life"), "-entry {function_name} {wasm_file_path}", False), - "wasmi" : VMDescriptor(join("target", "release", "examples", "invoke"), - "{wasm_file_path} {function_name}", False), - "wasmer" : VMDescriptor(join("target", "release", "wasmer"), "run {wasm_file_path}", True), -# "wagon" : VMDescriptor("", "", False), - "asmble" : VMDescriptor(join("asmble", "bin", "asmble"), - "invoke -in {wasm_file_path} {function_name} -defmaxmempages 20000", True) -} - -# launch count of interpretator-based VMs -interpretator_launch_count = 3 - -# launch count of compiler-based VMs -compiler_launch_count = 11 - -# export function name that should be called from Wasm module -test_function_name = "main" - -# paths of benchmark tests -test_descriptors = { - # compressions tests are generated both for a small sequence with a lot of iterations - # and for a huge sequence with a few iterations - "snappy_compression_5_1000000_1Kb" : - TestDescriptor("snappy_compression", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED" : 1, "ITERATIONS_COUNT" : 1000000, "SEQUENCE_SIZE" : 1024}), - - "snappy_compression_5_1000_10Mb" : - TestDescriptor("snappy_compression", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED" : 1, "ITERATIONS_COUNT" : 1000, "SEQUENCE_SIZE" : 10*1024*1024}), - - "deflate_compression_5_100000_1Kb" : - TestDescriptor("deflate_compression", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "ITERATIONS_COUNT": 100000, "SEQUENCE_SIZE": 1024}), - - "deflate_compression_5_10_10Mb" : - TestDescriptor("deflate_compression", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "ITERATIONS_COUNT": 10, "SEQUENCE_SIZE": 10 * 1024 * 1024}), - - "fibonacci_42" : - TestDescriptor("fibonacci_bigint", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"FIB_NUMBER": 42}), - - "fibonacci_50" : - TestDescriptor("fibonacci_bigint", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"FIB_NUMBER": 50}), - - "factorization_2147483647": - TestDescriptor("factorization_reikna", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"FACTORIZED_NUMBER": 2147483647}), - - "recursive_hash_10000000_0": - TestDescriptor("recursive_hash", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"ITERATIONS_COUNT": 10000000, "INITIAL_VALUE" : 0}), - - # matrix tests are generated both for a small matrix with a lot of iterations - # and for a huge matrix with a few iterations - "matrix_product_1_10_1000000": - TestDescriptor("matrix_product", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT" : 1000000}), - - "matrix_product_1_200_100": - TestDescriptor("matrix_product", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}), - - "svd_decomposition_1_10_1000000": - TestDescriptor("matrix_svd_decomposition", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT" : 1000000}), - - "svd_decomposition_1_200_100": - TestDescriptor("matrix_svd_decomposition", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}), - - "qr_decomposition_1_10_1000000": - TestDescriptor("matrix_qr_decomposition", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 10, "ITERATIONS_COUNT": 1000000}), - - "qr_decomposition_1_200_100": - TestDescriptor("matrix_qr_decomposition", - "cargo build --manifest-path {}/Cargo.toml --target-dir {} --release " - "--target wasm32-unknown-unknown", - {"SEED": 1, "MATRIX_SIZE": 200, "ITERATIONS_COUNT": 100}) -} diff --git a/vm/vm_bench/results/asmble.csv b/vm/vm_bench/results/asmble.csv deleted file mode 100644 index aa07623465..0000000000 --- a/vm/vm_bench/results/asmble.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,20.726524829864502 -snappy_compression_5_1000000_1Kb,21.03496503829956 -snappy_compression_5_1000000_1Kb,21.07230019569397 -snappy_compression_5_1000000_1Kb,21.279044151306152 -snappy_compression_5_1000000_1Kb,21.335103034973145 -snappy_compression_5_1000000_1Kb,21.234475135803223 -snappy_compression_5_1000000_1Kb,21.163483142852783 -snappy_compression_5_1000000_1Kb,21.064918994903564 -snappy_compression_5_1000000_1Kb,21.397541761398315 -snappy_compression_5_1000000_1Kb,21.149813890457153 -snappy_compression_5_1000000_1Kb,21.384167194366455 -snappy_compression_5_1000_10Mb,21.38349199295044 -snappy_compression_5_1000_10Mb,21.341899156570435 -snappy_compression_5_1000_10Mb,21.74799609184265 -snappy_compression_5_1000_10Mb,21.621104955673218 -snappy_compression_5_1000_10Mb,21.648022890090942 -snappy_compression_5_1000_10Mb,21.568861961364746 -snappy_compression_5_1000_10Mb,21.62322187423706 -snappy_compression_5_1000_10Mb,21.399152040481567 -snappy_compression_5_1000_10Mb,21.339909076690674 -snappy_compression_5_1000_10Mb,21.609938144683838 -snappy_compression_5_1000_10Mb,21.31721019744873 -deflate_compression_5_100000_1Kb,63.01013803482056 -deflate_compression_5_100000_1Kb,65.04713201522827 -deflate_compression_5_100000_1Kb,62.52873373031616 -deflate_compression_5_100000_1Kb,64.26173305511475 -deflate_compression_5_100000_1Kb,63.06211280822754 -deflate_compression_5_100000_1Kb,62.89547276496887 -deflate_compression_5_100000_1Kb,63.274219036102295 -deflate_compression_5_100000_1Kb,64.65362024307251 -deflate_compression_5_100000_1Kb,64.90634083747864 -deflate_compression_5_100000_1Kb,63.911845207214355 -deflate_compression_5_100000_1Kb,63.30595684051514 -deflate_compression_5_10_10Mb,63.04709720611572 -deflate_compression_5_10_10Mb,64.67240190505981 -deflate_compression_5_10_10Mb,64.5411970615387 -deflate_compression_5_10_10Mb,63.24651789665222 -deflate_compression_5_10_10Mb,62.48751997947693 -deflate_compression_5_10_10Mb,62.9459331035614 -deflate_compression_5_10_10Mb,64.79925513267517 -deflate_compression_5_10_10Mb,64.61253213882446 -deflate_compression_5_10_10Mb,63.227832078933716 -deflate_compression_5_10_10Mb,63.24809384346008 -deflate_compression_5_10_10Mb,64.21979308128357 -fibonacci_42,73.83689188957214 -fibonacci_42,72.73303985595703 -fibonacci_42,72.88571906089783 -fibonacci_42,72.67585396766663 -fibonacci_42,73.15689325332642 -fibonacci_42,73.23700308799744 -fibonacci_42,72.18646597862244 -fibonacci_42,73.53925585746765 -fibonacci_42,71.78964495658875 -fibonacci_42,74.36770486831665 -fibonacci_42,72.80925011634827 -fibonacci_50,72.10168790817261 -fibonacci_50,72.96367406845093 -fibonacci_50,72.70814824104309 -fibonacci_50,72.7207179069519 -fibonacci_50,71.75951981544495 -fibonacci_50,73.24424409866333 -fibonacci_50,72.13987803459167 -fibonacci_50,72.89511013031006 -fibonacci_50,73.10324811935425 -fibonacci_50,73.47930693626404 -fibonacci_50,72.53861975669861 -factorization_2147483647,13.22667384147644 -factorization_2147483647,13.605670928955078 -factorization_2147483647,13.293700218200684 -factorization_2147483647,13.016165018081665 -factorization_2147483647,13.581308841705322 -factorization_2147483647,13.912525177001953 -factorization_2147483647,15.045396089553833 -factorization_2147483647,14.744700908660889 -factorization_2147483647,14.344260931015015 -factorization_2147483647,13.789538621902466 -factorization_2147483647,13.76637887954712 -recursive_hash_10000000_0,17.889079809188843 -recursive_hash_10000000_0,18.56121277809143 -recursive_hash_10000000_0,18.46988868713379 -recursive_hash_10000000_0,21.0805561542511 -recursive_hash_10000000_0,21.279676914215088 -recursive_hash_10000000_0,19.35895299911499 -recursive_hash_10000000_0,19.368671894073486 -recursive_hash_10000000_0,17.923566818237305 -recursive_hash_10000000_0,17.709688901901245 -recursive_hash_10000000_0,17.54594612121582 -recursive_hash_10000000_0,17.478378772735596 -matrix_product_1_10_1000000,28.65305805206299 -matrix_product_1_10_1000000,28.046306133270264 -matrix_product_1_10_1000000,27.974605083465576 -matrix_product_1_10_1000000,28.0353262424469 -matrix_product_1_10_1000000,27.89697289466858 -matrix_product_1_10_1000000,28.20061492919922 -matrix_product_1_10_1000000,27.107964992523193 -matrix_product_1_10_1000000,26.898239135742188 -matrix_product_1_10_1000000,27.024434089660645 -matrix_product_1_10_1000000,26.906163930892944 -matrix_product_1_10_1000000,27.077481985092163 -matrix_product_1_200_100,28.122427225112915 -matrix_product_1_200_100,28.724907159805298 -matrix_product_1_200_100,29.15459108352661 -matrix_product_1_200_100,30.318928003311157 -matrix_product_1_200_100,29.829855918884277 -matrix_product_1_200_100,31.222463130950928 -matrix_product_1_200_100,29.227657318115234 -matrix_product_1_200_100,29.32576084136963 -matrix_product_1_200_100,27.436151027679443 -matrix_product_1_200_100,27.815643072128296 -matrix_product_1_200_100,29.732506275177002 -svd_decomposition_1_10_1000000,756.0404772758484 -svd_decomposition_1_10_1000000,655.4719252586365 -svd_decomposition_1_10_1000000,620.9246027469635 -svd_decomposition_1_10_1000000,630.0120990276337 -svd_decomposition_1_10_1000000,645.4520742893219 -svd_decomposition_1_10_1000000,655.5482919216156 -svd_decomposition_1_10_1000000,680.9745841026306 -svd_decomposition_1_10_1000000,682.4573440551758 -svd_decomposition_1_10_1000000,743.3740720748901 -svd_decomposition_1_10_1000000,721.9925141334534 -svd_decomposition_1_10_1000000,870.8123922348022 -svd_decomposition_1_200_100,629.2256848812103 -svd_decomposition_1_200_100,702.432363986969 -svd_decomposition_1_200_100,706.031455039978 -svd_decomposition_1_200_100,652.1148700714111 -svd_decomposition_1_200_100,800.6731190681458 -svd_decomposition_1_200_100,673.7515981197357 -svd_decomposition_1_200_100,629.6522281169891 -svd_decomposition_1_200_100,674.1115217208862 -svd_decomposition_1_200_100,677.715528011322 -svd_decomposition_1_200_100,650.3165521621704 -svd_decomposition_1_200_100,592.9430720806122 -qr_decomposition_1_10_1000000,12.601394891738892 -qr_decomposition_1_10_1000000,12.505298852920532 -qr_decomposition_1_10_1000000,12.378314971923828 -qr_decomposition_1_10_1000000,12.709280014038086 -qr_decomposition_1_10_1000000,12.491504907608032 -qr_decomposition_1_10_1000000,12.476433277130127 -qr_decomposition_1_10_1000000,12.480878829956055 -qr_decomposition_1_10_1000000,12.496170997619629 -qr_decomposition_1_10_1000000,12.4915189743042 -qr_decomposition_1_10_1000000,12.48329782485962 -qr_decomposition_1_10_1000000,13.333468198776245 -qr_decomposition_1_200_100,12.305270910263062 -qr_decomposition_1_200_100,12.298511981964111 -qr_decomposition_1_200_100,12.607870817184448 -qr_decomposition_1_200_100,12.451258897781372 -qr_decomposition_1_200_100,12.44648790359497 -qr_decomposition_1_200_100,12.511184215545654 -qr_decomposition_1_200_100,12.453485012054443 -qr_decomposition_1_200_100,12.490206003189087 -qr_decomposition_1_200_100,12.561767816543579 -qr_decomposition_1_200_100,12.536709070205688 -qr_decomposition_1_200_100,12.612308979034424 diff --git a/vm/vm_bench/results/wasmer.csv b/vm/vm_bench/results/wasmer.csv deleted file mode 100644 index a8d257dddd..0000000000 --- a/vm/vm_bench/results/wasmer.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,27.7688729763031 -snappy_compression_5_1000000_1Kb,26.533982038497925 -snappy_compression_5_1000000_1Kb,27.23807382583618 -snappy_compression_5_1000000_1Kb,26.176867961883545 -snappy_compression_5_1000000_1Kb,26.974048137664795 -snappy_compression_5_1000000_1Kb,26.824512004852295 -snappy_compression_5_1000000_1Kb,26.878080129623413 -snappy_compression_5_1000000_1Kb,26.31573987007141 -snappy_compression_5_1000000_1Kb,26.931299209594727 -snappy_compression_5_1000000_1Kb,26.83073902130127 -snappy_compression_5_1000000_1Kb,26.94623613357544 -snappy_compression_5_1000_10Mb,27.440106868743896 -snappy_compression_5_1000_10Mb,27.279486894607544 -snappy_compression_5_1000_10Mb,27.282124042510986 -snappy_compression_5_1000_10Mb,27.217063903808594 -snappy_compression_5_1000_10Mb,26.576902866363525 -snappy_compression_5_1000_10Mb,27.34129285812378 -snappy_compression_5_1000_10Mb,26.686068058013916 -snappy_compression_5_1000_10Mb,27.54439902305603 -snappy_compression_5_1000_10Mb,26.73086380958557 -snappy_compression_5_1000_10Mb,27.655193090438843 -snappy_compression_5_1000_10Mb,27.71091365814209 -deflate_compression_5_100000_1Kb,51.91492414474487 -deflate_compression_5_100000_1Kb,52.40915584564209 -deflate_compression_5_100000_1Kb,51.83877921104431 -deflate_compression_5_100000_1Kb,52.196123123168945 -deflate_compression_5_100000_1Kb,52.09947395324707 -deflate_compression_5_100000_1Kb,52.233049154281616 -deflate_compression_5_100000_1Kb,52.53088712692261 -deflate_compression_5_100000_1Kb,52.34496307373047 -deflate_compression_5_100000_1Kb,52.566028118133545 -deflate_compression_5_100000_1Kb,52.1095712184906 -deflate_compression_5_100000_1Kb,51.89137506484985 -deflate_compression_5_10_10Mb,51.521625995635986 -deflate_compression_5_10_10Mb,51.96341681480408 -deflate_compression_5_10_10Mb,51.95174598693848 -deflate_compression_5_10_10Mb,51.80925178527832 -deflate_compression_5_10_10Mb,51.83757495880127 -deflate_compression_5_10_10Mb,51.80482196807861 -deflate_compression_5_10_10Mb,51.956703901290894 -deflate_compression_5_10_10Mb,52.037959814071655 -deflate_compression_5_10_10Mb,51.559319734573364 -deflate_compression_5_10_10Mb,51.97579598426819 -deflate_compression_5_10_10Mb,52.34390115737915 -fibonacci_42,100.81164908409119 -fibonacci_42,101.16505908966064 -fibonacci_42,100.84431481361389 -fibonacci_42,100.68627214431763 -fibonacci_42,101.1809868812561 -fibonacci_42,101.69194006919861 -fibonacci_42,100.91333818435669 -fibonacci_42,100.79982781410217 -fibonacci_42,100.47869420051575 -fibonacci_42,100.70616793632507 -fibonacci_42,101.67957496643066 -fibonacci_50,116.6637179851532 -fibonacci_50,101.13963961601257 -fibonacci_50,121.63424110412598 -fibonacci_50,112.28407311439514 -fibonacci_50,120.0039587020874 -fibonacci_50,100.49020099639893 -fibonacci_50,100.72807478904724 -fibonacci_50,100.23609924316406 -fibonacci_50,100.48474335670471 -fibonacci_50,99.95040988922119 -fibonacci_50,99.62434411048889 -factorization_2147483647,32.438026905059814 -factorization_2147483647,32.77140235900879 -factorization_2147483647,32.29816293716431 -factorization_2147483647,32.58162498474121 -factorization_2147483647,32.242013931274414 -factorization_2147483647,32.83728098869324 -factorization_2147483647,32.73626399040222 -factorization_2147483647,32.67961812019348 -factorization_2147483647,32.526639223098755 -factorization_2147483647,38.35708999633789 -factorization_2147483647,33.12419366836548 -recursive_hash_10000000_0,27.137101650238037 -recursive_hash_10000000_0,28.48113703727722 -recursive_hash_10000000_0,28.19929814338684 -recursive_hash_10000000_0,25.598351001739502 -recursive_hash_10000000_0,27.23847985267639 -recursive_hash_10000000_0,26.772608995437622 -recursive_hash_10000000_0,26.640592098236084 -recursive_hash_10000000_0,28.706769227981567 -recursive_hash_10000000_0,26.74534296989441 -recursive_hash_10000000_0,32.3120219707489 -recursive_hash_10000000_0,27.122738122940063 -matrix_product_1_10_1000000,33.509279012680054 -matrix_product_1_10_1000000,33.12192511558533 -matrix_product_1_10_1000000,36.25976800918579 -matrix_product_1_10_1000000,38.40919589996338 -matrix_product_1_10_1000000,34.89144778251648 -matrix_product_1_10_1000000,39.26520109176636 -matrix_product_1_10_1000000,39.95768404006958 -matrix_product_1_10_1000000,40.353346824645996 -matrix_product_1_10_1000000,40.81225395202637 -matrix_product_1_10_1000000,41.3707001209259 -matrix_product_1_10_1000000,40.06730890274048 -matrix_product_1_200_100,38.87716197967529 -matrix_product_1_200_100,38.140708923339844 -matrix_product_1_200_100,37.70765805244446 -matrix_product_1_200_100,37.89401721954346 -matrix_product_1_200_100,38.986080169677734 -matrix_product_1_200_100,38.78080892562866 -matrix_product_1_200_100,38.98625588417053 -matrix_product_1_200_100,38.90069103240967 -matrix_product_1_200_100,38.60413312911987 -matrix_product_1_200_100,38.84670686721802 -matrix_product_1_200_100,38.90734386444092 -svd_decomposition_1_10_1000000,59.21647500991821 -svd_decomposition_1_10_1000000,59.71688771247864 -svd_decomposition_1_10_1000000,59.90468716621399 -svd_decomposition_1_10_1000000,60.01904082298279 -svd_decomposition_1_10_1000000,66.24443316459656 -svd_decomposition_1_10_1000000,60.99016714096069 -svd_decomposition_1_10_1000000,65.94958114624023 -svd_decomposition_1_10_1000000,66.70589995384216 -svd_decomposition_1_10_1000000,67.48255681991577 -svd_decomposition_1_10_1000000,66.67217302322388 -svd_decomposition_1_10_1000000,70.90477585792542 -svd_decomposition_1_200_100,93.07028794288635 -svd_decomposition_1_200_100,95.85169005393982 -svd_decomposition_1_200_100,96.43082594871521 -svd_decomposition_1_200_100,100.78293299674988 -svd_decomposition_1_200_100,101.1863489151001 -svd_decomposition_1_200_100,79.8322582244873 -svd_decomposition_1_200_100,51.3191339969635 -svd_decomposition_1_200_100,52.0533390045166 -svd_decomposition_1_200_100,51.398340940475464 -svd_decomposition_1_200_100,51.76226878166199 -svd_decomposition_1_200_100,51.610076904296875 -qr_decomposition_1_10_1000000,14.803030967712402 -qr_decomposition_1_10_1000000,14.679723978042603 -qr_decomposition_1_10_1000000,14.856477975845337 -qr_decomposition_1_10_1000000,14.627059936523438 -qr_decomposition_1_10_1000000,14.897404909133911 -qr_decomposition_1_10_1000000,14.94599986076355 -qr_decomposition_1_10_1000000,14.588797092437744 -qr_decomposition_1_10_1000000,14.891240119934082 -qr_decomposition_1_10_1000000,14.77375602722168 -qr_decomposition_1_10_1000000,14.556878805160522 -qr_decomposition_1_10_1000000,14.910651922225952 -qr_decomposition_1_200_100,14.48614501953125 -qr_decomposition_1_200_100,14.738097906112671 -qr_decomposition_1_200_100,14.750440120697021 -qr_decomposition_1_200_100,14.761280059814453 -qr_decomposition_1_200_100,14.512586832046509 -qr_decomposition_1_200_100,14.682394981384277 -qr_decomposition_1_200_100,14.788942098617554 -qr_decomposition_1_200_100,14.659065008163452 -qr_decomposition_1_200_100,14.843371868133545 -qr_decomposition_1_200_100,14.787256956100464 -qr_decomposition_1_200_100,14.840179204940796 diff --git a/vm/vm_bench/results/wavm.csv b/vm/vm_bench/results/wavm.csv deleted file mode 100644 index 025469e3f4..0000000000 --- a/vm/vm_bench/results/wavm.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,9.717528104782104 -snappy_compression_5_1000000_1Kb,9.714651823043823 -snappy_compression_5_1000000_1Kb,9.758702039718628 -snappy_compression_5_1000000_1Kb,9.782424926757812 -snappy_compression_5_1000000_1Kb,9.807159900665283 -snappy_compression_5_1000000_1Kb,9.874746084213257 -snappy_compression_5_1000000_1Kb,9.84822702407837 -snappy_compression_5_1000000_1Kb,9.816054105758667 -snappy_compression_5_1000000_1Kb,9.799592971801758 -snappy_compression_5_1000000_1Kb,9.870435953140259 -snappy_compression_5_1000000_1Kb,9.838435888290405 -snappy_compression_5_1000_10Mb,10.060152053833008 -snappy_compression_5_1000_10Mb,10.011566162109375 -snappy_compression_5_1000_10Mb,9.852818012237549 -snappy_compression_5_1000_10Mb,9.899932861328125 -snappy_compression_5_1000_10Mb,9.92128610610962 -snappy_compression_5_1000_10Mb,9.787997961044312 -snappy_compression_5_1000_10Mb,9.880560874938965 -snappy_compression_5_1000_10Mb,9.990480184555054 -snappy_compression_5_1000_10Mb,9.948058128356934 -snappy_compression_5_1000_10Mb,10.00252103805542 -snappy_compression_5_1000_10Mb,9.932419776916504 -deflate_compression_5_100000_1Kb,15.143059015274048 -deflate_compression_5_100000_1Kb,15.175490140914917 -deflate_compression_5_100000_1Kb,15.066927909851074 -deflate_compression_5_100000_1Kb,15.213164806365967 -deflate_compression_5_100000_1Kb,15.033859729766846 -deflate_compression_5_100000_1Kb,15.027947902679443 -deflate_compression_5_100000_1Kb,15.24101209640503 -deflate_compression_5_100000_1Kb,15.108386039733887 -deflate_compression_5_100000_1Kb,15.153640985488892 -deflate_compression_5_100000_1Kb,15.335155963897705 -deflate_compression_5_100000_1Kb,15.0716872215271 -deflate_compression_5_10_10Mb,15.144837141036987 -deflate_compression_5_10_10Mb,14.776844263076782 -deflate_compression_5_10_10Mb,14.890641927719116 -deflate_compression_5_10_10Mb,15.1025230884552 -deflate_compression_5_10_10Mb,15.177051067352295 -deflate_compression_5_10_10Mb,15.010737180709839 -deflate_compression_5_10_10Mb,15.033567905426025 -deflate_compression_5_10_10Mb,15.203015089035034 -deflate_compression_5_10_10Mb,15.10928988456726 -deflate_compression_5_10_10Mb,15.081895112991333 -deflate_compression_5_10_10Mb,14.840280055999756 -fibonacci_42,39.673710107803345 -fibonacci_42,39.74281883239746 -fibonacci_42,39.6746039390564 -fibonacci_42,39.5506329536438 -fibonacci_42,39.14682698249817 -fibonacci_42,39.66048502922058 -fibonacci_42,39.47613787651062 -fibonacci_42,39.395100116729736 -fibonacci_42,39.7700080871582 -fibonacci_42,39.45085120201111 -fibonacci_42,39.67223882675171 -fibonacci_50,39.28877902030945 -fibonacci_50,39.23145389556885 -fibonacci_50,39.34680700302124 -fibonacci_50,38.918346881866455 -fibonacci_50,38.61098909378052 -fibonacci_50,38.390175104141235 -fibonacci_50,38.36805987358093 -fibonacci_50,38.310194969177246 -fibonacci_50,38.29951620101929 -fibonacci_50,38.28630995750427 -fibonacci_50,38.39356994628906 -factorization_2147483647,10.811481237411499 -factorization_2147483647,10.782574892044067 -factorization_2147483647,10.770956039428711 -factorization_2147483647,10.760880947113037 -factorization_2147483647,10.985636711120605 -factorization_2147483647,10.9326331615448 -factorization_2147483647,11.01753282546997 -factorization_2147483647,11.250012159347534 -factorization_2147483647,10.907017230987549 -factorization_2147483647,10.905230045318604 -factorization_2147483647,10.887682676315308 -recursive_hash_10000000_0,8.460553884506226 -recursive_hash_10000000_0,8.545917272567749 -recursive_hash_10000000_0,8.451397895812988 -recursive_hash_10000000_0,8.508644819259644 -recursive_hash_10000000_0,8.379414081573486 -recursive_hash_10000000_0,8.362284183502197 -recursive_hash_10000000_0,8.411664247512817 -recursive_hash_10000000_0,8.399206161499023 -recursive_hash_10000000_0,8.468336820602417 -recursive_hash_10000000_0,8.571569919586182 -recursive_hash_10000000_0,8.633066177368164 -matrix_product_1_10_1000000,14.90010380744934 -matrix_product_1_10_1000000,14.900184869766235 -matrix_product_1_10_1000000,14.720311641693115 -matrix_product_1_10_1000000,14.972039937973022 -matrix_product_1_10_1000000,15.10330581665039 -matrix_product_1_10_1000000,15.489886045455933 -matrix_product_1_10_1000000,15.45845103263855 -matrix_product_1_10_1000000,15.03793716430664 -matrix_product_1_10_1000000,15.239566087722778 -matrix_product_1_10_1000000,15.18182110786438 -matrix_product_1_10_1000000,15.357434034347534 -matrix_product_1_200_100,15.596153020858765 -matrix_product_1_200_100,15.224766969680786 -matrix_product_1_200_100,15.167222023010254 -matrix_product_1_200_100,15.564743041992188 -matrix_product_1_200_100,15.377501964569092 -matrix_product_1_200_100,15.192561864852905 -matrix_product_1_200_100,15.521537065505981 -matrix_product_1_200_100,15.389590978622437 -matrix_product_1_200_100,15.498884201049805 -matrix_product_1_200_100,16.241212129592896 -matrix_product_1_200_100,17.530209064483643 -svd_decomposition_1_10_1000000,30.873584032058716 -svd_decomposition_1_10_1000000,34.93633580207825 -svd_decomposition_1_10_1000000,32.45456004142761 -svd_decomposition_1_10_1000000,32.9636127948761 -svd_decomposition_1_10_1000000,32.11340093612671 -svd_decomposition_1_10_1000000,31.22289276123047 -svd_decomposition_1_10_1000000,31.276212215423584 -svd_decomposition_1_10_1000000,31.659153699874878 -svd_decomposition_1_10_1000000,31.92449688911438 -svd_decomposition_1_10_1000000,32.02426600456238 -svd_decomposition_1_10_1000000,32.75420904159546 -svd_decomposition_1_200_100,17.757825136184692 -svd_decomposition_1_200_100,17.767619848251343 -svd_decomposition_1_200_100,17.778232097625732 -svd_decomposition_1_200_100,17.72095489501953 -svd_decomposition_1_200_100,17.587416887283325 -svd_decomposition_1_200_100,17.643022775650024 -svd_decomposition_1_200_100,17.587465286254883 -svd_decomposition_1_200_100,17.71707797050476 -svd_decomposition_1_200_100,17.670255184173584 -svd_decomposition_1_200_100,17.64920401573181 -svd_decomposition_1_200_100,17.508506298065186 -qr_decomposition_1_10_1000000,5.659765005111694 -qr_decomposition_1_10_1000000,5.716536045074463 -qr_decomposition_1_10_1000000,5.698207855224609 -qr_decomposition_1_10_1000000,5.744373083114624 -qr_decomposition_1_10_1000000,5.777857780456543 -qr_decomposition_1_10_1000000,5.655165910720825 -qr_decomposition_1_10_1000000,5.630970001220703 -qr_decomposition_1_10_1000000,5.703395843505859 -qr_decomposition_1_10_1000000,5.664350986480713 -qr_decomposition_1_10_1000000,5.606341123580933 -qr_decomposition_1_10_1000000,5.682938098907471 -qr_decomposition_1_200_100,5.599729061126709 -qr_decomposition_1_200_100,5.676383018493652 -qr_decomposition_1_200_100,5.7370240688323975 -qr_decomposition_1_200_100,5.617890119552612 -qr_decomposition_1_200_100,5.682607173919678 -qr_decomposition_1_200_100,5.653961896896362 -qr_decomposition_1_200_100,5.609421014785767 -qr_decomposition_1_200_100,5.657746315002441 -qr_decomposition_1_200_100,5.621825218200684 -qr_decomposition_1_200_100,5.662790060043335 -qr_decomposition_1_200_100,5.689028978347778 From 525103c5b25ca897d6c917b84cfd5d633484a0c1 Mon Sep 17 00:00:00 2001 From: vms Date: Mon, 3 Dec 2018 23:52:46 +0300 Subject: [PATCH 29/48] fix typos in readme --- vm/vm_bench/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/vm_bench/README.md b/vm/vm_bench/README.md index 8484fd830c..81c9fd77b5 100644 --- a/vm/vm_bench/README.md +++ b/vm/vm_bench/README.md @@ -1,6 +1,6 @@ ## VM benchmark tests -This benchmark consists of seven tests that we used for perfomance tests of various Webassembly compiler and interpreter type virtual machines. Each test exports one function with name `main` (`main` because of `wasmer` doesn't support any other export function names) that should be called to bench. Also there are a few compile-time parameters in each test that can be adjusted on compilation by corresponding env variables (on the following part of readme upper-case naming will be used to mar them). +This benchmark consists of seven tests that we used for measure performance of various Webassembly virtual machines both of compiler and interpreter types. Each test exports one function named `main` (`main` because of `wasmer` doesn't support any other export function names) that should be called for bench. Also there is a few compile-time parameters in each test that can be adjusted on compilation by corresponding environment variables (on the following part of readme upper-case naming will be used to mark them). ### Compression From d8910056cd817559b2630ade7b544ade3ace54a5 Mon Sep 17 00:00:00 2001 From: Alexander Demidko Date: Tue, 4 Dec 2018 11:27:34 +0300 Subject: [PATCH 30/48] readme update --- vm/vm_bench/README.md | 86 ++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/vm/vm_bench/README.md b/vm/vm_bench/README.md index 81c9fd77b5..f4930d9500 100644 --- a/vm/vm_bench/README.md +++ b/vm/vm_bench/README.md @@ -1,101 +1,87 @@ ## VM benchmark tests -This benchmark consists of seven tests that we used for measure performance of various Webassembly virtual machines both of compiler and interpreter types. Each test exports one function named `main` (`main` because of `wasmer` doesn't support any other export function names) that should be called for bench. Also there is a few compile-time parameters in each test that can be adjusted on compilation by corresponding environment variables (on the following part of readme upper-case naming will be used to mark them). +This benchmark consists of a few tests which can be used to measure performance of various WebAssembly virtual machines. Each test exports the `main` function which is called by the benchmark runner. There are also few compile-time parameters in each test that can be adjusted using the corresponding environment variables. Benchmark has been successfully tested on Mac and should also run smoothly on Linux. -### Compression - -This test compresses sequence of SEQUENCE_SIZE bytes randomly generated by IsaacRng in series. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new sequence is generated by seed that computed based on previously sequence. And as the first seed SEED parameter is used. Also there are two supported compression algorithms (deflate and snappy) that are chosen by "deflate_compression" feature. - -To build this test on Linux/MacOS OS please use the following commands: +Below we assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: ```shell git clone --recursive https://github.com/fluencelabs/fluence +cd fluence/vm/vm_bench/tests +``` + +### Compression + +This test compresses a sequence of `SEQUENCE_SIZE` bytes randomly generated by [IsaacRng](https://doc.rust-lang.org/1.0.0/rand/isaac/struct.IsaacRng.html) and has `ITERATIONS_COUNT` iterations of compressions. On each iteration a new sequence is generated by the seed that was computed based on the previous sequence. As the first seed the `SEED` parameter is used. Two compression algorithms (deflate and snappy) are supported and can be chosen by specifying the `deflate_compression` flag. -cd fluence/vm/vm_bench/tests/recursive_hash +To run: -SEED= ITERATIONS_COUNT= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] +```shell +cd recursive_hash +SEED= ITERATIONS_COUNT= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] ``` ### Factorization -This test simply factorizes given FACTORIZED_NUMBER by sieves from reikna library. +This test factorizes provided `FACTORIZED_NUMBER` using [reikna](https://docs.rs/reikna/0.10.0/reikna/) library. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -FACTORIZED_NUMBER= cargo build --release --target wasm32-unknown-unknown +cd factorization_reikna +FACTORIZED_NUMBER= cargo build --release --target wasm32-unknown-unknown ``` ### Recursive fibonacci computing -This test simply computes a given fibonacci number recursively. +This test recursively computes the Fibonacci number with the index `FIB_NUMBER`. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -FIB_NUMBER= cargo build --release --target wasm32-unknown-unknown +cd fibonacci_bigint +FIB_NUMBER= cargo build --release --target wasm32-unknown-unknown ``` ### Matrix product -This test computes QR decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a xor of singular values of previously matrix decomposition result. And as the first seed SEED parameter is used. +This test computes a product of random generated matrices of size `MATRIX_SIZE`. There are `ITERATIONS_COUNT` iterations; on each iteration new matrices are generated using the seed that was computed using the previous product result. As the first seed the `SEED` parameter is used. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +cd matrix_product +ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown ``` ### Matrix QR decomposition -This test computes QR decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a trace of previously matrix product result. And as the first seed SEED parameter is used. +This test computes a QR decomposition of random generated matrices of size `MATRIX_SIZE`. There are `ITERATIONS_COUNT` iterations of decomposition; on each iteration a new matrix is generated using the seed that was computed using the previous decomposition result. As the first seed the `SEED` parameter is used. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +cd matrix_qr_decomposition +ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown ``` ### Matrix SVD decomposition -This test computes SVD decomposition of randomly generated by IsaacRng square matrices of MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new matrices is generated by seed that computed as a xor of singular values of previously matrix decomposition result. And as the first seed SEED parameter is used. +This test computes an SVD decomposition of random generated matrices of size `MATRIX_SIZE`. There are `ITERATIONS_COUNT` iterations of decomposition; on each iteration a new matrix is generated using the seed that was computed using the previous decomposition result. As the first seed the `SEED` parameter is used. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -ITERATIONS_COUNT= INITIAL_VALUE= cargo build --release --target wasm32-unknown-unknown +cd matrix_svd_decomposition +ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown ``` ### Recursive hash computing -This test computes a sequence of hashes `f(f(...f(initial_value))` ITERATIONS_COUNT times. As an initial value INITIAL_VALUE is used. +This test iteratively computes a hash chain of length `ITERATIONS_COUNT`: `hash(hash( ... hash(x)))` where `x` is the initial value specified by `INITIAL_VALUE`. -To build this test on Linux/MacOS OS please use the following commands: +To run: ```shell -git clone --recursive https://github.com/fluencelabs/fluence - -cd fluence/vm/vm_bench/tests/recursive_hash - -ITERATIONS_COUNT= INITIAL_VALUE= cargo +nightly build --release --target wasm32-unknown-unknown +cd recursive_hash +ITERATIONS_COUNT= INITIAL_VALUE= cargo +nightly build --release --target wasm32-unknown-unknown ``` From 86229a48fee0f35d17480abd2e42b0a3b39865a6 Mon Sep 17 00:00:00 2001 From: Alexander Demidko Date: Tue, 4 Dec 2018 12:00:31 +0300 Subject: [PATCH 31/48] readme update --- vm/vm_bench/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vm/vm_bench/README.md b/vm/vm_bench/README.md index f4930d9500..8ce1be2eb2 100644 --- a/vm/vm_bench/README.md +++ b/vm/vm_bench/README.md @@ -1,8 +1,12 @@ ## VM benchmark tests -This benchmark consists of a few tests which can be used to measure performance of various WebAssembly virtual machines. Each test exports the `main` function which is called by the benchmark runner. There are also few compile-time parameters in each test that can be adjusted using the corresponding environment variables. Benchmark has been successfully tested on Mac and should also run smoothly on Linux. +This microbenchmark consists of a few tests which can be used to measure performance of various WebAssembly virtual machines. It should be noted this benchmark is by definition is not comprehensive and might not reflect performance on real life workloads. -Below we assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: +However, each test was crafted in a way that would prevent the virtual machine from optimizing them using the dead code elimination. Most tests also prevent intermediate results memoization (with `fibonacci_bigint` and `factorization_reikna` being exceptions) and allow to specify an RNG seed to obtain repeatable benchmark results. + +Each test exports the `main` function which is called by the benchmark runner. There are also few compile-time parameters in each test that can be adjusted using the corresponding environment variables. The benchmark has been successfully tested on Mac and should run smoothly on Linux as well. + +To run tests Rust Cargo package manager should be installed – the easiest way would be to follow [Rust instructions](https://doc.rust-lang.org/cargo/getting-started/installation.html). Below we also assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: ```shell git clone --recursive https://github.com/fluencelabs/fluence @@ -17,7 +21,7 @@ To run: ```shell cd recursive_hash -SEED= ITERATIONS_COUNT= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] +ITERATIONS_COUNT= SEED= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] ``` ### Factorization @@ -77,7 +81,7 @@ ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo ### Recursive hash computing -This test iteratively computes a hash chain of length `ITERATIONS_COUNT`: `hash(hash( ... hash(x)))` where `x` is the initial value specified by `INITIAL_VALUE`. +This test iteratively computes a hash chain `hash(hash( ... hash(x)))` of length `ITERATIONS_COUNT`, where `x` is the initial value specified by `INITIAL_VALUE`. To run: From 6cf6e4f4dc917f0242866ecbf76516117ab6ffc1 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 4 Dec 2018 15:39:23 +0300 Subject: [PATCH 32/48] change directories --- {vm/vm_bench => bench/vm}/README.md | 0 {vm/vm_bench => bench/vm}/tests/compression/Cargo.toml | 0 {vm/vm_bench => bench/vm}/tests/compression/src/lib.rs | 0 {vm/vm_bench => bench/vm}/tests/compression/src/settings.rs | 0 {vm/vm_bench => bench/vm}/tests/factorization_reikna/Cargo.toml | 0 {vm/vm_bench => bench/vm}/tests/factorization_reikna/src/lib.rs | 0 .../vm}/tests/factorization_reikna/src/settings.rs | 0 {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/Cargo.toml | 0 {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/src/lib.rs | 0 {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/src/settings.rs | 0 {vm/vm_bench => bench/vm}/tests/matrix_product/Cargo.toml | 0 {vm/vm_bench => bench/vm}/tests/matrix_product/src/lib.rs | 0 {vm/vm_bench => bench/vm}/tests/matrix_product/src/settings.rs | 0 .../vm}/tests/matrix_qr_decomposition/Cargo.toml | 0 .../vm}/tests/matrix_qr_decomposition/src/lib.rs | 0 .../vm}/tests/matrix_qr_decomposition/src/settings.rs | 0 .../vm}/tests/matrix_svd_decomposition/Cargo.toml | 0 .../vm}/tests/matrix_svd_decomposition/src/lib.rs | 0 .../vm}/tests/matrix_svd_decomposition/src/settings.rs | 0 {vm/vm_bench => bench/vm}/tests/recursive_hash/Cargo.toml | 0 {vm/vm_bench => bench/vm}/tests/recursive_hash/src/lib.rs | 0 {vm/vm_bench => bench/vm}/tests/recursive_hash/src/settings.rs | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {vm/vm_bench => bench/vm}/README.md (100%) rename {vm/vm_bench => bench/vm}/tests/compression/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/compression/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/compression/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/factorization_reikna/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/factorization_reikna/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/factorization_reikna/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/fibonacci_bigint/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_product/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_product/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_product/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_qr_decomposition/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_qr_decomposition/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_qr_decomposition/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_svd_decomposition/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_svd_decomposition/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/matrix_svd_decomposition/src/settings.rs (100%) rename {vm/vm_bench => bench/vm}/tests/recursive_hash/Cargo.toml (100%) rename {vm/vm_bench => bench/vm}/tests/recursive_hash/src/lib.rs (100%) rename {vm/vm_bench => bench/vm}/tests/recursive_hash/src/settings.rs (100%) diff --git a/vm/vm_bench/README.md b/bench/vm/README.md similarity index 100% rename from vm/vm_bench/README.md rename to bench/vm/README.md diff --git a/vm/vm_bench/tests/compression/Cargo.toml b/bench/vm/tests/compression/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/compression/Cargo.toml rename to bench/vm/tests/compression/Cargo.toml diff --git a/vm/vm_bench/tests/compression/src/lib.rs b/bench/vm/tests/compression/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/compression/src/lib.rs rename to bench/vm/tests/compression/src/lib.rs diff --git a/vm/vm_bench/tests/compression/src/settings.rs b/bench/vm/tests/compression/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/compression/src/settings.rs rename to bench/vm/tests/compression/src/settings.rs diff --git a/vm/vm_bench/tests/factorization_reikna/Cargo.toml b/bench/vm/tests/factorization_reikna/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/factorization_reikna/Cargo.toml rename to bench/vm/tests/factorization_reikna/Cargo.toml diff --git a/vm/vm_bench/tests/factorization_reikna/src/lib.rs b/bench/vm/tests/factorization_reikna/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/factorization_reikna/src/lib.rs rename to bench/vm/tests/factorization_reikna/src/lib.rs diff --git a/vm/vm_bench/tests/factorization_reikna/src/settings.rs b/bench/vm/tests/factorization_reikna/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/factorization_reikna/src/settings.rs rename to bench/vm/tests/factorization_reikna/src/settings.rs diff --git a/vm/vm_bench/tests/fibonacci_bigint/Cargo.toml b/bench/vm/tests/fibonacci_bigint/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/fibonacci_bigint/Cargo.toml rename to bench/vm/tests/fibonacci_bigint/Cargo.toml diff --git a/vm/vm_bench/tests/fibonacci_bigint/src/lib.rs b/bench/vm/tests/fibonacci_bigint/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/fibonacci_bigint/src/lib.rs rename to bench/vm/tests/fibonacci_bigint/src/lib.rs diff --git a/vm/vm_bench/tests/fibonacci_bigint/src/settings.rs b/bench/vm/tests/fibonacci_bigint/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/fibonacci_bigint/src/settings.rs rename to bench/vm/tests/fibonacci_bigint/src/settings.rs diff --git a/vm/vm_bench/tests/matrix_product/Cargo.toml b/bench/vm/tests/matrix_product/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/matrix_product/Cargo.toml rename to bench/vm/tests/matrix_product/Cargo.toml diff --git a/vm/vm_bench/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/matrix_product/src/lib.rs rename to bench/vm/tests/matrix_product/src/lib.rs diff --git a/vm/vm_bench/tests/matrix_product/src/settings.rs b/bench/vm/tests/matrix_product/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/matrix_product/src/settings.rs rename to bench/vm/tests/matrix_product/src/settings.rs diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/Cargo.toml b/bench/vm/tests/matrix_qr_decomposition/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/matrix_qr_decomposition/Cargo.toml rename to bench/vm/tests/matrix_qr_decomposition/Cargo.toml diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/matrix_qr_decomposition/src/lib.rs rename to bench/vm/tests/matrix_qr_decomposition/src/lib.rs diff --git a/vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs b/bench/vm/tests/matrix_qr_decomposition/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/matrix_qr_decomposition/src/settings.rs rename to bench/vm/tests/matrix_qr_decomposition/src/settings.rs diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/Cargo.toml b/bench/vm/tests/matrix_svd_decomposition/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/matrix_svd_decomposition/Cargo.toml rename to bench/vm/tests/matrix_svd_decomposition/Cargo.toml diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/matrix_svd_decomposition/src/lib.rs rename to bench/vm/tests/matrix_svd_decomposition/src/lib.rs diff --git a/vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs b/bench/vm/tests/matrix_svd_decomposition/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/matrix_svd_decomposition/src/settings.rs rename to bench/vm/tests/matrix_svd_decomposition/src/settings.rs diff --git a/vm/vm_bench/tests/recursive_hash/Cargo.toml b/bench/vm/tests/recursive_hash/Cargo.toml similarity index 100% rename from vm/vm_bench/tests/recursive_hash/Cargo.toml rename to bench/vm/tests/recursive_hash/Cargo.toml diff --git a/vm/vm_bench/tests/recursive_hash/src/lib.rs b/bench/vm/tests/recursive_hash/src/lib.rs similarity index 100% rename from vm/vm_bench/tests/recursive_hash/src/lib.rs rename to bench/vm/tests/recursive_hash/src/lib.rs diff --git a/vm/vm_bench/tests/recursive_hash/src/settings.rs b/bench/vm/tests/recursive_hash/src/settings.rs similarity index 100% rename from vm/vm_bench/tests/recursive_hash/src/settings.rs rename to bench/vm/tests/recursive_hash/src/settings.rs From 673d6bbc7c5ab6c8969989abacc6fc0f2700c70a Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 4 Dec 2018 19:12:27 +0300 Subject: [PATCH 33/48] udapte readme --- bench/vm/README.md | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/bench/vm/README.md b/bench/vm/README.md index 8ce1be2eb2..796c58bfae 100644 --- a/bench/vm/README.md +++ b/bench/vm/README.md @@ -6,22 +6,40 @@ However, each test was crafted in a way that would prevent the virtual machine f Each test exports the `main` function which is called by the benchmark runner. There are also few compile-time parameters in each test that can be adjusted using the corresponding environment variables. The benchmark has been successfully tested on Mac and should run smoothly on Linux as well. -To run tests Rust Cargo package manager should be installed – the easiest way would be to follow [Rust instructions](https://doc.rust-lang.org/cargo/getting-started/installation.html). Below we also assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: +To run tests Rust Cargo package manager should be installed – the easiest way would be to follow these instructions: + +```shell +# download and install rustup +curl -sSf https://static.rust-lang.org/rustup.sh | sh + +# install the latest nightly toolchain +~/.cargo/bin/rustup toolchain install nightly + +# make shure that Rust is up to date +rustup update + +# install the Webassembly target for Rust +rustup target add wasm32-unknown-unknown --toolchain nightly + +``` +Below we also assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: ```shell git clone --recursive https://github.com/fluencelabs/fluence cd fluence/vm/vm_bench/tests ``` +Everywhere in the tests all pseudo random numbers generated by [IsaacRng](https://doc.rust-lang.org/1.0.0/rand/isaac/struct.IsaacRng.html). Please also note that relative results of `Matrix QR decomposition` and `Matrix SVD decomposition` tests can be different on different hardware and OS by floating-point non-determinism and different floating-point support by hardware. + ### Compression -This test compresses a sequence of `SEQUENCE_SIZE` bytes randomly generated by [IsaacRng](https://doc.rust-lang.org/1.0.0/rand/isaac/struct.IsaacRng.html) and has `ITERATIONS_COUNT` iterations of compressions. On each iteration a new sequence is generated by the seed that was computed based on the previous sequence. As the first seed the `SEED` parameter is used. Two compression algorithms (deflate and snappy) are supported and can be chosen by specifying the `deflate_compression` flag. +This test compresses a sequence of `SEQUENCE_SIZE` bytes and has `ITERATIONS_COUNT` iterations of compressions. On each iteration a new sequence is generated by the seed that was computed based on the previous sequence. As the first seed the `SEED` parameter is used. Two compression algorithms ([deflate](https://docs.rs/deflate) and [snappy](https://docs.rs/snap)) are supported and can be chosen by specifying the `deflate_compression` flag. To run: ```shell cd recursive_hash -ITERATIONS_COUNT= SEED= SEQUENCE_SIZE= cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] +ITERATIONS_COUNT=1 SEED=1000000 SEQUENCE_SIZE=1024 cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] ``` ### Factorization @@ -32,7 +50,7 @@ To run: ```shell cd factorization_reikna -FACTORIZED_NUMBER= cargo build --release --target wasm32-unknown-unknown +FACTORIZED_NUMBER=2147483647 cargo +nightly build --release --target wasm32-unknown-unknown ``` ### Recursive fibonacci computing @@ -43,7 +61,7 @@ To run: ```shell cd fibonacci_bigint -FIB_NUMBER= cargo build --release --target wasm32-unknown-unknown +FIB_NUMBER=38 cargo +nightly build --release --target wasm32-unknown-unknown ``` ### Matrix product @@ -54,7 +72,7 @@ To run: ```shell cd matrix_product -ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown ``` ### Matrix QR decomposition @@ -65,7 +83,7 @@ To run: ```shell cd matrix_qr_decomposition -ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown ``` ### Matrix SVD decomposition @@ -76,7 +94,7 @@ To run: ```shell cd matrix_svd_decomposition -ITERATIONS_COUNT= SEED= MATRIX_SIZE= cargo build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown ``` ### Recursive hash computing @@ -87,5 +105,5 @@ To run: ```shell cd recursive_hash -ITERATIONS_COUNT= INITIAL_VALUE= cargo +nightly build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=10000000 INITIAL_VALUE=0 cargo +nightly build --release --target wasm32-unknown-unknown ``` From 49b8522bff95eaf275ebc1df2eb1f3bd023febf3 Mon Sep 17 00:00:00 2001 From: vms Date: Tue, 4 Dec 2018 19:17:26 +0300 Subject: [PATCH 34/48] remove redundant readme from docs --- bench/vm/tests/compression/src/lib.rs | 7 ------- bench/vm/tests/factorization_reikna/src/lib.rs | 3 --- bench/vm/tests/fibonacci_bigint/src/lib.rs | 4 ---- bench/vm/tests/matrix_product/src/lib.rs | 6 ------ bench/vm/tests/matrix_qr_decomposition/src/lib.rs | 6 ------ bench/vm/tests/matrix_svd_decomposition/src/lib.rs | 6 ------ bench/vm/tests/recursive_hash/src/lib.rs | 4 ---- 7 files changed, 36 deletions(-) diff --git a/bench/vm/tests/compression/src/lib.rs b/bench/vm/tests/compression/src/lib.rs index abfc30b6ae..9c15cd76f8 100644 --- a/bench/vm/tests/compression/src/lib.rs +++ b/bench/vm/tests/compression/src/lib.rs @@ -47,13 +47,6 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { return snap::Encoder::new().compress_vec(&sequence).unwrap(); } -/// This test compresses sequence of SEQUENCE_SIZE bytes randomly generated by IsaacRng -/// in series. There are ITERATIONS_COUNT iterations of compressions. On each iteration a new -/// sequence is generated by seed that computed based on previously sequence. And as the first -/// seed SEED parameter is used. Also there are two supported compression algorithms (deflate -/// and snappy) that are chosen by "deflate_compression" feature. -/// -/// Returns a final seed to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); diff --git a/bench/vm/tests/factorization_reikna/src/lib.rs b/bench/vm/tests/factorization_reikna/src/lib.rs index 13d590bf55..ed7ee18f1c 100644 --- a/bench/vm/tests/factorization_reikna/src/lib.rs +++ b/bench/vm/tests/factorization_reikna/src/lib.rs @@ -19,9 +19,6 @@ extern crate reikna; use settings::FACTORIZED_NUMBER; use reikna::prime; -/// This test simply factorizes given FACTORIZED_NUMBER by sieves from reikna library. -/// -/// Returns a prime delimiter of FACTORIZED_NUMBER to prevent possible aggressive optimizations. #[no_mangle] pub extern "C" fn main() -> u64 { let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); diff --git a/bench/vm/tests/fibonacci_bigint/src/lib.rs b/bench/vm/tests/fibonacci_bigint/src/lib.rs index 11d48402e7..5e74e79a7b 100644 --- a/bench/vm/tests/fibonacci_bigint/src/lib.rs +++ b/bench/vm/tests/fibonacci_bigint/src/lib.rs @@ -31,10 +31,6 @@ fn fib(num: &BigUint) -> BigUint { fib(&num.sub(1u32)) + fib(&num.sub(2u32)) } -/// This test simply computes a given fibonacci number recursively (bigint is used to prevent -/// interger overflows). -/// -/// Returns a xor value of bytes in computed fibonacci number to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u8 { let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); diff --git a/bench/vm/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs index ca49d79bed..23525118db 100644 --- a/bench/vm/tests/matrix_product/src/lib.rs +++ b/bench/vm/tests/matrix_product/src/lib.rs @@ -41,12 +41,6 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { trace } -/// This test computes QR decomposition of randomly generated by IsaacRng square matrices of -/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new -/// matrices is generated by seed that computed as a xor of singular values of previously matrix -/// decomposition result. And as the first seed SEED parameter is used. -/// -/// Returns a final matrix_hash to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index 1379c9c090..bdd877c5c7 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -40,12 +40,6 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { trace } -/// This test computes QR decomposition of randomly generated by IsaacRng square matrices of -/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new -/// matrices is generated by seed that computed as a trace of previously matrix product result. And -/// as the first seed SEED parameter is used. -/// -/// Returns a final matrix_hash to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs index 7f581c6232..b06768cb84 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs @@ -28,12 +28,6 @@ fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Ma Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } -/// This test computes SVD decomposition of randomly generated by IsaacRng square matrices of -/// MATRIX_SIZE. There are ITERATIONS_COUNT iterations of decompositions. On each iteration a new -/// matrices is generated by seed that computed as a xor of singular values of previously matrix -/// decomposition result. And as the first seed SEED parameter is used. -/// -/// Returns a final matrix_hash to prevent possible aggressive optimization. #[no_mangle] pub extern "C" fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); diff --git a/bench/vm/tests/recursive_hash/src/lib.rs b/bench/vm/tests/recursive_hash/src/lib.rs index b36f91374e..92c67d031e 100644 --- a/bench/vm/tests/recursive_hash/src/lib.rs +++ b/bench/vm/tests/recursive_hash/src/lib.rs @@ -20,10 +20,6 @@ use settings::{INITIAL_VALUE, ITERATIONS_COUNT}; use sha3::{Digest, Sha3_256}; use std::mem; -/// This test compresses sequence of hashes (f(f(...f(initial_value)) ITERATIONS_COUNT times. As an -/// initial value INITIAL_VALUE is used. -/// -/// Returns a recursive xor of bytes of final hash result. #[no_mangle] pub extern "C" fn main() -> u8 { let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); From 29703ea4d9b06465300bda3e2a246e43f197bb19 Mon Sep 17 00:00:00 2001 From: vms Date: Wed, 5 Dec 2018 12:29:00 +0300 Subject: [PATCH 35/48] update readme --- bench/vm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/vm/README.md b/bench/vm/README.md index 796c58bfae..c368fde449 100644 --- a/bench/vm/README.md +++ b/bench/vm/README.md @@ -29,7 +29,7 @@ git clone --recursive https://github.com/fluencelabs/fluence cd fluence/vm/vm_bench/tests ``` -Everywhere in the tests all pseudo random numbers generated by [IsaacRng](https://doc.rust-lang.org/1.0.0/rand/isaac/struct.IsaacRng.html). Please also note that relative results of `Matrix QR decomposition` and `Matrix SVD decomposition` tests can be different on different hardware and OS by floating-point non-determinism and different floating-point support by hardware. +Random numbers in tests are generated with [IsaacRng](https://doc.rust-lang.org/1.0.0/rand/isaac/struct.IsaacRng.html). It should also be noted relative results of the QR and SVG decomposition tests can be somewhat different on different hardware because of the floating point non-determinism. ### Compression From 97958f6fb2dcdd55e2ef7f7851c76ce4ecab188d Mon Sep 17 00:00:00 2001 From: vms Date: Wed, 5 Dec 2018 12:36:16 +0300 Subject: [PATCH 36/48] remove redundant empty line --- bench/vm/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/bench/vm/README.md b/bench/vm/README.md index c368fde449..e82b231299 100644 --- a/bench/vm/README.md +++ b/bench/vm/README.md @@ -20,7 +20,6 @@ rustup update # install the Webassembly target for Rust rustup target add wasm32-unknown-unknown --toolchain nightly - ``` Below we also assume that Fluence GitHub repo has been already cloned and we are in the `vm_bench/tests` directory: From f5969ed2aea74c1b6d1ef42c2603e2a03d1b5af9 Mon Sep 17 00:00:00 2001 From: vms Date: Wed, 5 Dec 2018 23:22:55 +0300 Subject: [PATCH 37/48] move README to tests directory --- bench/vm/{ => tests}/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bench/vm/{ => tests}/README.md (100%) diff --git a/bench/vm/README.md b/bench/vm/tests/README.md similarity index 100% rename from bench/vm/README.md rename to bench/vm/tests/README.md From 2a2ab03f43d9c2c34407f85471dc81bf9033b525 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 00:23:18 +0300 Subject: [PATCH 38/48] fix author email and compression test name --- bench/vm/tests/compression/Cargo.toml | 4 ++-- bench/vm/tests/factorization_reikna/Cargo.toml | 2 +- bench/vm/tests/fibonacci_bigint/Cargo.toml | 2 +- bench/vm/tests/matrix_product/Cargo.toml | 2 +- bench/vm/tests/matrix_qr_decomposition/Cargo.toml | 2 +- bench/vm/tests/matrix_svd_decomposition/Cargo.toml | 2 +- bench/vm/tests/recursive_hash/Cargo.toml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bench/vm/tests/compression/Cargo.toml b/bench/vm/tests/compression/Cargo.toml index eb1e5ab606..0f4021d87f 100644 --- a/bench/vm/tests/compression/Cargo.toml +++ b/bench/vm/tests/compression/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "snappy_compression" +name = "compression" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/factorization_reikna/Cargo.toml b/bench/vm/tests/factorization_reikna/Cargo.toml index fc49f1aa07..4cefdf0387 100644 --- a/bench/vm/tests/factorization_reikna/Cargo.toml +++ b/bench/vm/tests/factorization_reikna/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "factorization_reikna" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/fibonacci_bigint/Cargo.toml b/bench/vm/tests/fibonacci_bigint/Cargo.toml index 35b430a3d6..92f3abaf05 100644 --- a/bench/vm/tests/fibonacci_bigint/Cargo.toml +++ b/bench/vm/tests/fibonacci_bigint/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fibonacci_bigint" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_product/Cargo.toml b/bench/vm/tests/matrix_product/Cargo.toml index 2422b1415f..7b3403f8f1 100644 --- a/bench/vm/tests/matrix_product/Cargo.toml +++ b/bench/vm/tests/matrix_product/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_product" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_qr_decomposition/Cargo.toml b/bench/vm/tests/matrix_qr_decomposition/Cargo.toml index 4142c17c9d..3400050394 100644 --- a/bench/vm/tests/matrix_qr_decomposition/Cargo.toml +++ b/bench/vm/tests/matrix_qr_decomposition/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_qr_decomposition" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_svd_decomposition/Cargo.toml b/bench/vm/tests/matrix_svd_decomposition/Cargo.toml index bc18c35e97..b6a76ed376 100644 --- a/bench/vm/tests/matrix_svd_decomposition/Cargo.toml +++ b/bench/vm/tests/matrix_svd_decomposition/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_svd_decomposition" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/recursive_hash/Cargo.toml b/bench/vm/tests/recursive_hash/Cargo.toml index 6801a1225e..b068aef20b 100644 --- a/bench/vm/tests/recursive_hash/Cargo.toml +++ b/bench/vm/tests/recursive_hash/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "recursive_hash" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["M. Voronov "] [lib] crate-type = ["cdylib"] From d77202f1203e83b16859eb9b9d3632abc6c6fbb8 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 14:53:57 +0300 Subject: [PATCH 39/48] delete results from this pr --- bench/vm/results/asmble.csv | 155 ------------------------------------ bench/vm/results/life.csv | 43 ---------- bench/vm/results/wasmer.csv | 155 ------------------------------------ bench/vm/results/wasmi.csv | 40 ---------- bench/vm/results/wavm.csv | 155 ------------------------------------ 5 files changed, 548 deletions(-) delete mode 100644 bench/vm/results/asmble.csv delete mode 100644 bench/vm/results/life.csv delete mode 100644 bench/vm/results/wasmer.csv delete mode 100644 bench/vm/results/wasmi.csv delete mode 100644 bench/vm/results/wavm.csv diff --git a/bench/vm/results/asmble.csv b/bench/vm/results/asmble.csv deleted file mode 100644 index aa07623465..0000000000 --- a/bench/vm/results/asmble.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,20.726524829864502 -snappy_compression_5_1000000_1Kb,21.03496503829956 -snappy_compression_5_1000000_1Kb,21.07230019569397 -snappy_compression_5_1000000_1Kb,21.279044151306152 -snappy_compression_5_1000000_1Kb,21.335103034973145 -snappy_compression_5_1000000_1Kb,21.234475135803223 -snappy_compression_5_1000000_1Kb,21.163483142852783 -snappy_compression_5_1000000_1Kb,21.064918994903564 -snappy_compression_5_1000000_1Kb,21.397541761398315 -snappy_compression_5_1000000_1Kb,21.149813890457153 -snappy_compression_5_1000000_1Kb,21.384167194366455 -snappy_compression_5_1000_10Mb,21.38349199295044 -snappy_compression_5_1000_10Mb,21.341899156570435 -snappy_compression_5_1000_10Mb,21.74799609184265 -snappy_compression_5_1000_10Mb,21.621104955673218 -snappy_compression_5_1000_10Mb,21.648022890090942 -snappy_compression_5_1000_10Mb,21.568861961364746 -snappy_compression_5_1000_10Mb,21.62322187423706 -snappy_compression_5_1000_10Mb,21.399152040481567 -snappy_compression_5_1000_10Mb,21.339909076690674 -snappy_compression_5_1000_10Mb,21.609938144683838 -snappy_compression_5_1000_10Mb,21.31721019744873 -deflate_compression_5_100000_1Kb,63.01013803482056 -deflate_compression_5_100000_1Kb,65.04713201522827 -deflate_compression_5_100000_1Kb,62.52873373031616 -deflate_compression_5_100000_1Kb,64.26173305511475 -deflate_compression_5_100000_1Kb,63.06211280822754 -deflate_compression_5_100000_1Kb,62.89547276496887 -deflate_compression_5_100000_1Kb,63.274219036102295 -deflate_compression_5_100000_1Kb,64.65362024307251 -deflate_compression_5_100000_1Kb,64.90634083747864 -deflate_compression_5_100000_1Kb,63.911845207214355 -deflate_compression_5_100000_1Kb,63.30595684051514 -deflate_compression_5_10_10Mb,63.04709720611572 -deflate_compression_5_10_10Mb,64.67240190505981 -deflate_compression_5_10_10Mb,64.5411970615387 -deflate_compression_5_10_10Mb,63.24651789665222 -deflate_compression_5_10_10Mb,62.48751997947693 -deflate_compression_5_10_10Mb,62.9459331035614 -deflate_compression_5_10_10Mb,64.79925513267517 -deflate_compression_5_10_10Mb,64.61253213882446 -deflate_compression_5_10_10Mb,63.227832078933716 -deflate_compression_5_10_10Mb,63.24809384346008 -deflate_compression_5_10_10Mb,64.21979308128357 -fibonacci_42,73.83689188957214 -fibonacci_42,72.73303985595703 -fibonacci_42,72.88571906089783 -fibonacci_42,72.67585396766663 -fibonacci_42,73.15689325332642 -fibonacci_42,73.23700308799744 -fibonacci_42,72.18646597862244 -fibonacci_42,73.53925585746765 -fibonacci_42,71.78964495658875 -fibonacci_42,74.36770486831665 -fibonacci_42,72.80925011634827 -fibonacci_50,72.10168790817261 -fibonacci_50,72.96367406845093 -fibonacci_50,72.70814824104309 -fibonacci_50,72.7207179069519 -fibonacci_50,71.75951981544495 -fibonacci_50,73.24424409866333 -fibonacci_50,72.13987803459167 -fibonacci_50,72.89511013031006 -fibonacci_50,73.10324811935425 -fibonacci_50,73.47930693626404 -fibonacci_50,72.53861975669861 -factorization_2147483647,13.22667384147644 -factorization_2147483647,13.605670928955078 -factorization_2147483647,13.293700218200684 -factorization_2147483647,13.016165018081665 -factorization_2147483647,13.581308841705322 -factorization_2147483647,13.912525177001953 -factorization_2147483647,15.045396089553833 -factorization_2147483647,14.744700908660889 -factorization_2147483647,14.344260931015015 -factorization_2147483647,13.789538621902466 -factorization_2147483647,13.76637887954712 -recursive_hash_10000000_0,17.889079809188843 -recursive_hash_10000000_0,18.56121277809143 -recursive_hash_10000000_0,18.46988868713379 -recursive_hash_10000000_0,21.0805561542511 -recursive_hash_10000000_0,21.279676914215088 -recursive_hash_10000000_0,19.35895299911499 -recursive_hash_10000000_0,19.368671894073486 -recursive_hash_10000000_0,17.923566818237305 -recursive_hash_10000000_0,17.709688901901245 -recursive_hash_10000000_0,17.54594612121582 -recursive_hash_10000000_0,17.478378772735596 -matrix_product_1_10_1000000,28.65305805206299 -matrix_product_1_10_1000000,28.046306133270264 -matrix_product_1_10_1000000,27.974605083465576 -matrix_product_1_10_1000000,28.0353262424469 -matrix_product_1_10_1000000,27.89697289466858 -matrix_product_1_10_1000000,28.20061492919922 -matrix_product_1_10_1000000,27.107964992523193 -matrix_product_1_10_1000000,26.898239135742188 -matrix_product_1_10_1000000,27.024434089660645 -matrix_product_1_10_1000000,26.906163930892944 -matrix_product_1_10_1000000,27.077481985092163 -matrix_product_1_200_100,28.122427225112915 -matrix_product_1_200_100,28.724907159805298 -matrix_product_1_200_100,29.15459108352661 -matrix_product_1_200_100,30.318928003311157 -matrix_product_1_200_100,29.829855918884277 -matrix_product_1_200_100,31.222463130950928 -matrix_product_1_200_100,29.227657318115234 -matrix_product_1_200_100,29.32576084136963 -matrix_product_1_200_100,27.436151027679443 -matrix_product_1_200_100,27.815643072128296 -matrix_product_1_200_100,29.732506275177002 -svd_decomposition_1_10_1000000,756.0404772758484 -svd_decomposition_1_10_1000000,655.4719252586365 -svd_decomposition_1_10_1000000,620.9246027469635 -svd_decomposition_1_10_1000000,630.0120990276337 -svd_decomposition_1_10_1000000,645.4520742893219 -svd_decomposition_1_10_1000000,655.5482919216156 -svd_decomposition_1_10_1000000,680.9745841026306 -svd_decomposition_1_10_1000000,682.4573440551758 -svd_decomposition_1_10_1000000,743.3740720748901 -svd_decomposition_1_10_1000000,721.9925141334534 -svd_decomposition_1_10_1000000,870.8123922348022 -svd_decomposition_1_200_100,629.2256848812103 -svd_decomposition_1_200_100,702.432363986969 -svd_decomposition_1_200_100,706.031455039978 -svd_decomposition_1_200_100,652.1148700714111 -svd_decomposition_1_200_100,800.6731190681458 -svd_decomposition_1_200_100,673.7515981197357 -svd_decomposition_1_200_100,629.6522281169891 -svd_decomposition_1_200_100,674.1115217208862 -svd_decomposition_1_200_100,677.715528011322 -svd_decomposition_1_200_100,650.3165521621704 -svd_decomposition_1_200_100,592.9430720806122 -qr_decomposition_1_10_1000000,12.601394891738892 -qr_decomposition_1_10_1000000,12.505298852920532 -qr_decomposition_1_10_1000000,12.378314971923828 -qr_decomposition_1_10_1000000,12.709280014038086 -qr_decomposition_1_10_1000000,12.491504907608032 -qr_decomposition_1_10_1000000,12.476433277130127 -qr_decomposition_1_10_1000000,12.480878829956055 -qr_decomposition_1_10_1000000,12.496170997619629 -qr_decomposition_1_10_1000000,12.4915189743042 -qr_decomposition_1_10_1000000,12.48329782485962 -qr_decomposition_1_10_1000000,13.333468198776245 -qr_decomposition_1_200_100,12.305270910263062 -qr_decomposition_1_200_100,12.298511981964111 -qr_decomposition_1_200_100,12.607870817184448 -qr_decomposition_1_200_100,12.451258897781372 -qr_decomposition_1_200_100,12.44648790359497 -qr_decomposition_1_200_100,12.511184215545654 -qr_decomposition_1_200_100,12.453485012054443 -qr_decomposition_1_200_100,12.490206003189087 -qr_decomposition_1_200_100,12.561767816543579 -qr_decomposition_1_200_100,12.536709070205688 -qr_decomposition_1_200_100,12.612308979034424 diff --git a/bench/vm/results/life.csv b/bench/vm/results/life.csv deleted file mode 100644 index 052ce7cf2a..0000000000 --- a/bench/vm/results/life.csv +++ /dev/null @@ -1,43 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,3372.040552139282 -snappy_compression_5_1000000_1Kb,3369.16609787941 -snappy_compression_5_1000000_1Kb,3364.320676803589 -snappy_compression_5_1000_10Mb,3370.12322145784 -snappy_compression_5_1000_10Mb,3365.545552145883 -snappy_compression_5_1000_10Mb,3345.157264578305 -deflate_compression_5_100000_1Kb,3872.254865 -deflate_compression_5_100000_1Kb,3884.78231578351 -deflate_compression_5_100000_1Kb,3865.11254833152 -deflate_compression_5_10_10Mb,3872.254865 -deflate_compression_5_10_10Mb,3872.254865 -deflate_compression_5_10_10Mb,3872.254865 -fibonacci_42,1071.190172910690315 -fibonacci_42,1186.518988609314 -fibonacci_42,1190.238118171692 -fibonacci_50,1148.9854860305787 -fibonacci_50,1151.8070983886718 -fibonacci_50,1180.4042100906372 -factorization_2147483647,270.287030935287475 -factorization_2147483647,345.042396545410144 -factorization_2147483647,290.815813064575197 -recursive_hash_10000000_0,253.81661653518678 -recursive_hash_10000000_0,255.25934457778932 -recursive_hash_10000000_0,251.97618484497069 -matrix_product_1_10_1000000,745.005190372467 -matrix_product_1_10_1000000,778.546076774597144 -matrix_product_1_10_1000000,792.457436561584456 -matrix_product_1_200_100,1063.47933053970335 -matrix_product_1_200_100,1262.175052642822296 -matrix_product_1_200_100,1117.550668716430632 -svd_decomposition_1_10_1000000,3894.075905084609994 -svd_decomposition_1_10_1000000,3926.71311736106874 -svd_decomposition_1_10_1000000,3846.974102497100832 -svd_decomposition_1_200_100,2180.8396940231323 -svd_decomposition_1_200_100,3145.305422782897952 -svd_decomposition_1_200_100,2135.55368590354901 -qr_decomposition_1_10_1000000,568.727970123291003 -qr_decomposition_1_10_1000000,630.806128978729281 -qr_decomposition_1_10_1000000,625.037670135498033 -qr_decomposition_1_200_100,687.595468044281038 -qr_decomposition_1_200_100,688.372506380081138 -qr_decomposition_1_200_100,684.129389524459802 diff --git a/bench/vm/results/wasmer.csv b/bench/vm/results/wasmer.csv deleted file mode 100644 index a8d257dddd..0000000000 --- a/bench/vm/results/wasmer.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,27.7688729763031 -snappy_compression_5_1000000_1Kb,26.533982038497925 -snappy_compression_5_1000000_1Kb,27.23807382583618 -snappy_compression_5_1000000_1Kb,26.176867961883545 -snappy_compression_5_1000000_1Kb,26.974048137664795 -snappy_compression_5_1000000_1Kb,26.824512004852295 -snappy_compression_5_1000000_1Kb,26.878080129623413 -snappy_compression_5_1000000_1Kb,26.31573987007141 -snappy_compression_5_1000000_1Kb,26.931299209594727 -snappy_compression_5_1000000_1Kb,26.83073902130127 -snappy_compression_5_1000000_1Kb,26.94623613357544 -snappy_compression_5_1000_10Mb,27.440106868743896 -snappy_compression_5_1000_10Mb,27.279486894607544 -snappy_compression_5_1000_10Mb,27.282124042510986 -snappy_compression_5_1000_10Mb,27.217063903808594 -snappy_compression_5_1000_10Mb,26.576902866363525 -snappy_compression_5_1000_10Mb,27.34129285812378 -snappy_compression_5_1000_10Mb,26.686068058013916 -snappy_compression_5_1000_10Mb,27.54439902305603 -snappy_compression_5_1000_10Mb,26.73086380958557 -snappy_compression_5_1000_10Mb,27.655193090438843 -snappy_compression_5_1000_10Mb,27.71091365814209 -deflate_compression_5_100000_1Kb,51.91492414474487 -deflate_compression_5_100000_1Kb,52.40915584564209 -deflate_compression_5_100000_1Kb,51.83877921104431 -deflate_compression_5_100000_1Kb,52.196123123168945 -deflate_compression_5_100000_1Kb,52.09947395324707 -deflate_compression_5_100000_1Kb,52.233049154281616 -deflate_compression_5_100000_1Kb,52.53088712692261 -deflate_compression_5_100000_1Kb,52.34496307373047 -deflate_compression_5_100000_1Kb,52.566028118133545 -deflate_compression_5_100000_1Kb,52.1095712184906 -deflate_compression_5_100000_1Kb,51.89137506484985 -deflate_compression_5_10_10Mb,51.521625995635986 -deflate_compression_5_10_10Mb,51.96341681480408 -deflate_compression_5_10_10Mb,51.95174598693848 -deflate_compression_5_10_10Mb,51.80925178527832 -deflate_compression_5_10_10Mb,51.83757495880127 -deflate_compression_5_10_10Mb,51.80482196807861 -deflate_compression_5_10_10Mb,51.956703901290894 -deflate_compression_5_10_10Mb,52.037959814071655 -deflate_compression_5_10_10Mb,51.559319734573364 -deflate_compression_5_10_10Mb,51.97579598426819 -deflate_compression_5_10_10Mb,52.34390115737915 -fibonacci_42,100.81164908409119 -fibonacci_42,101.16505908966064 -fibonacci_42,100.84431481361389 -fibonacci_42,100.68627214431763 -fibonacci_42,101.1809868812561 -fibonacci_42,101.69194006919861 -fibonacci_42,100.91333818435669 -fibonacci_42,100.79982781410217 -fibonacci_42,100.47869420051575 -fibonacci_42,100.70616793632507 -fibonacci_42,101.67957496643066 -fibonacci_50,116.6637179851532 -fibonacci_50,101.13963961601257 -fibonacci_50,121.63424110412598 -fibonacci_50,112.28407311439514 -fibonacci_50,120.0039587020874 -fibonacci_50,100.49020099639893 -fibonacci_50,100.72807478904724 -fibonacci_50,100.23609924316406 -fibonacci_50,100.48474335670471 -fibonacci_50,99.95040988922119 -fibonacci_50,99.62434411048889 -factorization_2147483647,32.438026905059814 -factorization_2147483647,32.77140235900879 -factorization_2147483647,32.29816293716431 -factorization_2147483647,32.58162498474121 -factorization_2147483647,32.242013931274414 -factorization_2147483647,32.83728098869324 -factorization_2147483647,32.73626399040222 -factorization_2147483647,32.67961812019348 -factorization_2147483647,32.526639223098755 -factorization_2147483647,38.35708999633789 -factorization_2147483647,33.12419366836548 -recursive_hash_10000000_0,27.137101650238037 -recursive_hash_10000000_0,28.48113703727722 -recursive_hash_10000000_0,28.19929814338684 -recursive_hash_10000000_0,25.598351001739502 -recursive_hash_10000000_0,27.23847985267639 -recursive_hash_10000000_0,26.772608995437622 -recursive_hash_10000000_0,26.640592098236084 -recursive_hash_10000000_0,28.706769227981567 -recursive_hash_10000000_0,26.74534296989441 -recursive_hash_10000000_0,32.3120219707489 -recursive_hash_10000000_0,27.122738122940063 -matrix_product_1_10_1000000,33.509279012680054 -matrix_product_1_10_1000000,33.12192511558533 -matrix_product_1_10_1000000,36.25976800918579 -matrix_product_1_10_1000000,38.40919589996338 -matrix_product_1_10_1000000,34.89144778251648 -matrix_product_1_10_1000000,39.26520109176636 -matrix_product_1_10_1000000,39.95768404006958 -matrix_product_1_10_1000000,40.353346824645996 -matrix_product_1_10_1000000,40.81225395202637 -matrix_product_1_10_1000000,41.3707001209259 -matrix_product_1_10_1000000,40.06730890274048 -matrix_product_1_200_100,38.87716197967529 -matrix_product_1_200_100,38.140708923339844 -matrix_product_1_200_100,37.70765805244446 -matrix_product_1_200_100,37.89401721954346 -matrix_product_1_200_100,38.986080169677734 -matrix_product_1_200_100,38.78080892562866 -matrix_product_1_200_100,38.98625588417053 -matrix_product_1_200_100,38.90069103240967 -matrix_product_1_200_100,38.60413312911987 -matrix_product_1_200_100,38.84670686721802 -matrix_product_1_200_100,38.90734386444092 -svd_decomposition_1_10_1000000,59.21647500991821 -svd_decomposition_1_10_1000000,59.71688771247864 -svd_decomposition_1_10_1000000,59.90468716621399 -svd_decomposition_1_10_1000000,60.01904082298279 -svd_decomposition_1_10_1000000,66.24443316459656 -svd_decomposition_1_10_1000000,60.99016714096069 -svd_decomposition_1_10_1000000,65.94958114624023 -svd_decomposition_1_10_1000000,66.70589995384216 -svd_decomposition_1_10_1000000,67.48255681991577 -svd_decomposition_1_10_1000000,66.67217302322388 -svd_decomposition_1_10_1000000,70.90477585792542 -svd_decomposition_1_200_100,93.07028794288635 -svd_decomposition_1_200_100,95.85169005393982 -svd_decomposition_1_200_100,96.43082594871521 -svd_decomposition_1_200_100,100.78293299674988 -svd_decomposition_1_200_100,101.1863489151001 -svd_decomposition_1_200_100,79.8322582244873 -svd_decomposition_1_200_100,51.3191339969635 -svd_decomposition_1_200_100,52.0533390045166 -svd_decomposition_1_200_100,51.398340940475464 -svd_decomposition_1_200_100,51.76226878166199 -svd_decomposition_1_200_100,51.610076904296875 -qr_decomposition_1_10_1000000,14.803030967712402 -qr_decomposition_1_10_1000000,14.679723978042603 -qr_decomposition_1_10_1000000,14.856477975845337 -qr_decomposition_1_10_1000000,14.627059936523438 -qr_decomposition_1_10_1000000,14.897404909133911 -qr_decomposition_1_10_1000000,14.94599986076355 -qr_decomposition_1_10_1000000,14.588797092437744 -qr_decomposition_1_10_1000000,14.891240119934082 -qr_decomposition_1_10_1000000,14.77375602722168 -qr_decomposition_1_10_1000000,14.556878805160522 -qr_decomposition_1_10_1000000,14.910651922225952 -qr_decomposition_1_200_100,14.48614501953125 -qr_decomposition_1_200_100,14.738097906112671 -qr_decomposition_1_200_100,14.750440120697021 -qr_decomposition_1_200_100,14.761280059814453 -qr_decomposition_1_200_100,14.512586832046509 -qr_decomposition_1_200_100,14.682394981384277 -qr_decomposition_1_200_100,14.788942098617554 -qr_decomposition_1_200_100,14.659065008163452 -qr_decomposition_1_200_100,14.843371868133545 -qr_decomposition_1_200_100,14.787256956100464 -qr_decomposition_1_200_100,14.840179204940796 diff --git a/bench/vm/results/wasmi.csv b/bench/vm/results/wasmi.csv deleted file mode 100644 index 081e9e3b78..0000000000 --- a/bench/vm/results/wasmi.csv +++ /dev/null @@ -1,40 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,1025.0220577716827 -snappy_compression_5_1000000_1Kb,1024.2371897697449 -snappy_compression_5_1000000_1Kb,1024.9557831287384 -snappy_compression_5_1000_10Mb,1094.28639411926274 -snappy_compression_5_1000_10Mb,1091.3414716720582 -snappy_compression_5_1000_10Mb,1098.95282030105594 -deflate_compression_5_100000_1Kb,1819.097027301788366 -deflate_compression_5_100000_1Kb,1828.114710807800327 -deflate_compression_5_100000_1Kb,1844.16246366500863 -deflate_compression_5_10_10Mb,1816.299198865890519 -deflate_compression_5_10_10Mb,1795.673886775970476 -deflate_compression_5_10_10Mb,1839.564825773239114 -fibonacci_42,834.59919548034666 -fibonacci_42,833.11701536178591 -fibonacci_42,804.28984022140509 -factorization_2147483647,242.38572216033934 -factorization_2147483647,239.954379081726078 -factorization_2147483647,241.68400764465331 -recursive_hash_10000000_0,209.48535203933715 -recursive_hash_10000000_0,228.645094156265259 -recursive_hash_10000000_0,209.980154037475575 -matrix_product_1_10_1000000,650.575213909149186 -matrix_product_1_10_1000000,645.012229442596428 -matrix_product_1_10_1000000,634.33884429931638 -matrix_product_1_200_100,700.41343688964846 -matrix_product_1_200_100,713.990705013275126 -matrix_product_1_200_100,692.531594038009665 -svd_decomposition_1_10_1000000,1123.96903276443485 -svd_decomposition_1_10_1000000,1117.3573911190033 -svd_decomposition_1_10_1000000,1108.07037949562073 -svd_decomposition_1_200_100,655.53188490867612 -svd_decomposition_1_200_100,655.67533111572261 -svd_decomposition_1_200_100,647.814733028411882 -qr_decomposition_1_10_1000000,229.77492332458496 -qr_decomposition_1_10_1000000,231.861802339553825 -qr_decomposition_1_10_1000000,229.859986066818253 -qr_decomposition_1_200_100,219.251183509826676 -qr_decomposition_1_200_100,175.546491861343385 -qr_decomposition_1_200_100,209.196590185165394 diff --git a/bench/vm/results/wavm.csv b/bench/vm/results/wavm.csv deleted file mode 100644 index 025469e3f4..0000000000 --- a/bench/vm/results/wavm.csv +++ /dev/null @@ -1,155 +0,0 @@ -test_path,elapsed_time -snappy_compression_5_1000000_1Kb,9.717528104782104 -snappy_compression_5_1000000_1Kb,9.714651823043823 -snappy_compression_5_1000000_1Kb,9.758702039718628 -snappy_compression_5_1000000_1Kb,9.782424926757812 -snappy_compression_5_1000000_1Kb,9.807159900665283 -snappy_compression_5_1000000_1Kb,9.874746084213257 -snappy_compression_5_1000000_1Kb,9.84822702407837 -snappy_compression_5_1000000_1Kb,9.816054105758667 -snappy_compression_5_1000000_1Kb,9.799592971801758 -snappy_compression_5_1000000_1Kb,9.870435953140259 -snappy_compression_5_1000000_1Kb,9.838435888290405 -snappy_compression_5_1000_10Mb,10.060152053833008 -snappy_compression_5_1000_10Mb,10.011566162109375 -snappy_compression_5_1000_10Mb,9.852818012237549 -snappy_compression_5_1000_10Mb,9.899932861328125 -snappy_compression_5_1000_10Mb,9.92128610610962 -snappy_compression_5_1000_10Mb,9.787997961044312 -snappy_compression_5_1000_10Mb,9.880560874938965 -snappy_compression_5_1000_10Mb,9.990480184555054 -snappy_compression_5_1000_10Mb,9.948058128356934 -snappy_compression_5_1000_10Mb,10.00252103805542 -snappy_compression_5_1000_10Mb,9.932419776916504 -deflate_compression_5_100000_1Kb,15.143059015274048 -deflate_compression_5_100000_1Kb,15.175490140914917 -deflate_compression_5_100000_1Kb,15.066927909851074 -deflate_compression_5_100000_1Kb,15.213164806365967 -deflate_compression_5_100000_1Kb,15.033859729766846 -deflate_compression_5_100000_1Kb,15.027947902679443 -deflate_compression_5_100000_1Kb,15.24101209640503 -deflate_compression_5_100000_1Kb,15.108386039733887 -deflate_compression_5_100000_1Kb,15.153640985488892 -deflate_compression_5_100000_1Kb,15.335155963897705 -deflate_compression_5_100000_1Kb,15.0716872215271 -deflate_compression_5_10_10Mb,15.144837141036987 -deflate_compression_5_10_10Mb,14.776844263076782 -deflate_compression_5_10_10Mb,14.890641927719116 -deflate_compression_5_10_10Mb,15.1025230884552 -deflate_compression_5_10_10Mb,15.177051067352295 -deflate_compression_5_10_10Mb,15.010737180709839 -deflate_compression_5_10_10Mb,15.033567905426025 -deflate_compression_5_10_10Mb,15.203015089035034 -deflate_compression_5_10_10Mb,15.10928988456726 -deflate_compression_5_10_10Mb,15.081895112991333 -deflate_compression_5_10_10Mb,14.840280055999756 -fibonacci_42,39.673710107803345 -fibonacci_42,39.74281883239746 -fibonacci_42,39.6746039390564 -fibonacci_42,39.5506329536438 -fibonacci_42,39.14682698249817 -fibonacci_42,39.66048502922058 -fibonacci_42,39.47613787651062 -fibonacci_42,39.395100116729736 -fibonacci_42,39.7700080871582 -fibonacci_42,39.45085120201111 -fibonacci_42,39.67223882675171 -fibonacci_50,39.28877902030945 -fibonacci_50,39.23145389556885 -fibonacci_50,39.34680700302124 -fibonacci_50,38.918346881866455 -fibonacci_50,38.61098909378052 -fibonacci_50,38.390175104141235 -fibonacci_50,38.36805987358093 -fibonacci_50,38.310194969177246 -fibonacci_50,38.29951620101929 -fibonacci_50,38.28630995750427 -fibonacci_50,38.39356994628906 -factorization_2147483647,10.811481237411499 -factorization_2147483647,10.782574892044067 -factorization_2147483647,10.770956039428711 -factorization_2147483647,10.760880947113037 -factorization_2147483647,10.985636711120605 -factorization_2147483647,10.9326331615448 -factorization_2147483647,11.01753282546997 -factorization_2147483647,11.250012159347534 -factorization_2147483647,10.907017230987549 -factorization_2147483647,10.905230045318604 -factorization_2147483647,10.887682676315308 -recursive_hash_10000000_0,8.460553884506226 -recursive_hash_10000000_0,8.545917272567749 -recursive_hash_10000000_0,8.451397895812988 -recursive_hash_10000000_0,8.508644819259644 -recursive_hash_10000000_0,8.379414081573486 -recursive_hash_10000000_0,8.362284183502197 -recursive_hash_10000000_0,8.411664247512817 -recursive_hash_10000000_0,8.399206161499023 -recursive_hash_10000000_0,8.468336820602417 -recursive_hash_10000000_0,8.571569919586182 -recursive_hash_10000000_0,8.633066177368164 -matrix_product_1_10_1000000,14.90010380744934 -matrix_product_1_10_1000000,14.900184869766235 -matrix_product_1_10_1000000,14.720311641693115 -matrix_product_1_10_1000000,14.972039937973022 -matrix_product_1_10_1000000,15.10330581665039 -matrix_product_1_10_1000000,15.489886045455933 -matrix_product_1_10_1000000,15.45845103263855 -matrix_product_1_10_1000000,15.03793716430664 -matrix_product_1_10_1000000,15.239566087722778 -matrix_product_1_10_1000000,15.18182110786438 -matrix_product_1_10_1000000,15.357434034347534 -matrix_product_1_200_100,15.596153020858765 -matrix_product_1_200_100,15.224766969680786 -matrix_product_1_200_100,15.167222023010254 -matrix_product_1_200_100,15.564743041992188 -matrix_product_1_200_100,15.377501964569092 -matrix_product_1_200_100,15.192561864852905 -matrix_product_1_200_100,15.521537065505981 -matrix_product_1_200_100,15.389590978622437 -matrix_product_1_200_100,15.498884201049805 -matrix_product_1_200_100,16.241212129592896 -matrix_product_1_200_100,17.530209064483643 -svd_decomposition_1_10_1000000,30.873584032058716 -svd_decomposition_1_10_1000000,34.93633580207825 -svd_decomposition_1_10_1000000,32.45456004142761 -svd_decomposition_1_10_1000000,32.9636127948761 -svd_decomposition_1_10_1000000,32.11340093612671 -svd_decomposition_1_10_1000000,31.22289276123047 -svd_decomposition_1_10_1000000,31.276212215423584 -svd_decomposition_1_10_1000000,31.659153699874878 -svd_decomposition_1_10_1000000,31.92449688911438 -svd_decomposition_1_10_1000000,32.02426600456238 -svd_decomposition_1_10_1000000,32.75420904159546 -svd_decomposition_1_200_100,17.757825136184692 -svd_decomposition_1_200_100,17.767619848251343 -svd_decomposition_1_200_100,17.778232097625732 -svd_decomposition_1_200_100,17.72095489501953 -svd_decomposition_1_200_100,17.587416887283325 -svd_decomposition_1_200_100,17.643022775650024 -svd_decomposition_1_200_100,17.587465286254883 -svd_decomposition_1_200_100,17.71707797050476 -svd_decomposition_1_200_100,17.670255184173584 -svd_decomposition_1_200_100,17.64920401573181 -svd_decomposition_1_200_100,17.508506298065186 -qr_decomposition_1_10_1000000,5.659765005111694 -qr_decomposition_1_10_1000000,5.716536045074463 -qr_decomposition_1_10_1000000,5.698207855224609 -qr_decomposition_1_10_1000000,5.744373083114624 -qr_decomposition_1_10_1000000,5.777857780456543 -qr_decomposition_1_10_1000000,5.655165910720825 -qr_decomposition_1_10_1000000,5.630970001220703 -qr_decomposition_1_10_1000000,5.703395843505859 -qr_decomposition_1_10_1000000,5.664350986480713 -qr_decomposition_1_10_1000000,5.606341123580933 -qr_decomposition_1_10_1000000,5.682938098907471 -qr_decomposition_1_200_100,5.599729061126709 -qr_decomposition_1_200_100,5.676383018493652 -qr_decomposition_1_200_100,5.7370240688323975 -qr_decomposition_1_200_100,5.617890119552612 -qr_decomposition_1_200_100,5.682607173919678 -qr_decomposition_1_200_100,5.653961896896362 -qr_decomposition_1_200_100,5.609421014785767 -qr_decomposition_1_200_100,5.657746315002441 -qr_decomposition_1_200_100,5.621825218200684 -qr_decomposition_1_200_100,5.662790060043335 -qr_decomposition_1_200_100,5.689028978347778 From ac438153604f81cb53723153fa48d0d8ee062fd8 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 14:57:55 +0300 Subject: [PATCH 40/48] Revert "delete results from this pr" This reverts commit d77202f1203e83b16859eb9b9d3632abc6c6fbb8. --- bench/vm/results/asmble.csv | 155 ++++++++++++++++++++++++++++++++++++ bench/vm/results/life.csv | 43 ++++++++++ bench/vm/results/wasmer.csv | 155 ++++++++++++++++++++++++++++++++++++ bench/vm/results/wasmi.csv | 40 ++++++++++ bench/vm/results/wavm.csv | 155 ++++++++++++++++++++++++++++++++++++ 5 files changed, 548 insertions(+) create mode 100644 bench/vm/results/asmble.csv create mode 100644 bench/vm/results/life.csv create mode 100644 bench/vm/results/wasmer.csv create mode 100644 bench/vm/results/wasmi.csv create mode 100644 bench/vm/results/wavm.csv diff --git a/bench/vm/results/asmble.csv b/bench/vm/results/asmble.csv new file mode 100644 index 0000000000..aa07623465 --- /dev/null +++ b/bench/vm/results/asmble.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,20.726524829864502 +snappy_compression_5_1000000_1Kb,21.03496503829956 +snappy_compression_5_1000000_1Kb,21.07230019569397 +snappy_compression_5_1000000_1Kb,21.279044151306152 +snappy_compression_5_1000000_1Kb,21.335103034973145 +snappy_compression_5_1000000_1Kb,21.234475135803223 +snappy_compression_5_1000000_1Kb,21.163483142852783 +snappy_compression_5_1000000_1Kb,21.064918994903564 +snappy_compression_5_1000000_1Kb,21.397541761398315 +snappy_compression_5_1000000_1Kb,21.149813890457153 +snappy_compression_5_1000000_1Kb,21.384167194366455 +snappy_compression_5_1000_10Mb,21.38349199295044 +snappy_compression_5_1000_10Mb,21.341899156570435 +snappy_compression_5_1000_10Mb,21.74799609184265 +snappy_compression_5_1000_10Mb,21.621104955673218 +snappy_compression_5_1000_10Mb,21.648022890090942 +snappy_compression_5_1000_10Mb,21.568861961364746 +snappy_compression_5_1000_10Mb,21.62322187423706 +snappy_compression_5_1000_10Mb,21.399152040481567 +snappy_compression_5_1000_10Mb,21.339909076690674 +snappy_compression_5_1000_10Mb,21.609938144683838 +snappy_compression_5_1000_10Mb,21.31721019744873 +deflate_compression_5_100000_1Kb,63.01013803482056 +deflate_compression_5_100000_1Kb,65.04713201522827 +deflate_compression_5_100000_1Kb,62.52873373031616 +deflate_compression_5_100000_1Kb,64.26173305511475 +deflate_compression_5_100000_1Kb,63.06211280822754 +deflate_compression_5_100000_1Kb,62.89547276496887 +deflate_compression_5_100000_1Kb,63.274219036102295 +deflate_compression_5_100000_1Kb,64.65362024307251 +deflate_compression_5_100000_1Kb,64.90634083747864 +deflate_compression_5_100000_1Kb,63.911845207214355 +deflate_compression_5_100000_1Kb,63.30595684051514 +deflate_compression_5_10_10Mb,63.04709720611572 +deflate_compression_5_10_10Mb,64.67240190505981 +deflate_compression_5_10_10Mb,64.5411970615387 +deflate_compression_5_10_10Mb,63.24651789665222 +deflate_compression_5_10_10Mb,62.48751997947693 +deflate_compression_5_10_10Mb,62.9459331035614 +deflate_compression_5_10_10Mb,64.79925513267517 +deflate_compression_5_10_10Mb,64.61253213882446 +deflate_compression_5_10_10Mb,63.227832078933716 +deflate_compression_5_10_10Mb,63.24809384346008 +deflate_compression_5_10_10Mb,64.21979308128357 +fibonacci_42,73.83689188957214 +fibonacci_42,72.73303985595703 +fibonacci_42,72.88571906089783 +fibonacci_42,72.67585396766663 +fibonacci_42,73.15689325332642 +fibonacci_42,73.23700308799744 +fibonacci_42,72.18646597862244 +fibonacci_42,73.53925585746765 +fibonacci_42,71.78964495658875 +fibonacci_42,74.36770486831665 +fibonacci_42,72.80925011634827 +fibonacci_50,72.10168790817261 +fibonacci_50,72.96367406845093 +fibonacci_50,72.70814824104309 +fibonacci_50,72.7207179069519 +fibonacci_50,71.75951981544495 +fibonacci_50,73.24424409866333 +fibonacci_50,72.13987803459167 +fibonacci_50,72.89511013031006 +fibonacci_50,73.10324811935425 +fibonacci_50,73.47930693626404 +fibonacci_50,72.53861975669861 +factorization_2147483647,13.22667384147644 +factorization_2147483647,13.605670928955078 +factorization_2147483647,13.293700218200684 +factorization_2147483647,13.016165018081665 +factorization_2147483647,13.581308841705322 +factorization_2147483647,13.912525177001953 +factorization_2147483647,15.045396089553833 +factorization_2147483647,14.744700908660889 +factorization_2147483647,14.344260931015015 +factorization_2147483647,13.789538621902466 +factorization_2147483647,13.76637887954712 +recursive_hash_10000000_0,17.889079809188843 +recursive_hash_10000000_0,18.56121277809143 +recursive_hash_10000000_0,18.46988868713379 +recursive_hash_10000000_0,21.0805561542511 +recursive_hash_10000000_0,21.279676914215088 +recursive_hash_10000000_0,19.35895299911499 +recursive_hash_10000000_0,19.368671894073486 +recursive_hash_10000000_0,17.923566818237305 +recursive_hash_10000000_0,17.709688901901245 +recursive_hash_10000000_0,17.54594612121582 +recursive_hash_10000000_0,17.478378772735596 +matrix_product_1_10_1000000,28.65305805206299 +matrix_product_1_10_1000000,28.046306133270264 +matrix_product_1_10_1000000,27.974605083465576 +matrix_product_1_10_1000000,28.0353262424469 +matrix_product_1_10_1000000,27.89697289466858 +matrix_product_1_10_1000000,28.20061492919922 +matrix_product_1_10_1000000,27.107964992523193 +matrix_product_1_10_1000000,26.898239135742188 +matrix_product_1_10_1000000,27.024434089660645 +matrix_product_1_10_1000000,26.906163930892944 +matrix_product_1_10_1000000,27.077481985092163 +matrix_product_1_200_100,28.122427225112915 +matrix_product_1_200_100,28.724907159805298 +matrix_product_1_200_100,29.15459108352661 +matrix_product_1_200_100,30.318928003311157 +matrix_product_1_200_100,29.829855918884277 +matrix_product_1_200_100,31.222463130950928 +matrix_product_1_200_100,29.227657318115234 +matrix_product_1_200_100,29.32576084136963 +matrix_product_1_200_100,27.436151027679443 +matrix_product_1_200_100,27.815643072128296 +matrix_product_1_200_100,29.732506275177002 +svd_decomposition_1_10_1000000,756.0404772758484 +svd_decomposition_1_10_1000000,655.4719252586365 +svd_decomposition_1_10_1000000,620.9246027469635 +svd_decomposition_1_10_1000000,630.0120990276337 +svd_decomposition_1_10_1000000,645.4520742893219 +svd_decomposition_1_10_1000000,655.5482919216156 +svd_decomposition_1_10_1000000,680.9745841026306 +svd_decomposition_1_10_1000000,682.4573440551758 +svd_decomposition_1_10_1000000,743.3740720748901 +svd_decomposition_1_10_1000000,721.9925141334534 +svd_decomposition_1_10_1000000,870.8123922348022 +svd_decomposition_1_200_100,629.2256848812103 +svd_decomposition_1_200_100,702.432363986969 +svd_decomposition_1_200_100,706.031455039978 +svd_decomposition_1_200_100,652.1148700714111 +svd_decomposition_1_200_100,800.6731190681458 +svd_decomposition_1_200_100,673.7515981197357 +svd_decomposition_1_200_100,629.6522281169891 +svd_decomposition_1_200_100,674.1115217208862 +svd_decomposition_1_200_100,677.715528011322 +svd_decomposition_1_200_100,650.3165521621704 +svd_decomposition_1_200_100,592.9430720806122 +qr_decomposition_1_10_1000000,12.601394891738892 +qr_decomposition_1_10_1000000,12.505298852920532 +qr_decomposition_1_10_1000000,12.378314971923828 +qr_decomposition_1_10_1000000,12.709280014038086 +qr_decomposition_1_10_1000000,12.491504907608032 +qr_decomposition_1_10_1000000,12.476433277130127 +qr_decomposition_1_10_1000000,12.480878829956055 +qr_decomposition_1_10_1000000,12.496170997619629 +qr_decomposition_1_10_1000000,12.4915189743042 +qr_decomposition_1_10_1000000,12.48329782485962 +qr_decomposition_1_10_1000000,13.333468198776245 +qr_decomposition_1_200_100,12.305270910263062 +qr_decomposition_1_200_100,12.298511981964111 +qr_decomposition_1_200_100,12.607870817184448 +qr_decomposition_1_200_100,12.451258897781372 +qr_decomposition_1_200_100,12.44648790359497 +qr_decomposition_1_200_100,12.511184215545654 +qr_decomposition_1_200_100,12.453485012054443 +qr_decomposition_1_200_100,12.490206003189087 +qr_decomposition_1_200_100,12.561767816543579 +qr_decomposition_1_200_100,12.536709070205688 +qr_decomposition_1_200_100,12.612308979034424 diff --git a/bench/vm/results/life.csv b/bench/vm/results/life.csv new file mode 100644 index 0000000000..052ce7cf2a --- /dev/null +++ b/bench/vm/results/life.csv @@ -0,0 +1,43 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,3372.040552139282 +snappy_compression_5_1000000_1Kb,3369.16609787941 +snappy_compression_5_1000000_1Kb,3364.320676803589 +snappy_compression_5_1000_10Mb,3370.12322145784 +snappy_compression_5_1000_10Mb,3365.545552145883 +snappy_compression_5_1000_10Mb,3345.157264578305 +deflate_compression_5_100000_1Kb,3872.254865 +deflate_compression_5_100000_1Kb,3884.78231578351 +deflate_compression_5_100000_1Kb,3865.11254833152 +deflate_compression_5_10_10Mb,3872.254865 +deflate_compression_5_10_10Mb,3872.254865 +deflate_compression_5_10_10Mb,3872.254865 +fibonacci_42,1071.190172910690315 +fibonacci_42,1186.518988609314 +fibonacci_42,1190.238118171692 +fibonacci_50,1148.9854860305787 +fibonacci_50,1151.8070983886718 +fibonacci_50,1180.4042100906372 +factorization_2147483647,270.287030935287475 +factorization_2147483647,345.042396545410144 +factorization_2147483647,290.815813064575197 +recursive_hash_10000000_0,253.81661653518678 +recursive_hash_10000000_0,255.25934457778932 +recursive_hash_10000000_0,251.97618484497069 +matrix_product_1_10_1000000,745.005190372467 +matrix_product_1_10_1000000,778.546076774597144 +matrix_product_1_10_1000000,792.457436561584456 +matrix_product_1_200_100,1063.47933053970335 +matrix_product_1_200_100,1262.175052642822296 +matrix_product_1_200_100,1117.550668716430632 +svd_decomposition_1_10_1000000,3894.075905084609994 +svd_decomposition_1_10_1000000,3926.71311736106874 +svd_decomposition_1_10_1000000,3846.974102497100832 +svd_decomposition_1_200_100,2180.8396940231323 +svd_decomposition_1_200_100,3145.305422782897952 +svd_decomposition_1_200_100,2135.55368590354901 +qr_decomposition_1_10_1000000,568.727970123291003 +qr_decomposition_1_10_1000000,630.806128978729281 +qr_decomposition_1_10_1000000,625.037670135498033 +qr_decomposition_1_200_100,687.595468044281038 +qr_decomposition_1_200_100,688.372506380081138 +qr_decomposition_1_200_100,684.129389524459802 diff --git a/bench/vm/results/wasmer.csv b/bench/vm/results/wasmer.csv new file mode 100644 index 0000000000..a8d257dddd --- /dev/null +++ b/bench/vm/results/wasmer.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,27.7688729763031 +snappy_compression_5_1000000_1Kb,26.533982038497925 +snappy_compression_5_1000000_1Kb,27.23807382583618 +snappy_compression_5_1000000_1Kb,26.176867961883545 +snappy_compression_5_1000000_1Kb,26.974048137664795 +snappy_compression_5_1000000_1Kb,26.824512004852295 +snappy_compression_5_1000000_1Kb,26.878080129623413 +snappy_compression_5_1000000_1Kb,26.31573987007141 +snappy_compression_5_1000000_1Kb,26.931299209594727 +snappy_compression_5_1000000_1Kb,26.83073902130127 +snappy_compression_5_1000000_1Kb,26.94623613357544 +snappy_compression_5_1000_10Mb,27.440106868743896 +snappy_compression_5_1000_10Mb,27.279486894607544 +snappy_compression_5_1000_10Mb,27.282124042510986 +snappy_compression_5_1000_10Mb,27.217063903808594 +snappy_compression_5_1000_10Mb,26.576902866363525 +snappy_compression_5_1000_10Mb,27.34129285812378 +snappy_compression_5_1000_10Mb,26.686068058013916 +snappy_compression_5_1000_10Mb,27.54439902305603 +snappy_compression_5_1000_10Mb,26.73086380958557 +snappy_compression_5_1000_10Mb,27.655193090438843 +snappy_compression_5_1000_10Mb,27.71091365814209 +deflate_compression_5_100000_1Kb,51.91492414474487 +deflate_compression_5_100000_1Kb,52.40915584564209 +deflate_compression_5_100000_1Kb,51.83877921104431 +deflate_compression_5_100000_1Kb,52.196123123168945 +deflate_compression_5_100000_1Kb,52.09947395324707 +deflate_compression_5_100000_1Kb,52.233049154281616 +deflate_compression_5_100000_1Kb,52.53088712692261 +deflate_compression_5_100000_1Kb,52.34496307373047 +deflate_compression_5_100000_1Kb,52.566028118133545 +deflate_compression_5_100000_1Kb,52.1095712184906 +deflate_compression_5_100000_1Kb,51.89137506484985 +deflate_compression_5_10_10Mb,51.521625995635986 +deflate_compression_5_10_10Mb,51.96341681480408 +deflate_compression_5_10_10Mb,51.95174598693848 +deflate_compression_5_10_10Mb,51.80925178527832 +deflate_compression_5_10_10Mb,51.83757495880127 +deflate_compression_5_10_10Mb,51.80482196807861 +deflate_compression_5_10_10Mb,51.956703901290894 +deflate_compression_5_10_10Mb,52.037959814071655 +deflate_compression_5_10_10Mb,51.559319734573364 +deflate_compression_5_10_10Mb,51.97579598426819 +deflate_compression_5_10_10Mb,52.34390115737915 +fibonacci_42,100.81164908409119 +fibonacci_42,101.16505908966064 +fibonacci_42,100.84431481361389 +fibonacci_42,100.68627214431763 +fibonacci_42,101.1809868812561 +fibonacci_42,101.69194006919861 +fibonacci_42,100.91333818435669 +fibonacci_42,100.79982781410217 +fibonacci_42,100.47869420051575 +fibonacci_42,100.70616793632507 +fibonacci_42,101.67957496643066 +fibonacci_50,116.6637179851532 +fibonacci_50,101.13963961601257 +fibonacci_50,121.63424110412598 +fibonacci_50,112.28407311439514 +fibonacci_50,120.0039587020874 +fibonacci_50,100.49020099639893 +fibonacci_50,100.72807478904724 +fibonacci_50,100.23609924316406 +fibonacci_50,100.48474335670471 +fibonacci_50,99.95040988922119 +fibonacci_50,99.62434411048889 +factorization_2147483647,32.438026905059814 +factorization_2147483647,32.77140235900879 +factorization_2147483647,32.29816293716431 +factorization_2147483647,32.58162498474121 +factorization_2147483647,32.242013931274414 +factorization_2147483647,32.83728098869324 +factorization_2147483647,32.73626399040222 +factorization_2147483647,32.67961812019348 +factorization_2147483647,32.526639223098755 +factorization_2147483647,38.35708999633789 +factorization_2147483647,33.12419366836548 +recursive_hash_10000000_0,27.137101650238037 +recursive_hash_10000000_0,28.48113703727722 +recursive_hash_10000000_0,28.19929814338684 +recursive_hash_10000000_0,25.598351001739502 +recursive_hash_10000000_0,27.23847985267639 +recursive_hash_10000000_0,26.772608995437622 +recursive_hash_10000000_0,26.640592098236084 +recursive_hash_10000000_0,28.706769227981567 +recursive_hash_10000000_0,26.74534296989441 +recursive_hash_10000000_0,32.3120219707489 +recursive_hash_10000000_0,27.122738122940063 +matrix_product_1_10_1000000,33.509279012680054 +matrix_product_1_10_1000000,33.12192511558533 +matrix_product_1_10_1000000,36.25976800918579 +matrix_product_1_10_1000000,38.40919589996338 +matrix_product_1_10_1000000,34.89144778251648 +matrix_product_1_10_1000000,39.26520109176636 +matrix_product_1_10_1000000,39.95768404006958 +matrix_product_1_10_1000000,40.353346824645996 +matrix_product_1_10_1000000,40.81225395202637 +matrix_product_1_10_1000000,41.3707001209259 +matrix_product_1_10_1000000,40.06730890274048 +matrix_product_1_200_100,38.87716197967529 +matrix_product_1_200_100,38.140708923339844 +matrix_product_1_200_100,37.70765805244446 +matrix_product_1_200_100,37.89401721954346 +matrix_product_1_200_100,38.986080169677734 +matrix_product_1_200_100,38.78080892562866 +matrix_product_1_200_100,38.98625588417053 +matrix_product_1_200_100,38.90069103240967 +matrix_product_1_200_100,38.60413312911987 +matrix_product_1_200_100,38.84670686721802 +matrix_product_1_200_100,38.90734386444092 +svd_decomposition_1_10_1000000,59.21647500991821 +svd_decomposition_1_10_1000000,59.71688771247864 +svd_decomposition_1_10_1000000,59.90468716621399 +svd_decomposition_1_10_1000000,60.01904082298279 +svd_decomposition_1_10_1000000,66.24443316459656 +svd_decomposition_1_10_1000000,60.99016714096069 +svd_decomposition_1_10_1000000,65.94958114624023 +svd_decomposition_1_10_1000000,66.70589995384216 +svd_decomposition_1_10_1000000,67.48255681991577 +svd_decomposition_1_10_1000000,66.67217302322388 +svd_decomposition_1_10_1000000,70.90477585792542 +svd_decomposition_1_200_100,93.07028794288635 +svd_decomposition_1_200_100,95.85169005393982 +svd_decomposition_1_200_100,96.43082594871521 +svd_decomposition_1_200_100,100.78293299674988 +svd_decomposition_1_200_100,101.1863489151001 +svd_decomposition_1_200_100,79.8322582244873 +svd_decomposition_1_200_100,51.3191339969635 +svd_decomposition_1_200_100,52.0533390045166 +svd_decomposition_1_200_100,51.398340940475464 +svd_decomposition_1_200_100,51.76226878166199 +svd_decomposition_1_200_100,51.610076904296875 +qr_decomposition_1_10_1000000,14.803030967712402 +qr_decomposition_1_10_1000000,14.679723978042603 +qr_decomposition_1_10_1000000,14.856477975845337 +qr_decomposition_1_10_1000000,14.627059936523438 +qr_decomposition_1_10_1000000,14.897404909133911 +qr_decomposition_1_10_1000000,14.94599986076355 +qr_decomposition_1_10_1000000,14.588797092437744 +qr_decomposition_1_10_1000000,14.891240119934082 +qr_decomposition_1_10_1000000,14.77375602722168 +qr_decomposition_1_10_1000000,14.556878805160522 +qr_decomposition_1_10_1000000,14.910651922225952 +qr_decomposition_1_200_100,14.48614501953125 +qr_decomposition_1_200_100,14.738097906112671 +qr_decomposition_1_200_100,14.750440120697021 +qr_decomposition_1_200_100,14.761280059814453 +qr_decomposition_1_200_100,14.512586832046509 +qr_decomposition_1_200_100,14.682394981384277 +qr_decomposition_1_200_100,14.788942098617554 +qr_decomposition_1_200_100,14.659065008163452 +qr_decomposition_1_200_100,14.843371868133545 +qr_decomposition_1_200_100,14.787256956100464 +qr_decomposition_1_200_100,14.840179204940796 diff --git a/bench/vm/results/wasmi.csv b/bench/vm/results/wasmi.csv new file mode 100644 index 0000000000..081e9e3b78 --- /dev/null +++ b/bench/vm/results/wasmi.csv @@ -0,0 +1,40 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,1025.0220577716827 +snappy_compression_5_1000000_1Kb,1024.2371897697449 +snappy_compression_5_1000000_1Kb,1024.9557831287384 +snappy_compression_5_1000_10Mb,1094.28639411926274 +snappy_compression_5_1000_10Mb,1091.3414716720582 +snappy_compression_5_1000_10Mb,1098.95282030105594 +deflate_compression_5_100000_1Kb,1819.097027301788366 +deflate_compression_5_100000_1Kb,1828.114710807800327 +deflate_compression_5_100000_1Kb,1844.16246366500863 +deflate_compression_5_10_10Mb,1816.299198865890519 +deflate_compression_5_10_10Mb,1795.673886775970476 +deflate_compression_5_10_10Mb,1839.564825773239114 +fibonacci_42,834.59919548034666 +fibonacci_42,833.11701536178591 +fibonacci_42,804.28984022140509 +factorization_2147483647,242.38572216033934 +factorization_2147483647,239.954379081726078 +factorization_2147483647,241.68400764465331 +recursive_hash_10000000_0,209.48535203933715 +recursive_hash_10000000_0,228.645094156265259 +recursive_hash_10000000_0,209.980154037475575 +matrix_product_1_10_1000000,650.575213909149186 +matrix_product_1_10_1000000,645.012229442596428 +matrix_product_1_10_1000000,634.33884429931638 +matrix_product_1_200_100,700.41343688964846 +matrix_product_1_200_100,713.990705013275126 +matrix_product_1_200_100,692.531594038009665 +svd_decomposition_1_10_1000000,1123.96903276443485 +svd_decomposition_1_10_1000000,1117.3573911190033 +svd_decomposition_1_10_1000000,1108.07037949562073 +svd_decomposition_1_200_100,655.53188490867612 +svd_decomposition_1_200_100,655.67533111572261 +svd_decomposition_1_200_100,647.814733028411882 +qr_decomposition_1_10_1000000,229.77492332458496 +qr_decomposition_1_10_1000000,231.861802339553825 +qr_decomposition_1_10_1000000,229.859986066818253 +qr_decomposition_1_200_100,219.251183509826676 +qr_decomposition_1_200_100,175.546491861343385 +qr_decomposition_1_200_100,209.196590185165394 diff --git a/bench/vm/results/wavm.csv b/bench/vm/results/wavm.csv new file mode 100644 index 0000000000..025469e3f4 --- /dev/null +++ b/bench/vm/results/wavm.csv @@ -0,0 +1,155 @@ +test_path,elapsed_time +snappy_compression_5_1000000_1Kb,9.717528104782104 +snappy_compression_5_1000000_1Kb,9.714651823043823 +snappy_compression_5_1000000_1Kb,9.758702039718628 +snappy_compression_5_1000000_1Kb,9.782424926757812 +snappy_compression_5_1000000_1Kb,9.807159900665283 +snappy_compression_5_1000000_1Kb,9.874746084213257 +snappy_compression_5_1000000_1Kb,9.84822702407837 +snappy_compression_5_1000000_1Kb,9.816054105758667 +snappy_compression_5_1000000_1Kb,9.799592971801758 +snappy_compression_5_1000000_1Kb,9.870435953140259 +snappy_compression_5_1000000_1Kb,9.838435888290405 +snappy_compression_5_1000_10Mb,10.060152053833008 +snappy_compression_5_1000_10Mb,10.011566162109375 +snappy_compression_5_1000_10Mb,9.852818012237549 +snappy_compression_5_1000_10Mb,9.899932861328125 +snappy_compression_5_1000_10Mb,9.92128610610962 +snappy_compression_5_1000_10Mb,9.787997961044312 +snappy_compression_5_1000_10Mb,9.880560874938965 +snappy_compression_5_1000_10Mb,9.990480184555054 +snappy_compression_5_1000_10Mb,9.948058128356934 +snappy_compression_5_1000_10Mb,10.00252103805542 +snappy_compression_5_1000_10Mb,9.932419776916504 +deflate_compression_5_100000_1Kb,15.143059015274048 +deflate_compression_5_100000_1Kb,15.175490140914917 +deflate_compression_5_100000_1Kb,15.066927909851074 +deflate_compression_5_100000_1Kb,15.213164806365967 +deflate_compression_5_100000_1Kb,15.033859729766846 +deflate_compression_5_100000_1Kb,15.027947902679443 +deflate_compression_5_100000_1Kb,15.24101209640503 +deflate_compression_5_100000_1Kb,15.108386039733887 +deflate_compression_5_100000_1Kb,15.153640985488892 +deflate_compression_5_100000_1Kb,15.335155963897705 +deflate_compression_5_100000_1Kb,15.0716872215271 +deflate_compression_5_10_10Mb,15.144837141036987 +deflate_compression_5_10_10Mb,14.776844263076782 +deflate_compression_5_10_10Mb,14.890641927719116 +deflate_compression_5_10_10Mb,15.1025230884552 +deflate_compression_5_10_10Mb,15.177051067352295 +deflate_compression_5_10_10Mb,15.010737180709839 +deflate_compression_5_10_10Mb,15.033567905426025 +deflate_compression_5_10_10Mb,15.203015089035034 +deflate_compression_5_10_10Mb,15.10928988456726 +deflate_compression_5_10_10Mb,15.081895112991333 +deflate_compression_5_10_10Mb,14.840280055999756 +fibonacci_42,39.673710107803345 +fibonacci_42,39.74281883239746 +fibonacci_42,39.6746039390564 +fibonacci_42,39.5506329536438 +fibonacci_42,39.14682698249817 +fibonacci_42,39.66048502922058 +fibonacci_42,39.47613787651062 +fibonacci_42,39.395100116729736 +fibonacci_42,39.7700080871582 +fibonacci_42,39.45085120201111 +fibonacci_42,39.67223882675171 +fibonacci_50,39.28877902030945 +fibonacci_50,39.23145389556885 +fibonacci_50,39.34680700302124 +fibonacci_50,38.918346881866455 +fibonacci_50,38.61098909378052 +fibonacci_50,38.390175104141235 +fibonacci_50,38.36805987358093 +fibonacci_50,38.310194969177246 +fibonacci_50,38.29951620101929 +fibonacci_50,38.28630995750427 +fibonacci_50,38.39356994628906 +factorization_2147483647,10.811481237411499 +factorization_2147483647,10.782574892044067 +factorization_2147483647,10.770956039428711 +factorization_2147483647,10.760880947113037 +factorization_2147483647,10.985636711120605 +factorization_2147483647,10.9326331615448 +factorization_2147483647,11.01753282546997 +factorization_2147483647,11.250012159347534 +factorization_2147483647,10.907017230987549 +factorization_2147483647,10.905230045318604 +factorization_2147483647,10.887682676315308 +recursive_hash_10000000_0,8.460553884506226 +recursive_hash_10000000_0,8.545917272567749 +recursive_hash_10000000_0,8.451397895812988 +recursive_hash_10000000_0,8.508644819259644 +recursive_hash_10000000_0,8.379414081573486 +recursive_hash_10000000_0,8.362284183502197 +recursive_hash_10000000_0,8.411664247512817 +recursive_hash_10000000_0,8.399206161499023 +recursive_hash_10000000_0,8.468336820602417 +recursive_hash_10000000_0,8.571569919586182 +recursive_hash_10000000_0,8.633066177368164 +matrix_product_1_10_1000000,14.90010380744934 +matrix_product_1_10_1000000,14.900184869766235 +matrix_product_1_10_1000000,14.720311641693115 +matrix_product_1_10_1000000,14.972039937973022 +matrix_product_1_10_1000000,15.10330581665039 +matrix_product_1_10_1000000,15.489886045455933 +matrix_product_1_10_1000000,15.45845103263855 +matrix_product_1_10_1000000,15.03793716430664 +matrix_product_1_10_1000000,15.239566087722778 +matrix_product_1_10_1000000,15.18182110786438 +matrix_product_1_10_1000000,15.357434034347534 +matrix_product_1_200_100,15.596153020858765 +matrix_product_1_200_100,15.224766969680786 +matrix_product_1_200_100,15.167222023010254 +matrix_product_1_200_100,15.564743041992188 +matrix_product_1_200_100,15.377501964569092 +matrix_product_1_200_100,15.192561864852905 +matrix_product_1_200_100,15.521537065505981 +matrix_product_1_200_100,15.389590978622437 +matrix_product_1_200_100,15.498884201049805 +matrix_product_1_200_100,16.241212129592896 +matrix_product_1_200_100,17.530209064483643 +svd_decomposition_1_10_1000000,30.873584032058716 +svd_decomposition_1_10_1000000,34.93633580207825 +svd_decomposition_1_10_1000000,32.45456004142761 +svd_decomposition_1_10_1000000,32.9636127948761 +svd_decomposition_1_10_1000000,32.11340093612671 +svd_decomposition_1_10_1000000,31.22289276123047 +svd_decomposition_1_10_1000000,31.276212215423584 +svd_decomposition_1_10_1000000,31.659153699874878 +svd_decomposition_1_10_1000000,31.92449688911438 +svd_decomposition_1_10_1000000,32.02426600456238 +svd_decomposition_1_10_1000000,32.75420904159546 +svd_decomposition_1_200_100,17.757825136184692 +svd_decomposition_1_200_100,17.767619848251343 +svd_decomposition_1_200_100,17.778232097625732 +svd_decomposition_1_200_100,17.72095489501953 +svd_decomposition_1_200_100,17.587416887283325 +svd_decomposition_1_200_100,17.643022775650024 +svd_decomposition_1_200_100,17.587465286254883 +svd_decomposition_1_200_100,17.71707797050476 +svd_decomposition_1_200_100,17.670255184173584 +svd_decomposition_1_200_100,17.64920401573181 +svd_decomposition_1_200_100,17.508506298065186 +qr_decomposition_1_10_1000000,5.659765005111694 +qr_decomposition_1_10_1000000,5.716536045074463 +qr_decomposition_1_10_1000000,5.698207855224609 +qr_decomposition_1_10_1000000,5.744373083114624 +qr_decomposition_1_10_1000000,5.777857780456543 +qr_decomposition_1_10_1000000,5.655165910720825 +qr_decomposition_1_10_1000000,5.630970001220703 +qr_decomposition_1_10_1000000,5.703395843505859 +qr_decomposition_1_10_1000000,5.664350986480713 +qr_decomposition_1_10_1000000,5.606341123580933 +qr_decomposition_1_10_1000000,5.682938098907471 +qr_decomposition_1_200_100,5.599729061126709 +qr_decomposition_1_200_100,5.676383018493652 +qr_decomposition_1_200_100,5.7370240688323975 +qr_decomposition_1_200_100,5.617890119552612 +qr_decomposition_1_200_100,5.682607173919678 +qr_decomposition_1_200_100,5.653961896896362 +qr_decomposition_1_200_100,5.609421014785767 +qr_decomposition_1_200_100,5.657746315002441 +qr_decomposition_1_200_100,5.621825218200684 +qr_decomposition_1_200_100,5.662790060043335 +qr_decomposition_1_200_100,5.689028978347778 From de78d031693dbb7a88d5e25ddc218ec7b90d76e7 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 15:01:40 +0300 Subject: [PATCH 41/48] changes authors in Cargo.toml --- bench/vm/tests/compression/Cargo.toml | 2 +- bench/vm/tests/factorization_reikna/Cargo.toml | 2 +- bench/vm/tests/fibonacci_bigint/Cargo.toml | 2 +- bench/vm/tests/matrix_product/Cargo.toml | 2 +- bench/vm/tests/matrix_qr_decomposition/Cargo.toml | 2 +- bench/vm/tests/matrix_svd_decomposition/Cargo.toml | 2 +- bench/vm/tests/recursive_hash/Cargo.toml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/vm/tests/compression/Cargo.toml b/bench/vm/tests/compression/Cargo.toml index 0f4021d87f..70d3bd07d3 100644 --- a/bench/vm/tests/compression/Cargo.toml +++ b/bench/vm/tests/compression/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "compression" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/factorization_reikna/Cargo.toml b/bench/vm/tests/factorization_reikna/Cargo.toml index 4cefdf0387..7049dbf5d9 100644 --- a/bench/vm/tests/factorization_reikna/Cargo.toml +++ b/bench/vm/tests/factorization_reikna/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "factorization_reikna" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/fibonacci_bigint/Cargo.toml b/bench/vm/tests/fibonacci_bigint/Cargo.toml index 92f3abaf05..913e0f3499 100644 --- a/bench/vm/tests/fibonacci_bigint/Cargo.toml +++ b/bench/vm/tests/fibonacci_bigint/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fibonacci_bigint" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_product/Cargo.toml b/bench/vm/tests/matrix_product/Cargo.toml index 7b3403f8f1..775171f4d6 100644 --- a/bench/vm/tests/matrix_product/Cargo.toml +++ b/bench/vm/tests/matrix_product/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_product" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_qr_decomposition/Cargo.toml b/bench/vm/tests/matrix_qr_decomposition/Cargo.toml index 3400050394..4dc3a31434 100644 --- a/bench/vm/tests/matrix_qr_decomposition/Cargo.toml +++ b/bench/vm/tests/matrix_qr_decomposition/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_qr_decomposition" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/matrix_svd_decomposition/Cargo.toml b/bench/vm/tests/matrix_svd_decomposition/Cargo.toml index b6a76ed376..f67c41ba9d 100644 --- a/bench/vm/tests/matrix_svd_decomposition/Cargo.toml +++ b/bench/vm/tests/matrix_svd_decomposition/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "matrix_svd_decomposition" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] diff --git a/bench/vm/tests/recursive_hash/Cargo.toml b/bench/vm/tests/recursive_hash/Cargo.toml index b068aef20b..8ac6667ce9 100644 --- a/bench/vm/tests/recursive_hash/Cargo.toml +++ b/bench/vm/tests/recursive_hash/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "recursive_hash" version = "0.1.0" -authors = ["M. Voronov "] +authors = ["Fluence Labs"] [lib] crate-type = ["cdylib"] From 4867c9cdde03b76e4fce82dcc501ba5164e6dd06 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 19:06:51 +0300 Subject: [PATCH 42/48] fix review comments --- bench/vm/tests/compression/src/lib.rs | 6 +++--- bench/vm/tests/compression/src/settings.rs | 12 ++++++------ bench/vm/tests/factorization_reikna/src/lib.rs | 2 +- bench/vm/tests/factorization_reikna/src/settings.rs | 4 ++-- bench/vm/tests/fibonacci_bigint/src/lib.rs | 4 ++-- bench/vm/tests/fibonacci_bigint/src/settings.rs | 4 ++-- bench/vm/tests/matrix_product/src/lib.rs | 6 +++--- bench/vm/tests/matrix_product/src/settings.rs | 10 +++++----- bench/vm/tests/matrix_qr_decomposition/src/lib.rs | 6 +++--- .../vm/tests/matrix_qr_decomposition/src/settings.rs | 6 +++--- bench/vm/tests/matrix_svd_decomposition/src/lib.rs | 4 ++-- .../tests/matrix_svd_decomposition/src/settings.rs | 6 +++--- bench/vm/tests/recursive_hash/src/lib.rs | 2 +- bench/vm/tests/recursive_hash/src/settings.rs | 4 ++-- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bench/vm/tests/compression/src/lib.rs b/bench/vm/tests/compression/src/lib.rs index 9c15cd76f8..710a190d19 100644 --- a/bench/vm/tests/compression/src/lib.rs +++ b/bench/vm/tests/compression/src/lib.rs @@ -27,7 +27,7 @@ use deflate::deflate_bytes; type Sequence = Vec; -/// generates pseudo-random byte sequence by given seed and given size +/// Generates pseudo-random byte sequence by given seed and given size. fn generate_sequence(seed : u64, size : u64) -> Sequence { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); let mut result_sequence = Sequence::with_capacity(size as usize); @@ -38,7 +38,7 @@ fn generate_sequence(seed : u64, size : u64) -> Sequence { result_sequence } -/// compresses provided sequence by deflate or snappy algorithm +/// Compresses provided sequence by deflate or snappy algorithm. fn compress_sequence(sequence: &Sequence) -> Sequence { if cfg!(feature = "deflate_compression") { return deflate_bytes(&sequence); @@ -48,7 +48,7 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { } #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern fn main() -> u64 { let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); diff --git a/bench/vm/tests/compression/src/settings.rs b/bench/vm/tests/compression/src/settings.rs index c59389c07c..82c0e14dd1 100644 --- a/bench/vm/tests/compression/src/settings.rs +++ b/bench/vm/tests/compression/src/settings.rs @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/// this value is used as the first seed of pseudo-random generator for sequence generation -pub const SEED : &'static str = env!("SEED"); +/// This value is used as the first seed of pseudo-random generator for sequence generation. +pub const SEED : &str = env!("SEED"); -/// count of compression iterations -pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); +/// Count of compression iterations. +pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); -/// size of sequence that should be compressed on each iteration -pub const SEQUENCE_SIZE: &'static str = env!("SEQUENCE_SIZE"); +/// Size of sequence that should be compressed on each iteration. +pub const SEQUENCE_SIZE: &str = env!("SEQUENCE_SIZE"); diff --git a/bench/vm/tests/factorization_reikna/src/lib.rs b/bench/vm/tests/factorization_reikna/src/lib.rs index ed7ee18f1c..85474e2d40 100644 --- a/bench/vm/tests/factorization_reikna/src/lib.rs +++ b/bench/vm/tests/factorization_reikna/src/lib.rs @@ -20,7 +20,7 @@ use settings::FACTORIZED_NUMBER; use reikna::prime; #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern fn main() -> u64 { let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); // reikna uses Atkin or Eratosthenes seive to factorize given number let factors = prime::factorize(factorized_number); diff --git a/bench/vm/tests/factorization_reikna/src/settings.rs b/bench/vm/tests/factorization_reikna/src/settings.rs index fdc3b95ce5..31ce8019dd 100644 --- a/bench/vm/tests/factorization_reikna/src/settings.rs +++ b/bench/vm/tests/factorization_reikna/src/settings.rs @@ -13,5 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/// a number that should be factorized by this test -pub const FACTORIZED_NUMBER : &'static str = env!("FACTORIZED_NUMBER"); +/// A requested number that should be factorized by this test. +pub const FACTORIZED_NUMBER : &str = env!("FACTORIZED_NUMBER"); diff --git a/bench/vm/tests/fibonacci_bigint/src/lib.rs b/bench/vm/tests/fibonacci_bigint/src/lib.rs index 5e74e79a7b..3a87546ac1 100644 --- a/bench/vm/tests/fibonacci_bigint/src/lib.rs +++ b/bench/vm/tests/fibonacci_bigint/src/lib.rs @@ -22,7 +22,7 @@ use num_bigint::BigUint; use num_traits::One; use std::ops::Sub; -/// recursively computes a fibonacci number F_num for the given num +/// Recursively computes a fibonacci number F_num for the given num. fn fib(num: &BigUint) -> BigUint { if num.le(&BigUint::from(2u32)) { return One::one(); @@ -32,7 +32,7 @@ fn fib(num: &BigUint) -> BigUint { } #[no_mangle] -pub extern "C" fn main() -> u8 { +pub extern fn main() -> u8 { let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) diff --git a/bench/vm/tests/fibonacci_bigint/src/settings.rs b/bench/vm/tests/fibonacci_bigint/src/settings.rs index 52691b2b3b..62912d90a8 100644 --- a/bench/vm/tests/fibonacci_bigint/src/settings.rs +++ b/bench/vm/tests/fibonacci_bigint/src/settings.rs @@ -13,5 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// a requested fibonacci number that would be computed -pub const FIB_NUMBER: &'static str = env!("FIB_NUMBER"); +/// A requested fibonacci number that would be computed. +pub const FIB_NUMBER: &str = env!("FIB_NUMBER"); diff --git a/bench/vm/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs index 23525118db..61ddc9aab0 100644 --- a/bench/vm/tests/matrix_product/src/lib.rs +++ b/bench/vm/tests/matrix_product/src/lib.rs @@ -22,14 +22,14 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -/// generates random matrix with given size by IsaacRng +/// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) } -/// computes hash of a matrix as its trace +/// Computes hash of a matrix as its trace. fn compute_matrix_hash(matrix: &Matrix) -> u64 { let mut trace : u64 = 0; @@ -42,7 +42,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { } #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_product/src/settings.rs b/bench/vm/tests/matrix_product/src/settings.rs index 0f90b04906..0230aeba9d 100644 --- a/bench/vm/tests/matrix_product/src/settings.rs +++ b/bench/vm/tests/matrix_product/src/settings.rs @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// this seed is used for deterministic operation count on different launches -pub const SEED : &'static str = env!("SEED"); +/// This seed is used for deterministic operation count on different launches. +pub const SEED : &str = env!("SEED"); -// matrix size -pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); +/// Matrix size. +pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); // count of test iterations -pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); // 1117 due to prevent overflow in matrix multiplication pub const GENERATION_INTERVAL : u64 = 1117; diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index bdd877c5c7..74388792e3 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -22,13 +22,13 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -/// generates random matrix with given size by IsaacRng +/// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } -/// computes hash of a matrix as its trace +/// Computes hash of a matrix as its trace. fn compute_matrix_hash(matrix: &Matrix) -> f64 { let mut trace : f64 = 0.0; @@ -41,7 +41,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { } #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_qr_decomposition/src/settings.rs b/bench/vm/tests/matrix_qr_decomposition/src/settings.rs index 2532c80ef1..6649c035f4 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/settings.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/settings.rs @@ -14,13 +14,13 @@ * limitations under the License. */ /// this seed is used for deterministic operation count on different launches -pub const SEED : &'static str = env!("SEED"); +pub const SEED : &str = env!("SEED"); /// a matrix size -pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); +pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); /// count of test iterations -pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); /// 1117 due to prevent overflow in matrix multiplication pub const GENERATION_INTERVAL : f64 = 1117.0; diff --git a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs index b06768cb84..561774533f 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs @@ -22,14 +22,14 @@ use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; use settings::*; -/// generates random matrix with given size by IsaacRng +/// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) } #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern fn main() -> u64 { let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); let seed : u64 = SEED.parse::().unwrap(); let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_svd_decomposition/src/settings.rs b/bench/vm/tests/matrix_svd_decomposition/src/settings.rs index 3ae998a1a7..bbae056455 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/settings.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/settings.rs @@ -14,13 +14,13 @@ * limitations under the License. */ /// this seed is used for deterministic operation count on different launches -pub const SEED : &'static str = env!("SEED"); +pub const SEED : &str = env!("SEED"); /// a matrix size -pub const MATRIX_SIZE : &'static str = env!("MATRIX_SIZE"); +pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); /// count of test iterations -pub const ITERATIONS_COUNT : &'static str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); /// maximum value of matrix element pub const GENERATION_INTERVAL : f64 = 1117.0; diff --git a/bench/vm/tests/recursive_hash/src/lib.rs b/bench/vm/tests/recursive_hash/src/lib.rs index 92c67d031e..ca0b83ee5a 100644 --- a/bench/vm/tests/recursive_hash/src/lib.rs +++ b/bench/vm/tests/recursive_hash/src/lib.rs @@ -21,7 +21,7 @@ use sha3::{Digest, Sha3_256}; use std::mem; #[no_mangle] -pub extern "C" fn main() -> u8 { +pub extern fn main() -> u8 { let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); diff --git a/bench/vm/tests/recursive_hash/src/settings.rs b/bench/vm/tests/recursive_hash/src/settings.rs index be730bf7af..8fe0b7536f 100644 --- a/bench/vm/tests/recursive_hash/src/settings.rs +++ b/bench/vm/tests/recursive_hash/src/settings.rs @@ -14,7 +14,7 @@ * limitations under the License. */ /// count of recursive sha3 that would be computed -pub const ITERATIONS_COUNT: &'static str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); /// an initial value for computed hash chain -pub const INITIAL_VALUE: &'static str = env!("INITIAL_VALUE"); +pub const INITIAL_VALUE: &str = env!("INITIAL_VALUE"); From 7f691ab98cd39173821766fb85deda20d7ccdda5 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 19:12:26 +0300 Subject: [PATCH 43/48] apply cargo fmt --- bench/vm/tests/compression/src/lib.rs | 20 +++++++++---------- bench/vm/tests/compression/src/settings.rs | 2 +- .../vm/tests/factorization_reikna/src/lib.rs | 6 +++--- .../factorization_reikna/src/settings.rs | 2 +- bench/vm/tests/fibonacci_bigint/src/lib.rs | 12 ++++++----- bench/vm/tests/matrix_product/src/lib.rs | 19 +++++++++--------- bench/vm/tests/matrix_product/src/settings.rs | 8 ++++---- .../tests/matrix_qr_decomposition/src/lib.rs | 18 +++++++++-------- .../matrix_qr_decomposition/src/settings.rs | 8 ++++---- .../tests/matrix_svd_decomposition/src/lib.rs | 19 +++++++++++------- .../matrix_svd_decomposition/src/settings.rs | 8 ++++---- bench/vm/tests/recursive_hash/src/lib.rs | 11 +++++----- 12 files changed, 72 insertions(+), 61 deletions(-) diff --git a/bench/vm/tests/compression/src/lib.rs b/bench/vm/tests/compression/src/lib.rs index 710a190d19..a20dec4019 100644 --- a/bench/vm/tests/compression/src/lib.rs +++ b/bench/vm/tests/compression/src/lib.rs @@ -15,20 +15,20 @@ */ mod settings; -extern crate snap; extern crate deflate; extern crate rand; extern crate rand_isaac; +extern crate snap; -use settings::{SEED, ITERATIONS_COUNT, SEQUENCE_SIZE}; +use deflate::deflate_bytes; use rand::{Rng, SeedableRng}; use rand_isaac::IsaacRng; -use deflate::deflate_bytes; +use settings::{ITERATIONS_COUNT, SEED, SEQUENCE_SIZE}; type Sequence = Vec; /// Generates pseudo-random byte sequence by given seed and given size. -fn generate_sequence(seed : u64, size : u64) -> Sequence { +fn generate_sequence(seed: u64, size: u64) -> Sequence { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); let mut result_sequence = Sequence::with_capacity(size as usize); @@ -48,16 +48,16 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { } #[no_mangle] -pub extern fn main() -> u64 { - let seed : u64 = SEED.parse::().unwrap(); - let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); - let sequence_size : u64 = SEQUENCE_SIZE.parse::().unwrap(); +pub extern "C" fn main() -> u64 { + let seed: u64 = SEED.parse::().unwrap(); + let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); + let sequence_size: u64 = SEQUENCE_SIZE.parse::().unwrap(); let mut compressed_sequence = generate_sequence(seed, sequence_size); for _ in 1..iterations_count { - let new_seed = compressed_sequence.len() + - compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; + let new_seed = compressed_sequence.len() + + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; compressed_sequence = generate_sequence(new_seed as u64, sequence_size); compressed_sequence = compress_sequence(&compressed_sequence); } diff --git a/bench/vm/tests/compression/src/settings.rs b/bench/vm/tests/compression/src/settings.rs index 82c0e14dd1..f05be35cef 100644 --- a/bench/vm/tests/compression/src/settings.rs +++ b/bench/vm/tests/compression/src/settings.rs @@ -14,7 +14,7 @@ * limitations under the License. */ /// This value is used as the first seed of pseudo-random generator for sequence generation. -pub const SEED : &str = env!("SEED"); +pub const SEED: &str = env!("SEED"); /// Count of compression iterations. pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); diff --git a/bench/vm/tests/factorization_reikna/src/lib.rs b/bench/vm/tests/factorization_reikna/src/lib.rs index 85474e2d40..b2bf8a1ea1 100644 --- a/bench/vm/tests/factorization_reikna/src/lib.rs +++ b/bench/vm/tests/factorization_reikna/src/lib.rs @@ -16,12 +16,12 @@ mod settings; extern crate reikna; -use settings::FACTORIZED_NUMBER; use reikna::prime; +use settings::FACTORIZED_NUMBER; #[no_mangle] -pub extern fn main() -> u64 { - let factorized_number : u64 = FACTORIZED_NUMBER.parse::().unwrap(); +pub extern "C" fn main() -> u64 { + let factorized_number: u64 = FACTORIZED_NUMBER.parse::().unwrap(); // reikna uses Atkin or Eratosthenes seive to factorize given number let factors = prime::factorize(factorized_number); diff --git a/bench/vm/tests/factorization_reikna/src/settings.rs b/bench/vm/tests/factorization_reikna/src/settings.rs index 31ce8019dd..3dc6d8943d 100644 --- a/bench/vm/tests/factorization_reikna/src/settings.rs +++ b/bench/vm/tests/factorization_reikna/src/settings.rs @@ -14,4 +14,4 @@ * limitations under the License. */ /// A requested number that should be factorized by this test. -pub const FACTORIZED_NUMBER : &str = env!("FACTORIZED_NUMBER"); +pub const FACTORIZED_NUMBER: &str = env!("FACTORIZED_NUMBER"); diff --git a/bench/vm/tests/fibonacci_bigint/src/lib.rs b/bench/vm/tests/fibonacci_bigint/src/lib.rs index 3a87546ac1..381d3f236f 100644 --- a/bench/vm/tests/fibonacci_bigint/src/lib.rs +++ b/bench/vm/tests/fibonacci_bigint/src/lib.rs @@ -17,9 +17,9 @@ mod settings; extern crate num_bigint; extern crate num_traits; -use settings::FIB_NUMBER; use num_bigint::BigUint; use num_traits::One; +use settings::FIB_NUMBER; use std::ops::Sub; /// Recursively computes a fibonacci number F_num for the given num. @@ -32,9 +32,11 @@ fn fib(num: &BigUint) -> BigUint { } #[no_mangle] -pub extern fn main() -> u8 { - let fib_number : BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); +pub extern "C" fn main() -> u8 { + let fib_number: BigUint = BigUint::from(FIB_NUMBER.parse::().unwrap()); - fib(&fib_number).to_bytes_le().iter().fold(0u8, |x1, x2| x1 ^ x2) + fib(&fib_number) + .to_bytes_le() + .iter() + .fold(0u8, |x1, x2| x1 ^ x2) } - diff --git a/bench/vm/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs index 61ddc9aab0..c4148f33f8 100644 --- a/bench/vm/tests/matrix_product/src/lib.rs +++ b/bench/vm/tests/matrix_product/src/lib.rs @@ -25,29 +25,30 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, - |_, _| rng.gen_range(0u64, GENERATION_INTERVAL)) + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { + rng.gen_range(0u64, GENERATION_INTERVAL) + }) } /// Computes hash of a matrix as its trace. fn compute_matrix_hash(matrix: &Matrix) -> u64 { - let mut trace : u64 = 0; + let mut trace: u64 = 0; // it is assumed that matrix is squared for i in 0..matrix.ncols() { - trace += matrix[(i,i)] + trace += matrix[(i, i)] } trace } #[no_mangle] -pub extern fn main() -> u64 { - let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); - let seed : u64 = SEED.parse::().unwrap(); - let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); +pub extern "C" fn main() -> u64 { + let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let seed: u64 = SEED.parse::().unwrap(); + let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); - let mut matrix_hash : u64 = seed; + let mut matrix_hash: u64 = seed; for _ in 1..iterations_count { let matrix_a = generate_random_matrix(matrix_size, matrix_size, matrix_hash); matrix_hash = compute_matrix_hash(&matrix_a); diff --git a/bench/vm/tests/matrix_product/src/settings.rs b/bench/vm/tests/matrix_product/src/settings.rs index 0230aeba9d..0af9e2e0ef 100644 --- a/bench/vm/tests/matrix_product/src/settings.rs +++ b/bench/vm/tests/matrix_product/src/settings.rs @@ -14,16 +14,16 @@ * limitations under the License. */ /// This seed is used for deterministic operation count on different launches. -pub const SEED : &str = env!("SEED"); +pub const SEED: &str = env!("SEED"); /// Matrix size. -pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); +pub const MATRIX_SIZE: &str = env!("MATRIX_SIZE"); // count of test iterations -pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); // 1117 due to prevent overflow in matrix multiplication -pub const GENERATION_INTERVAL : u64 = 1117; +pub const GENERATION_INTERVAL: u64 = 1117; pub extern crate nalgebra; use nalgebra::DMatrix; diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index 74388792e3..deaa473572 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -25,28 +25,30 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { + rng.gen_range(0f64, GENERATION_INTERVAL) + }) } /// Computes hash of a matrix as its trace. fn compute_matrix_hash(matrix: &Matrix) -> f64 { - let mut trace : f64 = 0.0; + let mut trace: f64 = 0.0; // it is assumed that matrix is squared for i in 0..matrix.ncols() { - trace += matrix[(i,i)] + trace += matrix[(i, i)] } trace } #[no_mangle] -pub extern fn main() -> u64 { - let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); - let seed : u64 = SEED.parse::().unwrap(); - let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); +pub extern "C" fn main() -> u64 { + let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let seed: u64 = SEED.parse::().unwrap(); + let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); - let mut matrix_hash : u64 = seed; + let mut matrix_hash: u64 = seed; for _ in 1..iterations_count { let matrix = generate_random_matrix(matrix_size, matrix_size, matrix_hash); let qr = matrix.qr(); diff --git a/bench/vm/tests/matrix_qr_decomposition/src/settings.rs b/bench/vm/tests/matrix_qr_decomposition/src/settings.rs index 6649c035f4..9b7eea65c0 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/settings.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/settings.rs @@ -14,16 +14,16 @@ * limitations under the License. */ /// this seed is used for deterministic operation count on different launches -pub const SEED : &str = env!("SEED"); +pub const SEED: &str = env!("SEED"); /// a matrix size -pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); +pub const MATRIX_SIZE: &str = env!("MATRIX_SIZE"); /// count of test iterations -pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); /// 1117 due to prevent overflow in matrix multiplication -pub const GENERATION_INTERVAL : f64 = 1117.0; +pub const GENERATION_INTERVAL: f64 = 1117.0; pub extern crate nalgebra; use nalgebra::DMatrix; diff --git a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs index 561774533f..c00fdb2385 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs @@ -25,20 +25,25 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| rng.gen_range(0f64, GENERATION_INTERVAL)) + Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { + rng.gen_range(0f64, GENERATION_INTERVAL) + }) } #[no_mangle] -pub extern fn main() -> u64 { - let matrix_size : u32 = MATRIX_SIZE.parse::().unwrap(); - let seed : u64 = SEED.parse::().unwrap(); - let iterations_count : u64 = ITERATIONS_COUNT.parse::().unwrap(); +pub extern "C" fn main() -> u64 { + let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let seed: u64 = SEED.parse::().unwrap(); + let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); - let mut matrix_hash : u64 = seed; + let mut matrix_hash: u64 = seed; for _ in 1..iterations_count { let matrix = generate_random_matrix(matrix_size, matrix_size, matrix_hash); let svd = matrix.svd(true, true); - matrix_hash = svd.singular_values.iter().fold(0u64, |x1, x2| x1 ^ x2.to_bits()); + matrix_hash = svd + .singular_values + .iter() + .fold(0u64, |x1, x2| x1 ^ x2.to_bits()); } matrix_hash diff --git a/bench/vm/tests/matrix_svd_decomposition/src/settings.rs b/bench/vm/tests/matrix_svd_decomposition/src/settings.rs index bbae056455..4fe06c59fd 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/settings.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/settings.rs @@ -14,16 +14,16 @@ * limitations under the License. */ /// this seed is used for deterministic operation count on different launches -pub const SEED : &str = env!("SEED"); +pub const SEED: &str = env!("SEED"); /// a matrix size -pub const MATRIX_SIZE : &str = env!("MATRIX_SIZE"); +pub const MATRIX_SIZE: &str = env!("MATRIX_SIZE"); /// count of test iterations -pub const ITERATIONS_COUNT : &str = env!("ITERATIONS_COUNT"); +pub const ITERATIONS_COUNT: &str = env!("ITERATIONS_COUNT"); /// maximum value of matrix element -pub const GENERATION_INTERVAL : f64 = 1117.0; +pub const GENERATION_INTERVAL: f64 = 1117.0; pub extern crate nalgebra; use nalgebra::DMatrix; diff --git a/bench/vm/tests/recursive_hash/src/lib.rs b/bench/vm/tests/recursive_hash/src/lib.rs index ca0b83ee5a..4a782b4c8d 100644 --- a/bench/vm/tests/recursive_hash/src/lib.rs +++ b/bench/vm/tests/recursive_hash/src/lib.rs @@ -21,16 +21,17 @@ use sha3::{Digest, Sha3_256}; use std::mem; #[no_mangle] -pub extern fn main() -> u8 { - let iterations_count : i64 = ITERATIONS_COUNT.parse::().unwrap(); - let initial_value : i64 = INITIAL_VALUE.parse::().unwrap(); +pub extern "C" fn main() -> u8 { + let iterations_count: i64 = ITERATIONS_COUNT.parse::().unwrap(); + let initial_value: i64 = INITIAL_VALUE.parse::().unwrap(); - let seed_as_byte_array: [u8; mem::size_of::()] = unsafe { mem::transmute(initial_value.to_le()) }; + let seed_as_byte_array: [u8; mem::size_of::()] = + unsafe { mem::transmute(initial_value.to_le()) }; let mut hash_result = Sha3_256::digest(&seed_as_byte_array); for _ in 1..iterations_count { hash_result = Sha3_256::digest(&hash_result); } - hash_result.iter().fold(0, |x1 ,x2| x1 ^ x2) + hash_result.iter().fold(0, |x1, x2| x1 ^ x2) } From 0b1bd19242036e496e3ee34346ed26489a1f20c0 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 6 Dec 2018 22:03:09 +0300 Subject: [PATCH 44/48] fix review suggestions --- bench/vm/tests/compression/src/lib.rs | 12 ++++++------ bench/vm/tests/matrix_product/src/lib.rs | 6 +++--- bench/vm/tests/matrix_qr_decomposition/src/lib.rs | 8 ++++---- bench/vm/tests/matrix_svd_decomposition/src/lib.rs | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bench/vm/tests/compression/src/lib.rs b/bench/vm/tests/compression/src/lib.rs index a20dec4019..539be96bfc 100644 --- a/bench/vm/tests/compression/src/lib.rs +++ b/bench/vm/tests/compression/src/lib.rs @@ -28,9 +28,9 @@ use settings::{ITERATIONS_COUNT, SEED, SEQUENCE_SIZE}; type Sequence = Vec; /// Generates pseudo-random byte sequence by given seed and given size. -fn generate_sequence(seed: u64, size: u64) -> Sequence { +fn generate_sequence(seed: u64, size: usize) -> Sequence { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - let mut result_sequence = Sequence::with_capacity(size as usize); + let mut result_sequence = Sequence::with_capacity(size); for _ in 0..size { result_sequence.push(rng.gen::()); @@ -48,19 +48,19 @@ fn compress_sequence(sequence: &Sequence) -> Sequence { } #[no_mangle] -pub extern "C" fn main() -> u64 { +pub extern "C" fn main() -> u8 { let seed: u64 = SEED.parse::().unwrap(); let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); - let sequence_size: u64 = SEQUENCE_SIZE.parse::().unwrap(); + let sequence_size: usize = SEQUENCE_SIZE.parse::().unwrap(); let mut compressed_sequence = generate_sequence(seed, sequence_size); for _ in 1..iterations_count { - let new_seed = compressed_sequence.len() + let new_seed: usize = compressed_sequence.len() + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as usize; compressed_sequence = generate_sequence(new_seed as u64, sequence_size); compressed_sequence = compress_sequence(&compressed_sequence); } - compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) as u64 + compressed_sequence.iter().fold(0u8, |x1, x2| x1 ^ x2) } diff --git a/bench/vm/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs index c4148f33f8..607e7dd416 100644 --- a/bench/vm/tests/matrix_product/src/lib.rs +++ b/bench/vm/tests/matrix_product/src/lib.rs @@ -23,9 +23,9 @@ use rand_isaac::IsaacRng; use settings::*; /// Generates random matrix with given size by IsaacRng. -fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { + Matrix::from_fn(rows_number, columns_count, |_, _| { rng.gen_range(0u64, GENERATION_INTERVAL) }) } @@ -44,7 +44,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> u64 { #[no_mangle] pub extern "C" fn main() -> u64 { - let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let matrix_size: usize = MATRIX_SIZE.parse::().unwrap(); let seed: u64 = SEED.parse::().unwrap(); let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index deaa473572..78cf2e356f 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -23,10 +23,10 @@ use rand_isaac::IsaacRng; use settings::*; /// Generates random matrix with given size by IsaacRng. -fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { - rng.gen_range(0f64, GENERATION_INTERVAL) + Matrix::from_fn(rows_number, columns_count, |_, _| { + rng.gen_range(0u64, GENERATION_INTERVAL) }) } @@ -44,7 +44,7 @@ fn compute_matrix_hash(matrix: &Matrix) -> f64 { #[no_mangle] pub extern "C" fn main() -> u64 { - let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let matrix_size: usize = MATRIX_SIZE.parse::().unwrap(); let seed: u64 = SEED.parse::().unwrap(); let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); diff --git a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs index c00fdb2385..5e27452cdc 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs @@ -23,16 +23,16 @@ use rand_isaac::IsaacRng; use settings::*; /// Generates random matrix with given size by IsaacRng. -fn generate_random_matrix(rows_number: u32, columns_count: u32, seed: u64) -> Matrix { +fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); - Matrix::from_fn(rows_number as usize, columns_count as usize, |_, _| { + Matrix::from_fn(rows_number, columns_count, |_, _| { rng.gen_range(0f64, GENERATION_INTERVAL) }) } #[no_mangle] pub extern "C" fn main() -> u64 { - let matrix_size: u32 = MATRIX_SIZE.parse::().unwrap(); + let matrix_size: usize = MATRIX_SIZE.parse::().unwrap(); let seed: u64 = SEED.parse::().unwrap(); let iterations_count: u64 = ITERATIONS_COUNT.parse::().unwrap(); From 49ffce346aeeccc942d55af07fa44960adf6408b Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 7 Dec 2018 13:03:21 +0300 Subject: [PATCH 45/48] fix bug with float type --- bench/vm/tests/matrix_qr_decomposition/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index 78cf2e356f..75ca89e09a 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -26,7 +26,7 @@ use settings::*; fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); Matrix::from_fn(rows_number, columns_count, |_, _| { - rng.gen_range(0u64, GENERATION_INTERVAL) + rng.gen_range(0f64, GENERATION_INTERVAL) }) } From 5e9a5e151ebf4775db24f95ea639e4efb0c1db86 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 7 Dec 2018 13:20:11 +0300 Subject: [PATCH 46/48] add rust-toolchain file --- bench/vm/tests/compression/rust-toolchain | 1 + bench/vm/tests/factorization_reikna/rust-toolchain | 1 + bench/vm/tests/matrix_product/rust-toolchain | 1 + bench/vm/tests/matrix_product/src/lib.rs | 1 + bench/vm/tests/matrix_qr_decomposition/rust-toolchain | 1 + bench/vm/tests/matrix_qr_decomposition/src/lib.rs | 1 + bench/vm/tests/matrix_svd_decomposition/rust-toolchain | 1 + bench/vm/tests/matrix_svd_decomposition/src/lib.rs | 1 + bench/vm/tests/recursive_hash/rust-toolchain | 1 + 9 files changed, 9 insertions(+) create mode 100644 bench/vm/tests/compression/rust-toolchain create mode 100644 bench/vm/tests/factorization_reikna/rust-toolchain create mode 100644 bench/vm/tests/matrix_product/rust-toolchain create mode 100644 bench/vm/tests/matrix_qr_decomposition/rust-toolchain create mode 100644 bench/vm/tests/matrix_svd_decomposition/rust-toolchain create mode 100644 bench/vm/tests/recursive_hash/rust-toolchain diff --git a/bench/vm/tests/compression/rust-toolchain b/bench/vm/tests/compression/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/compression/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/bench/vm/tests/factorization_reikna/rust-toolchain b/bench/vm/tests/factorization_reikna/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/factorization_reikna/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/bench/vm/tests/matrix_product/rust-toolchain b/bench/vm/tests/matrix_product/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/matrix_product/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/bench/vm/tests/matrix_product/src/lib.rs b/bench/vm/tests/matrix_product/src/lib.rs index 607e7dd416..78bfedd5a6 100644 --- a/bench/vm/tests/matrix_product/src/lib.rs +++ b/bench/vm/tests/matrix_product/src/lib.rs @@ -25,6 +25,7 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number, columns_count, |_, _| { rng.gen_range(0u64, GENERATION_INTERVAL) }) diff --git a/bench/vm/tests/matrix_qr_decomposition/rust-toolchain b/bench/vm/tests/matrix_qr_decomposition/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/matrix_qr_decomposition/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs index 75ca89e09a..f5300009af 100644 --- a/bench/vm/tests/matrix_qr_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_qr_decomposition/src/lib.rs @@ -25,6 +25,7 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number, columns_count, |_, _| { rng.gen_range(0f64, GENERATION_INTERVAL) }) diff --git a/bench/vm/tests/matrix_svd_decomposition/rust-toolchain b/bench/vm/tests/matrix_svd_decomposition/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/matrix_svd_decomposition/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs index 5e27452cdc..3793850fd3 100644 --- a/bench/vm/tests/matrix_svd_decomposition/src/lib.rs +++ b/bench/vm/tests/matrix_svd_decomposition/src/lib.rs @@ -25,6 +25,7 @@ use settings::*; /// Generates random matrix with given size by IsaacRng. fn generate_random_matrix(rows_number: usize, columns_count: usize, seed: u64) -> Matrix { let mut rng: IsaacRng = SeedableRng::seed_from_u64(seed); + Matrix::from_fn(rows_number, columns_count, |_, _| { rng.gen_range(0f64, GENERATION_INTERVAL) }) diff --git a/bench/vm/tests/recursive_hash/rust-toolchain b/bench/vm/tests/recursive_hash/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/recursive_hash/rust-toolchain @@ -0,0 +1 @@ +nightly From e57bad4a9ae633391dca340d0d7d0afa8871e1a9 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 7 Dec 2018 13:21:37 +0300 Subject: [PATCH 47/48] add rust-toolchain to factorization_reikna --- bench/vm/tests/fibonacci_bigint/rust-toolchain | 1 + 1 file changed, 1 insertion(+) create mode 100644 bench/vm/tests/fibonacci_bigint/rust-toolchain diff --git a/bench/vm/tests/fibonacci_bigint/rust-toolchain b/bench/vm/tests/fibonacci_bigint/rust-toolchain new file mode 100644 index 0000000000..bf867e0ae5 --- /dev/null +++ b/bench/vm/tests/fibonacci_bigint/rust-toolchain @@ -0,0 +1 @@ +nightly From 8bc7042835a852fa439c543500a30176ef145797 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 7 Dec 2018 13:23:52 +0300 Subject: [PATCH 48/48] remove +nightly from README since rust-toolchain added --- bench/vm/tests/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/vm/tests/README.md b/bench/vm/tests/README.md index e82b231299..cafaf611c3 100644 --- a/bench/vm/tests/README.md +++ b/bench/vm/tests/README.md @@ -38,7 +38,7 @@ To run: ```shell cd recursive_hash -ITERATIONS_COUNT=1 SEED=1000000 SEQUENCE_SIZE=1024 cargo +nightly build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] +ITERATIONS_COUNT=1 SEED=1000000 SEQUENCE_SIZE=1024 cargo build --release --target wasm32-unknown-unknown [--feature "deflate_compression"] ``` ### Factorization @@ -49,7 +49,7 @@ To run: ```shell cd factorization_reikna -FACTORIZED_NUMBER=2147483647 cargo +nightly build --release --target wasm32-unknown-unknown +FACTORIZED_NUMBER=2147483647 cargo build --release --target wasm32-unknown-unknown ``` ### Recursive fibonacci computing @@ -60,7 +60,7 @@ To run: ```shell cd fibonacci_bigint -FIB_NUMBER=38 cargo +nightly build --release --target wasm32-unknown-unknown +FIB_NUMBER=38 cargo build --release --target wasm32-unknown-unknown ``` ### Matrix product @@ -71,7 +71,7 @@ To run: ```shell cd matrix_product -ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo build --release --target wasm32-unknown-unknown ``` ### Matrix QR decomposition @@ -82,7 +82,7 @@ To run: ```shell cd matrix_qr_decomposition -ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo build --release --target wasm32-unknown-unknown ``` ### Matrix SVD decomposition @@ -93,7 +93,7 @@ To run: ```shell cd matrix_svd_decomposition -ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo +nightly build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=1000000 SEED=1 MATRIX_SIZE=10 cargo build --release --target wasm32-unknown-unknown ``` ### Recursive hash computing @@ -104,5 +104,5 @@ To run: ```shell cd recursive_hash -ITERATIONS_COUNT=10000000 INITIAL_VALUE=0 cargo +nightly build --release --target wasm32-unknown-unknown +ITERATIONS_COUNT=10000000 INITIAL_VALUE=0 cargo build --release --target wasm32-unknown-unknown ```