From bbb32820a17b764ddf4c3679d5cbbb83c05d04a7 Mon Sep 17 00:00:00 2001 From: davidwendt Date: Thu, 10 Feb 2022 11:12:29 -0500 Subject: [PATCH] Fix out-of-memory error in compiled-binaryop benchmark --- cpp/benchmarks/binaryop/compiled_binaryop.cpp | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/cpp/benchmarks/binaryop/compiled_binaryop.cpp b/cpp/benchmarks/binaryop/compiled_binaryop.cpp index 745d4e354e7..f8226c7387a 100644 --- a/cpp/benchmarks/binaryop/compiled_binaryop.cpp +++ b/cpp/benchmarks/binaryop/compiled_binaryop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,8 @@ class COMPILED_BINARYOP : public cudf::benchmark { }; -template -void BM_compiled_binaryop(benchmark::State& state) +template +void BM_compiled_binaryop(benchmark::State& state, cudf::binary_operator binop) { const cudf::size_type column_size{(cudf::size_type)state.range(0)}; @@ -50,21 +50,26 @@ void BM_compiled_binaryop(benchmark::State& state) } // TODO tparam boolean for null. -#define BINARYOP_BENCHMARK_DEFINE(TypeLhs, TypeRhs, binop, TypeOut) \ - TEMPLATED_BENCHMARK_F(COMPILED_BINARYOP, \ - BM_compiled_binaryop, \ - TypeLhs, \ - TypeRhs, \ - TypeOut, \ - cudf::binary_operator::binop) \ - ->Unit(benchmark::kMicrosecond) \ - ->UseManualTime() \ - ->Arg(10000) /* 10k */ \ - ->Arg(100000) /* 100k */ \ - ->Arg(1000000) /* 1M */ \ - ->Arg(10000000) /* 10M */ \ +#define BM_BINARYOP_BENCHMARK_DEFINE(name, lhs, rhs, bop, tout) \ + BENCHMARK_DEFINE_F(COMPILED_BINARYOP, name) \ + (::benchmark::State & st) \ + { \ + BM_compiled_binaryop(st, cudf::binary_operator::bop); \ + } \ + BENCHMARK_REGISTER_F(COMPILED_BINARYOP, name) \ + ->Unit(benchmark::kMicrosecond) \ + ->UseManualTime() \ + ->Arg(10000) /* 10k */ \ + ->Arg(100000) /* 100k */ \ + ->Arg(1000000) /* 1M */ \ + ->Arg(10000000) /* 10M */ \ ->Arg(100000000); /* 100M */ +#define build_name(a, b, c, d) a##_##b##_##c##_##d + +#define BINARYOP_BENCHMARK_DEFINE(lhs, rhs, bop, tout) \ + BM_BINARYOP_BENCHMARK_DEFINE(build_name(bop, lhs, rhs, tout), lhs, rhs, bop, tout) + using namespace cudf; using namespace numeric;