Skip to content

Commit

Permalink
update the benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
xgarnaud committed Jul 29, 2024
1 parent aae0af2 commit 19c21c1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/bin/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ enum BenchmarkType {
MultPar,
MultParChunks,
JacobiPar,
SGSSeq,
SGS,
}

fn run(bench_type: BenchmarkType, n: usize, duration: f64) {
Expand Down Expand Up @@ -109,6 +111,36 @@ fn run(bench_type: BenchmarkType, n: usize, duration: f64) {
},
duration,
),
BenchmarkType::SGSSeq => benchmark(
|| {
let mut sol = vec![0.0; mat.n()];
mat.seq_sgs(
&x,
&mut sol,
IterativeParams {
max_iter: 10,
..Default::default()
},
);
},
duration,
),
BenchmarkType::SGS => benchmark(
|| {
let chunk_size = mat.n() / current_num_threads();
let mut sol = vec![0.0; mat.n()];
mat.sgs(
&x,
&mut sol,
IterativeParams {
max_iter: 10,
..Default::default()
},
chunk_size,
);
},
duration,
),
}
}

Expand All @@ -122,4 +154,8 @@ fn main() {
run(BenchmarkType::MultPar, n, duration);
run(BenchmarkType::MultParChunks, n, duration);
run(BenchmarkType::JacobiPar, n, duration);
if current_num_threads() == 1 {
run(BenchmarkType::SGSSeq, n, duration);
}
run(BenchmarkType::SGS, n, duration);
}

0 comments on commit 19c21c1

Please sign in to comment.