things
This commit is contained in:
parent
976c7d0894
commit
f5bcaa7792
2 changed files with 18 additions and 19 deletions
|
|
@ -79,8 +79,8 @@ pub fn run(
|
||||||
bucket_size: usize,
|
bucket_size: usize,
|
||||||
density: f32,
|
density: f32,
|
||||||
runs: usize,
|
runs: usize,
|
||||||
n_len: (usize, usize),
|
|
||||||
) -> Vec<std::time::Duration> {
|
) -> Vec<std::time::Duration> {
|
||||||
|
print!("#");
|
||||||
(0..runs)
|
(0..runs)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let grid = create_grid(grid_size, grid_size, density);
|
let grid = create_grid(grid_size, grid_size, density);
|
||||||
|
|
|
||||||
33
src/main.rs
33
src/main.rs
|
|
@ -1,6 +1,6 @@
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use rayon::iter::ParallelIterator;
|
use rayon::iter::ParallelIterator;
|
||||||
use rayon::prelude::ParallelBridge;
|
use rayon::prelude::IntoParallelIterator;
|
||||||
|
|
||||||
mod bsq;
|
mod bsq;
|
||||||
const RUNS: usize = 256;
|
const RUNS: usize = 256;
|
||||||
|
|
@ -15,27 +15,26 @@ struct Run {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let len = (1..13)
|
let params = (1..10)
|
||||||
.cartesian_product(1..13)
|
.cartesian_product(1..10)
|
||||||
.filter(|&(grid_size, chunk_size)| (grid_size - 5 <= chunk_size && chunk_size <= grid_size))
|
.filter(|&(grid_size, chunk_size)| (grid_size - 4 < chunk_size && chunk_size < grid_size))
|
||||||
.flat_map(|t| std::iter::repeat(t).zip((1..10).map(|i| i as f32 / 10.0)))
|
.flat_map(|t| std::iter::repeat(t).zip((1..8).map(|i| i as f32 / 8.0)))
|
||||||
.count();
|
.map(|((grid_size, chunk_size), density)| (1 << grid_size, 1 << chunk_size, density))
|
||||||
|
.collect_vec();
|
||||||
let params = (1..13)
|
println!("len = {}", params.len());
|
||||||
.cartesian_product(1..13)
|
|
||||||
.filter(|&(grid_size, chunk_size)| (grid_size - 5 <= chunk_size && chunk_size <= grid_size))
|
|
||||||
.flat_map(|t| std::iter::repeat(t).zip((1..10).map(|i| i as f32 / 10.0)))
|
|
||||||
.map(|((grid_size, chunk_size), density)| (1 << grid_size, 1 << chunk_size, density));
|
|
||||||
let res = params
|
let res = params
|
||||||
.enumerate()
|
.into_par_iter()
|
||||||
.par_bridge()
|
.map(|(gridsize, chunksize, density)| Run {
|
||||||
.map(|(n, (gridsize, chunksize, density))| Run {
|
|
||||||
chunksize,
|
chunksize,
|
||||||
gridsize,
|
gridsize,
|
||||||
density,
|
density,
|
||||||
runs: RUNS,
|
runs: RUNS,
|
||||||
results: bsq::run(gridsize, chunksize, density, RUNS, (n, len)),
|
results: bsq::run(gridsize, chunksize, density, RUNS),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
serde_json::to_writer(std::fs::File::open(format!("./data-{}.json", chrono::Local::now().format("%s"))).unwrap(), &res).unwrap();
|
serde_json::to_writer(
|
||||||
|
std::fs::File::open(format!("./data-{}.json", chrono::Local::now().format("%s"))).unwrap(),
|
||||||
|
&res,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue