diff --git a/benchmark/blas/blas.cpp b/benchmark/blas/blas.cpp index 52efd172500..ee2dc06d01b 100644 --- a/benchmark/blas/blas.cpp +++ b/benchmark/blas/blas.cpp @@ -137,7 +137,7 @@ Parameters for a benchmark case are: print_general_information(extra_information); auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer); - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { diff --git a/benchmark/blas/blas_common.hpp b/benchmark/blas/blas_common.hpp index 9c54257e922..f36b7649ffc 100644 --- a/benchmark/blas/blas_common.hpp +++ b/benchmark/blas/blas_common.hpp @@ -434,6 +434,28 @@ dimensions parse_dims(rapidjson::Value& test_case) } +std::string describe(rapidjson::Value& test_case) +{ + std::stringstream ss; + auto optional_output = [&](const char* name) { + if (test_case.HasMember(name) && test_case[name].IsInt64()) { + ss << name << " = " << test_case[name].GetInt64() << " "; + } + }; + optional_output("n"); + optional_output("k"); + optional_output("m"); + optional_output("r"); + optional_output("stride"); + optional_output("stride_x"); + optional_output("stride_y"); + optional_output("stride_A"); + optional_output("stride_B"); + optional_output("stride_C"); + return ss.str(); +} + + template void apply_blas(const char* operation_name, std::shared_ptr exec, std::shared_ptr timer, const OpMap& operation_map, @@ -501,6 +523,11 @@ void run_blas_benchmarks(std::shared_ptr exec, { auto operations = split(FLAGS_operations, ','); auto& allocator = test_cases.GetAllocator(); + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; for (auto& test_case : test_cases.GetArray()) { try { @@ -521,10 +548,14 @@ void run_blas_benchmarks(std::shared_ptr exec, if (do_print) { std::clog << "Running test case: " << test_case << std::endl; } - + // annotate the test case + auto test_case_range = annotate(describe(test_case)); for (const auto& operation_name : operations) { - apply_blas(operation_name.c_str(), exec, timer, operation_map, - test_case, allocator); + { + auto operation_range = annotate(operation_name.c_str()); + apply_blas(operation_name.c_str(), exec, timer, + operation_map, test_case, allocator); + } if (do_print) { std::clog << "Current state:" << std::endl @@ -538,4 +569,7 @@ void run_blas_benchmarks(std::shared_ptr exec, << std::endl; } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } } diff --git a/benchmark/blas/distributed/multi_vector.cpp b/benchmark/blas/distributed/multi_vector.cpp index 1f19be5dd96..4d3b821ed2e 100644 --- a/benchmark/blas/distributed/multi_vector.cpp +++ b/benchmark/blas/distributed/multi_vector.cpp @@ -71,7 +71,7 @@ Parameters for a benchmark case are: auto exec = executor_factory_mpi.at(FLAGS_executor)(comm.get()); - std::string json_input = broadcast_json_input(std::cin, comm); + std::string json_input = broadcast_json_input(get_input_stream(), comm); rapidjson::Document test_cases; test_cases.Parse(json_input.c_str()); if (!test_cases.IsArray()) { diff --git a/benchmark/conversions/conversions.cpp b/benchmark/conversions/conversions.cpp index 403f416d375..ec7febf262f 100644 --- a/benchmark/conversions/conversions.cpp +++ b/benchmark/conversions/conversions.cpp @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer); auto formats = split(FLAGS_formats, ','); - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { @@ -131,6 +131,13 @@ int main(int argc, char* argv[]) } auto& allocator = test_cases.GetAllocator(); + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; + + DefaultSystemGenerator<> generator{}; for (auto& test_case : test_cases.GetArray()) { std::clog << "Benchmarking conversions. " << std::endl; @@ -146,7 +153,7 @@ int main(int argc, char* argv[]) std::clog << "Running test case: " << test_case << std::endl; gko::matrix_data data; try { - data = DefaultSystemGenerator<>::generate_matrix_data(test_case); + data = generator.generate_matrix_data(test_case); } catch (std::exception& e) { std::cerr << "Error setting up matrix data, what(): " << e.what() << std::endl; @@ -160,6 +167,8 @@ int main(int argc, char* argv[]) std::clog << "Matrix is of size (" << data.size[0] << ", " << data.size[1] << ")" << std::endl; add_or_set_member(test_case, "size", data.size[0], allocator); + // annotate the test case + auto test_case_range = annotate(generator.describe_config(test_case)); for (const auto& format_from : formats) { try { auto matrix_from = @@ -175,10 +184,13 @@ int main(int argc, char* argv[]) conversion_case.HasMember(conversion_name.c_str())) { continue; } - - convert_matrix(matrix_from.get(), format_to.c_str(), - conversion_name.c_str(), exec, test_case, - allocator); + { + auto conversion_range = + annotate(conversion_name.c_str()); + convert_matrix(matrix_from.get(), format_to.c_str(), + conversion_name.c_str(), exec, test_case, + allocator); + } std::clog << "Current state:" << std::endl << test_cases << std::endl; } @@ -202,6 +214,9 @@ int main(int argc, char* argv[]) } } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } std::cout << test_cases << std::endl; } diff --git a/benchmark/matrix_generator/matrix_generator.cpp b/benchmark/matrix_generator/matrix_generator.cpp index d99b97672b4..138b5a9c2ce 100644 --- a/benchmark/matrix_generator/matrix_generator.cpp +++ b/benchmark/matrix_generator/matrix_generator.cpp @@ -132,7 +132,7 @@ int main(int argc, char* argv[]) std::clog << gko::version_info::get() << std::endl; auto engine = get_engine(); - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document configurations; configurations.ParseStream(jcin); diff --git a/benchmark/matrix_statistics/matrix_statistics.cpp b/benchmark/matrix_statistics/matrix_statistics.cpp index a62c8c10637..45f21ca1e35 100644 --- a/benchmark/matrix_statistics/matrix_statistics.cpp +++ b/benchmark/matrix_statistics/matrix_statistics.cpp @@ -177,7 +177,7 @@ int main(int argc, char* argv[]) std::clog << gko::version_info::get() << std::endl; - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { diff --git a/benchmark/preconditioner/preconditioner.cpp b/benchmark/preconditioner/preconditioner.cpp index 46370657a45..281e64ddd76 100644 --- a/benchmark/preconditioner/preconditioner.cpp +++ b/benchmark/preconditioner/preconditioner.cpp @@ -278,7 +278,7 @@ int main(int argc, char* argv[]) std::exit(1); } - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { @@ -286,7 +286,11 @@ int main(int argc, char* argv[]) } auto& allocator = test_cases.GetAllocator(); - + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; DefaultSystemGenerator<> generator{}; for (auto& test_case : test_cases.GetArray()) { @@ -308,6 +312,10 @@ int main(int argc, char* argv[]) } std::clog << "Running test case: " << test_case << std::endl; + // annotate the test case + auto test_case_range = + annotate(generator.describe_config(test_case)); + auto data = generator.generate_matrix_data(test_case); auto system_matrix = @@ -322,8 +330,12 @@ int main(int argc, char* argv[]) << std::endl; add_or_set_member(test_case, "size", data.size[0], allocator); for (const auto& precond_name : preconditioners) { - run_preconditioner(precond_name.c_str(), exec, system_matrix, - b.get(), x.get(), test_case, allocator); + { + auto precond_range = annotate(precond_name.c_str()); + run_preconditioner(precond_name.c_str(), exec, + system_matrix, b.get(), x.get(), + test_case, allocator); + } std::clog << "Current state:" << std::endl << test_cases << std::endl; backup_results(test_cases); @@ -333,6 +345,9 @@ int main(int argc, char* argv[]) << std::endl; } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } std::cout << test_cases << std::endl; } diff --git a/benchmark/solver/distributed/solver.cpp b/benchmark/solver/distributed/solver.cpp index a9b6b85ee74..2db71c16ca3 100644 --- a/benchmark/solver/distributed/solver.cpp +++ b/benchmark/solver/distributed/solver.cpp @@ -128,12 +128,12 @@ int main(int argc, char* argv[]) } } - std::string json_input = FLAGS_overhead - ? R"( + std::string json_input = + FLAGS_overhead ? R"( [{"filename": "overhead.mtx", "optimal": {"spmv": "csr-csr"}] )" - : broadcast_json_input(std::cin, comm); + : broadcast_json_input(get_input_stream(), comm); rapidjson::Document test_cases; test_cases.Parse(json_input.c_str()); diff --git a/benchmark/solver/solver.cpp b/benchmark/solver/solver.cpp index fdbeac1e86b..9190c99dad0 100644 --- a/benchmark/solver/solver.cpp +++ b/benchmark/solver/solver.cpp @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) rapidjson::Document test_cases; if (!FLAGS_overhead) { - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); test_cases.ParseStream(jcin); } else { // Fake test case to run once diff --git a/benchmark/solver/solver_common.hpp b/benchmark/solver/solver_common.hpp index fc10d50050a..64190f8d968 100644 --- a/benchmark/solver/solver_common.hpp +++ b/benchmark/solver/solver_common.hpp @@ -610,6 +610,11 @@ void run_solver_benchmarks(std::shared_ptr exec, } auto& allocator = test_cases.GetAllocator(); + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; for (auto& test_case : test_cases.GetArray()) { try { @@ -628,6 +633,10 @@ void run_solver_benchmarks(std::shared_ptr exec, })) { continue; } + // annotate the test case + auto test_case_range = + annotate(system_generator.describe_config(test_case)); + if (do_print) { std::clog << "Running test case: " << test_case << std::endl; } @@ -660,16 +669,20 @@ void run_solver_benchmarks(std::shared_ptr exec, allocator); auto precond_solver_name = begin(precond_solvers); for (const auto& solver_name : solvers) { + auto solver_range = annotate(solver_name.c_str()); for (const auto& precond_name : preconds) { if (do_print) { std::clog << "\tRunning solver: " << *precond_solver_name << std::endl; } - solve_system(solver_name, precond_name, - precond_solver_name->c_str(), exec, timer, - system_matrix, b.get(), x.get(), test_case, - allocator); + { + auto precond_range = annotate(precond_name.c_str()); + solve_system(solver_name, precond_name, + precond_solver_name->c_str(), exec, timer, + system_matrix, b.get(), x.get(), test_case, + allocator); + } if (do_print) { backup_results(test_cases); } @@ -686,6 +699,9 @@ void run_solver_benchmarks(std::shared_ptr exec, } } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } } diff --git a/benchmark/sparse_blas/sparse_blas.cpp b/benchmark/sparse_blas/sparse_blas.cpp index 2cb1a1f63ea..4fb06d2a4a0 100644 --- a/benchmark/sparse_blas/sparse_blas.cpp +++ b/benchmark/sparse_blas/sparse_blas.cpp @@ -155,7 +155,7 @@ int main(int argc, char* argv[]) auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer); - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { @@ -166,9 +166,16 @@ int main(int argc, char* argv[]) print_general_information(extra_information); auto& allocator = test_cases.GetAllocator(); + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; auto operations = split(FLAGS_operations, ','); + DefaultSystemGenerator<> generator{}; + for (auto& test_case : test_cases.GetArray()) { try { // set up benchmark @@ -180,8 +187,7 @@ int main(int argc, char* argv[]) } auto& sp_blas_case = test_case[benchmark_name]; std::clog << "Running test case: " << test_case << std::endl; - auto data = - DefaultSystemGenerator<>::generate_matrix_data(test_case); + auto data = generator.generate_matrix_data(test_case); data.ensure_row_major_order(); std::clog << "Matrix is of size (" << data.size[0] << ", " << data.size[1] << "), " << data.nonzeros.size() @@ -193,11 +199,17 @@ int main(int argc, char* argv[]) auto mtx = Mtx::create(exec, data.size, data.nonzeros.size()); mtx->read(data); + // annotate the test case + auto test_case_range = + annotate(generator.describe_config(test_case)); for (const auto& operation_name : operations) { if (FLAGS_overwrite || !sp_blas_case.HasMember(operation_name.c_str())) { - apply_sparse_blas(operation_name.c_str(), exec, mtx.get(), - sp_blas_case, allocator); + { + auto operation_range = annotate(operation_name.c_str()); + apply_sparse_blas(operation_name.c_str(), exec, + mtx.get(), sp_blas_case, allocator); + } std::clog << "Current state:" << std::endl << test_cases << std::endl; backup_results(test_cases); @@ -215,6 +227,9 @@ int main(int argc, char* argv[]) } } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } std::cout << test_cases << std::endl; } diff --git a/benchmark/spmv/distributed/spmv.cpp b/benchmark/spmv/distributed/spmv.cpp index b56a3b6aea3..3c2986846b3 100644 --- a/benchmark/spmv/distributed/spmv.cpp +++ b/benchmark/spmv/distributed/spmv.cpp @@ -124,7 +124,7 @@ int main(int argc, char* argv[]) } } - std::string json_input = broadcast_json_input(std::cin, comm); + std::string json_input = broadcast_json_input(get_input_stream(), comm); rapidjson::Document test_cases; test_cases.Parse(json_input.c_str()); if (!test_cases.IsArray()) { diff --git a/benchmark/spmv/spmv.cpp b/benchmark/spmv/spmv.cpp index 4c3386f54ae..df000cecd47 100644 --- a/benchmark/spmv/spmv.cpp +++ b/benchmark/spmv/spmv.cpp @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) auto exec = executor_factory.at(FLAGS_executor)(FLAGS_gpu_timer); auto formats = split(FLAGS_formats, ','); - rapidjson::IStreamWrapper jcin(std::cin); + rapidjson::IStreamWrapper jcin(get_input_stream()); rapidjson::Document test_cases; test_cases.ParseStream(jcin); if (!test_cases.IsArray()) { diff --git a/benchmark/spmv/spmv_common.hpp b/benchmark/spmv/spmv_common.hpp index 7fe1aad436d..4c40f1b9a7b 100644 --- a/benchmark/spmv/spmv_common.hpp +++ b/benchmark/spmv/spmv_common.hpp @@ -160,6 +160,11 @@ void run_spmv_benchmark(std::shared_ptr exec, std::shared_ptr timer, bool do_print) { auto& allocator = test_cases.GetAllocator(); + auto profiler_hook = create_profiler_hook(exec); + if (profiler_hook) { + exec->add_logger(profiler_hook); + } + auto annotate = annotate_functor{profiler_hook}; for (auto& test_case : test_cases.GetArray()) { try { @@ -181,6 +186,10 @@ void run_spmv_benchmark(std::shared_ptr exec, if (do_print) { std::clog << "Running test case: " << test_case << std::endl; } + // annotate the test case + auto test_case_range = + annotate(system_generator.describe_config(test_case)); + auto data = system_generator.generate_matrix_data(test_case); auto nrhs = FLAGS_nrhs; @@ -213,9 +222,12 @@ void run_spmv_benchmark(std::shared_ptr exec, exec->synchronize(); } for (const auto& format_name : formats) { - apply_spmv(format_name.c_str(), exec, system_generator, timer, - data, b.get(), x.get(), answer.get(), test_case, - allocator); + { + auto format_range = annotate(format_name.c_str()); + apply_spmv(format_name.c_str(), exec, system_generator, + timer, data, b.get(), x.get(), answer.get(), + test_case, allocator); + } if (do_print) { std::clog << "Current state:" << std::endl << test_cases << std::endl; @@ -246,6 +258,9 @@ void run_spmv_benchmark(std::shared_ptr exec, } } } + if (profiler_hook) { + exec->remove_logger(profiler_hook); + } } #endif // GINKGO_BENCHMARK_SPMV_SPMV_COMMON_HPP diff --git a/benchmark/utils/general.hpp b/benchmark/utils/general.hpp index dcdb5552ed1..92c3e5c9b13 100644 --- a/benchmark/utils/general.hpp +++ b/benchmark/utils/general.hpp @@ -84,6 +84,11 @@ DEFINE_string(double_buffer, "", " buffering of backup files, in case of a" " crash when overwriting the backup"); +DEFINE_string( + input, "", + "If set, the value is used as the input for the benchmark (if set to a " + "json string ending with ]) or as input file path (otherwise)."); + DEFINE_bool(detailed, true, "If set, performs several runs to obtain more detailed results"); @@ -93,6 +98,16 @@ DEFINE_bool(keep_errors, true, DEFINE_bool(nested_names, false, "If set, separately logs nested operations"); +DEFINE_bool(profile, false, + "If set, enables profiler mode: 1 repetition, 0 warmup " + "repetitions, detailed=false, profiler_hook=auto (if it is not " + "otherwise set)"); + +DEFINE_string( + profiler_hook, "none", + "Which profiler annotation mode to use, if any. Options are " + "none, nvtx, roctx, vtune, tau, debug, auto (choose based on executor)."); + DEFINE_uint32(seed, 42, "Seed used for the random number generator"); DEFINE_uint32(warmup, 2, "Warm-up repetitions"); @@ -153,6 +168,14 @@ void initialize_argument_parsing(int* argc, char** argv[], std::string& header, ver << gko::version_info::get(); gflags::SetVersionString(ver.str()); gflags::ParseCommandLineFlags(argc, argv, true); + if (FLAGS_profile) { + FLAGS_repetitions = "1"; + FLAGS_warmup = 0; + FLAGS_detailed = false; + if (FLAGS_profiler_hook == "none") { + FLAGS_profiler_hook = "auto"; + } + } } /** @@ -181,6 +204,70 @@ void print_general_information(const std::string& extra) } +std::shared_ptr create_profiler_hook( + std::shared_ptr exec) +{ + using gko::log::ProfilerHook; + std::map()>> + hook_map{ + {"none", [] { return std::shared_ptr{}; }}, + {"auto", [&] { return ProfilerHook::create_for_executor(exec); }}, + {"nvtx", [] { return ProfilerHook::create_nvtx(); }}, + {"roctx", [] { return ProfilerHook::create_roctx(); }}, + {"tau", [] { return ProfilerHook::create_tau(); }}, + {"vtune", [] { return ProfilerHook::create_vtune(); }}, + {"debug", [] { + return ProfilerHook::create_custom( + [](const char* name, gko::log::profile_event_category) { + std::clog << "DEBUG: begin " << name << '\n'; + }, + [](const char* name, gko::log::profile_event_category) { + std::clog << "DEBUG: end " << name << '\n'; + }); + }}}; + return hook_map.at(FLAGS_profiler_hook)(); +} + + +struct owning_profiling_scope_guard { + std::string name; + gko::log::profiling_scope_guard guard; + + owning_profiling_scope_guard() = default; + + owning_profiling_scope_guard(std::string name_, + gko::log::ProfilerHook* profiler_hook) + : name(std::move(name_)), guard{profiler_hook->user_range(name.c_str())} + {} +}; + + +struct annotate_functor { + owning_profiling_scope_guard operator()(std::string name) const + { + if (profiler_hook) { + return owning_profiling_scope_guard{std::move(name), + profiler_hook.get()}; + } + return {}; + } + + gko::log::profiling_scope_guard operator()(const char* name) const + { + if (profiler_hook) { + return profiler_hook->user_range(name); + } + return {}; + } + + annotate_functor(std::shared_ptr profiler_hook) + : profiler_hook{std::move(profiler_hook)} + {} + + std::shared_ptr profiler_hook; +}; + + // Returns a random number engine std::default_random_engine& get_engine() { @@ -202,6 +289,26 @@ std::vector split(const std::string& s, char delimiter = ',') } +// returns the stream to be used as input of the application +std::istream& get_input_stream() +{ + static auto stream = []() -> std::unique_ptr { + std::string input_str(FLAGS_input); + if (input_str.empty()) { + return nullptr; + } + if (input_str.back() == ']') { + return std::make_unique(input_str); + } + return std::make_unique(input_str); + }(); + if (stream) { + return *stream; + } + return std::cin; +} + + // backup generation void backup_results(rapidjson::Document& results) { diff --git a/benchmark/utils/generator.hpp b/benchmark/utils/generator.hpp index f55c51fbf56..076d2954980 100644 --- a/benchmark/utils/generator.hpp +++ b/benchmark/utils/generator.hpp @@ -67,6 +67,20 @@ struct DefaultSystemGenerator { } } + static std::string describe_config(rapidjson::Value& config) + { + if (config.HasMember("filename")) { + return config["filename"].GetString(); + } else if (config.HasMember("stencil")) { + std::stringstream ss; + ss << "stencil(" << config["size"].GetInt64() << "," + << config["stencil"].GetString() << ")"; + return ss.str(); + } else { + throw std::runtime_error("No known way to describe config."); + } + } + static std::shared_ptr generate_matrix_with_optimal_format( std::shared_ptr exec, rapidjson::Value& config) { @@ -175,6 +189,21 @@ struct DistributedDefaultSystemGenerator { } } + std::string describe_config(rapidjson::Value& config) const + { + if (config.HasMember("filename")) { + return config["filename"].GetString(); + } else if (config.HasMember("stencil")) { + std::stringstream ss; + ss << "stencil(" << config["size"].GetInt64() << "," + << config["stencil"].GetString() << "," + << config["comm_pattern"].GetString() << ")"; + return ss.str(); + } else { + throw std::runtime_error("No known way to describe config."); + } + } + std::shared_ptr generate_matrix_with_optimal_format( std::shared_ptr exec, rapidjson::Value& config) const { diff --git a/core/log/profiler_hook.cpp b/core/log/profiler_hook.cpp index 8149045af33..468f8aa83d3 100644 --- a/core/log/profiler_hook.cpp +++ b/core/log/profiler_hook.cpp @@ -438,6 +438,11 @@ std::shared_ptr ProfilerHook::create_custom(hook_function begin, } +profiling_scope_guard::profiling_scope_guard() + : empty_{true}, name_{}, category_{profile_event_category::internal} +{} + + /** * Scope guard that annotates its scope with the provided profiler hooks. */ @@ -461,8 +466,7 @@ profiling_scope_guard::profiling_scope_guard(profiling_scope_guard&& other) : empty_{std::exchange(other.empty_, true)}, name_{std::exchange(other.name_, nullptr)}, category_{other.category_}, - end_{ - std::exchange(other.end_, [](const char*, profile_event_category) {})} + end_{std::move(other.end_)} {} diff --git a/core/test/solver/gcr.cpp b/core/test/solver/gcr.cpp index 31a3d0a951c..f7ba80ebba1 100644 --- a/core/test/solver/gcr.cpp +++ b/core/test/solver/gcr.cpp @@ -151,7 +151,7 @@ TYPED_TEST(Gcr, CanBeMoved) using Solver = typename TestFixture::Solver; auto copy = this->gcr_factory->generate(Mtx::create(this->exec)); - copy->copy_from(std::move(this->solver)); + copy->move_from(this->solver); ASSERT_EQ(copy->get_size(), gko::dim<2>(3, 3)); auto copy_mtx = static_cast(copy.get())->get_system_matrix(); diff --git a/include/ginkgo/core/log/profiler_hook.hpp b/include/ginkgo/core/log/profiler_hook.hpp index 9d4ff4aee7a..9a26acd6ab0 100644 --- a/include/ginkgo/core/log/profiler_hook.hpp +++ b/include/ginkgo/core/log/profiler_hook.hpp @@ -427,6 +427,9 @@ class ProfilerHook : public Logger { */ class profiling_scope_guard { public: + /** Creates an empty (moved-from) scope guard. */ + profiling_scope_guard(); + /** * Creates the scope guard *