Skip to content

Commit af70b54

Browse files
committed
[bench] allow parsing overhead linop
1 parent c9b7045 commit af70b54

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

benchmark/preconditioner/preconditioner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct PreconditionerBenchmark : Benchmark<preconditioner_benchmark_state> {
8080
IterationControl ic_gen{get_timer(exec, FLAGS_gpu_timer)};
8181
IterationControl ic_apply{get_timer(exec, FLAGS_gpu_timer)};
8282

83-
auto context = gko::config::registry{};
83+
auto context = create_default_registry();
8484
auto td = gko::config::make_type_descriptor<etype, itype>();
8585
auto preconditioner_config =
8686
gko::ext::config::parse_json(operation_case["preconditioner"]);

benchmark/solver/solver_common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ struct SolverBenchmark : Benchmark<solver_benchmark_state<Generator>> {
226226
auto warmup_config =
227227
gko::ext::config::parse_json(warmup_case["solver"]);
228228

229-
auto registry = gko::config::registry{};
229+
auto registry = create_default_registry();
230230
auto td = gko::config::make_type_descriptor<etype>();
231231

232232
IterationControl ic{timer};

benchmark/utils/general.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
#include "benchmark/utils/json.hpp"
3131
#include "benchmark/utils/timer.hpp"
3232
#include "benchmark/utils/types.hpp"
33+
#include "core/config/config_helper.hpp"
3334
#include "core/distributed/helpers.hpp"
35+
#include "overhead_linop.hpp"
3436

3537

3638
// Global command-line arguments
@@ -565,4 +567,21 @@ std::unique_ptr<VectorType> create_normalized_manufactured_rhs(
565567
}
566568

567569

570+
inline gko::config::registry create_default_registry()
571+
{
572+
return {{{"overhead",
573+
[](const gko::config::pnode& config,
574+
const gko::config::registry& context,
575+
gko::config::type_descriptor td_for_child)
576+
-> gko::deferred_factory_parameter<gko::LinOpFactory> {
577+
auto params = gko::Overhead<etype>::build();
578+
if (auto& obj = config.get("criteria")) {
579+
params.with_criteria(gko::config::parse_or_get_criteria(
580+
obj, context, td_for_child));
581+
}
582+
return params;
583+
}}}};
584+
}
585+
586+
568587
#endif // GKO_BENCHMARK_UTILS_GENERAL_HPP_

benchmark/utils/overhead_linop.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -135,8 +135,10 @@ class Overhead : public EnableLinOp<Overhead<ValueType>>,
135135
set_preconditioner(matrix::Identity<ValueType>::create(
136136
this->get_executor(), this->get_size()[0]));
137137
}
138-
stop_criterion_factory_ =
139-
stop::combine(std::move(parameters_.criteria));
138+
if (!parameters_.criteria.empty()) {
139+
stop_criterion_factory_ =
140+
stop::combine(std::move(parameters_.criteria));
141+
}
140142
}
141143

142144
private:

0 commit comments

Comments
 (0)