Skip to content

add benchmark_from_scratch flag #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

yhmtsai
Copy link
Member

@yhmtsai yhmtsai commented Jul 7, 2025

This PR allows user to select whether to benchmark the solver from scratch or not.

The previous behavior is to benchmark the solver from scratch every time, which will benchmark the workspace initialization every time.
The proposed behavior is to benchamark the same solver object such that we only need to initialize the workspace in the first run (or warmup).
User can set it --benchmark_from_scratch=true again to benchmark the solver with initialization.

@yhmtsai yhmtsai requested a review from a team July 7, 2025 13:24
@yhmtsai yhmtsai self-assigned this Jul 7, 2025
@yhmtsai yhmtsai added the 1:ST:ready-for-review This PR is ready for review label Jul 7, 2025
@ginkgo-bot ginkgo-bot added reg:benchmarking This is related to benchmarking. type:solver This is related to the solvers labels Jul 7, 2025
FLAGS_max_iters)
->generate(state.system_matrix));
generate_timer->toc();
// if we benchmark from scrach, we use the new generated solver.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
// if we benchmark from scrach, we use the new generated solver.
// if we benchmark from scratch, we use the new generated solver.

generate_timer->toc();
// if we benchmark from scrach, we use the new generated solver.
if (FLAGS_benchmark_from_scratch) {
solver = generated_solver;
Copy link
Member

@pratikvn pratikvn Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If benchmark from scratch is off, then the we use the generated solver from the warmup (line 477), right ? I think then we dont use FLAGS_max_iters and use FLAGS_warmup_max_iters instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. we still use max_iters for apply but the solver is used once from warmup.
I just realize this will be broken when no warmup iteration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue when no warmup iteration is fixed now

@yhmtsai yhmtsai force-pushed the check_solver_without_reinit branch from 7ab9521 to 156a081 Compare July 30, 2025 09:06
@@ -509,19 +515,27 @@ struct SolverBenchmark : Benchmark<solver_benchmark_state<Generator>> {
exec->get_master()->add_logger(gen_logger);
}

auto precond = precond_factory.at(precond_name)(exec);
solver = generate_solver(exec, give(precond), solver_name,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

free entry in the previous output is deleting the workspace from previous warmup apply not the generation. It introduces the changes for test output

@yhmtsai yhmtsai requested a review from pratikvn July 30, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-for-review This PR is ready for review reg:benchmarking This is related to benchmarking. type:solver This is related to the solvers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants