From 85e4b546a965a3d5fc550fe8a9a12b7031af4926 Mon Sep 17 00:00:00 2001 From: JayjeetAtGithub Date: Mon, 26 Aug 2024 16:08:00 -0700 Subject: [PATCH] Move tpch examples into benchmarks --- cpp/benchmarks/CMakeLists.txt | 12 +++++++ cpp/{examples => benchmarks}/tpch/README.md | 0 .../tpch/datagen/correct_datatypes.py | 0 .../tpch/datagen/datagen.sh | 0 .../tpch/datagen/tpch.patch | 0 cpp/{examples => benchmarks}/tpch/q1.cpp | 5 --- cpp/{examples => benchmarks}/tpch/q10.cpp | 5 --- cpp/{examples => benchmarks}/tpch/q5.cpp | 5 --- cpp/{examples => benchmarks}/tpch/q6.cpp | 5 --- cpp/{examples => benchmarks}/tpch/q9.cpp | 5 --- cpp/{examples => benchmarks}/tpch/utils.hpp | 2 +- cpp/examples/build.sh | 1 - cpp/examples/tpch/CMakeLists.txt | 36 ------------------- 13 files changed, 13 insertions(+), 63 deletions(-) rename cpp/{examples => benchmarks}/tpch/README.md (100%) rename cpp/{examples => benchmarks}/tpch/datagen/correct_datatypes.py (100%) rename cpp/{examples => benchmarks}/tpch/datagen/datagen.sh (100%) rename cpp/{examples => benchmarks}/tpch/datagen/tpch.patch (100%) rename cpp/{examples => benchmarks}/tpch/q1.cpp (98%) rename cpp/{examples => benchmarks}/tpch/q10.cpp (98%) rename cpp/{examples => benchmarks}/tpch/q5.cpp (98%) rename cpp/{examples => benchmarks}/tpch/q6.cpp (98%) rename cpp/{examples => benchmarks}/tpch/q9.cpp (98%) rename cpp/{examples => benchmarks}/tpch/utils.hpp (99%) delete mode 100644 cpp/examples/tpch/CMakeLists.txt diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index d2c22b788cb..c5713489ece 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -175,6 +175,18 @@ ConfigureBench(COPY_IF_ELSE_BENCH copying/copy_if_else.cpp) # * transpose benchmark --------------------------------------------------------------------------- ConfigureBench(TRANSPOSE_BENCH transpose/transpose.cpp) +# ################################################################################################## +# * apply_boolean_mask benchmark ------------------------------------------------------------------ +ConfigureBench(APPLY_BOOLEAN_MASK_BENCH stream_compaction/apply_boolean_mask.cpp) + +# ################################################################################################## +# * tpch benchmark -------------------------------------------------------------------------------- +ConfigureBench(TPCH_Q1 tpch/q1.cpp) +ConfigureBench(TPCH_Q5 tpch/q5.cpp) +ConfigureBench(TPCH_Q6 tpch/q6.cpp) +ConfigureBench(TPCH_Q9 tpch/q9.cpp) +ConfigureBench(TPCH_Q10 tpch/q10.cpp) + # ################################################################################################## # * stream_compaction benchmark ------------------------------------------------------------------- ConfigureNVBench( diff --git a/cpp/examples/tpch/README.md b/cpp/benchmarks/tpch/README.md similarity index 100% rename from cpp/examples/tpch/README.md rename to cpp/benchmarks/tpch/README.md diff --git a/cpp/examples/tpch/datagen/correct_datatypes.py b/cpp/benchmarks/tpch/datagen/correct_datatypes.py similarity index 100% rename from cpp/examples/tpch/datagen/correct_datatypes.py rename to cpp/benchmarks/tpch/datagen/correct_datatypes.py diff --git a/cpp/examples/tpch/datagen/datagen.sh b/cpp/benchmarks/tpch/datagen/datagen.sh similarity index 100% rename from cpp/examples/tpch/datagen/datagen.sh rename to cpp/benchmarks/tpch/datagen/datagen.sh diff --git a/cpp/examples/tpch/datagen/tpch.patch b/cpp/benchmarks/tpch/datagen/tpch.patch similarity index 100% rename from cpp/examples/tpch/datagen/tpch.patch rename to cpp/benchmarks/tpch/datagen/tpch.patch diff --git a/cpp/examples/tpch/q1.cpp b/cpp/benchmarks/tpch/q1.cpp similarity index 98% rename from cpp/examples/tpch/q1.cpp rename to cpp/benchmarks/tpch/q1.cpp index fe03320b888..a6bedf9e4e6 100644 --- a/cpp/examples/tpch/q1.cpp +++ b/cpp/benchmarks/tpch/q1.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "../utilities/timer.hpp" #include "utils.hpp" #include @@ -108,8 +107,6 @@ int main(int argc, char const** argv) auto resource = create_memory_resource(args.memory_resource_type); rmm::mr::set_current_device_resource(resource.get()); - cudf::examples::timer timer; - // Define the column projections and filter predicate for `lineitem` table std::vector const lineitem_cols = {"l_returnflag", "l_linestatus", @@ -166,8 +163,6 @@ int main(int argc, char const** argv) {"l_returnflag", "l_linestatus"}, {cudf::order::ASCENDING, cudf::order::ASCENDING}); - timer.print_elapsed_millis(); - // Write query result to a parquet file orderedby_table->to_parquet("q1.parquet"); return 0; diff --git a/cpp/examples/tpch/q10.cpp b/cpp/benchmarks/tpch/q10.cpp similarity index 98% rename from cpp/examples/tpch/q10.cpp rename to cpp/benchmarks/tpch/q10.cpp index 94da46f6930..3452df524d3 100644 --- a/cpp/examples/tpch/q10.cpp +++ b/cpp/benchmarks/tpch/q10.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "../utilities/timer.hpp" #include "utils.hpp" #include @@ -97,8 +96,6 @@ int main(int argc, char const** argv) auto resource = create_memory_resource(args.memory_resource_type); rmm::mr::set_current_device_resource(resource.get()); - cudf::examples::timer timer; - // Define the column projection and filter predicate for the `orders` table std::vector const orders_cols = {"o_custkey", "o_orderkey", "o_orderdate"}; auto const o_orderdate_ref = cudf::ast::column_reference(std::distance( @@ -158,8 +155,6 @@ int main(int argc, char const** argv) auto const orderedby_table = apply_orderby(groupedby_table, {"revenue"}, {cudf::order::DESCENDING}); - timer.print_elapsed_millis(); - // Write query result to a parquet file orderedby_table->to_parquet("q10.parquet"); return 0; diff --git a/cpp/examples/tpch/q5.cpp b/cpp/benchmarks/tpch/q5.cpp similarity index 98% rename from cpp/examples/tpch/q5.cpp rename to cpp/benchmarks/tpch/q5.cpp index 89396a6c968..cc3fccbf18b 100644 --- a/cpp/examples/tpch/q5.cpp +++ b/cpp/benchmarks/tpch/q5.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "../utilities/timer.hpp" #include "utils.hpp" #include @@ -93,8 +92,6 @@ int main(int argc, char const** argv) auto resource = create_memory_resource(args.memory_resource_type); rmm::mr::set_current_device_resource(resource.get()); - cudf::examples::timer timer; - // Define the column projection and filter predicate for the `orders` table std::vector const orders_cols = {"o_custkey", "o_orderkey", "o_orderdate"}; auto const o_orderdate_ref = cudf::ast::column_reference(std::distance( @@ -161,8 +158,6 @@ int main(int argc, char const** argv) auto const orderedby_table = apply_orderby(groupedby_table, {"revenue"}, {cudf::order::DESCENDING}); - timer.print_elapsed_millis(); - // Write query result to a parquet file orderedby_table->to_parquet("q5.parquet"); return 0; diff --git a/cpp/examples/tpch/q6.cpp b/cpp/benchmarks/tpch/q6.cpp similarity index 98% rename from cpp/examples/tpch/q6.cpp rename to cpp/benchmarks/tpch/q6.cpp index 405b2ac73ca..8b288bcc030 100644 --- a/cpp/examples/tpch/q6.cpp +++ b/cpp/benchmarks/tpch/q6.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "../utilities/timer.hpp" #include "utils.hpp" #include @@ -67,8 +66,6 @@ int main(int argc, char const** argv) auto resource = create_memory_resource(args.memory_resource_type); rmm::mr::set_current_device_resource(resource.get()); - cudf::examples::timer timer; - // Read out the `lineitem` table from parquet file std::vector const lineitem_cols = { "l_extendedprice", "l_discount", "l_shipdate", "l_quantity"}; @@ -129,8 +126,6 @@ int main(int argc, char const** argv) auto const revenue_view = revenue->view(); auto const result_table = apply_reduction(revenue_view, cudf::aggregation::Kind::SUM, "revenue"); - timer.print_elapsed_millis(); - // Write query result to a parquet file result_table->to_parquet("q6.parquet"); return 0; diff --git a/cpp/examples/tpch/q9.cpp b/cpp/benchmarks/tpch/q9.cpp similarity index 98% rename from cpp/examples/tpch/q9.cpp rename to cpp/benchmarks/tpch/q9.cpp index d3c218253f9..980870d249a 100644 --- a/cpp/examples/tpch/q9.cpp +++ b/cpp/benchmarks/tpch/q9.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "../utilities/timer.hpp" #include "utils.hpp" #include @@ -116,8 +115,6 @@ int main(int argc, char const** argv) auto resource = create_memory_resource(args.memory_resource_type); rmm::mr::set_current_device_resource(resource.get()); - cudf::examples::timer timer; - // Read out the table from parquet files auto const lineitem = read_parquet( args.dataset_dir + "/lineitem.parquet", @@ -174,8 +171,6 @@ int main(int argc, char const** argv) auto const orderedby_table = apply_orderby( groupedby_table, {"nation", "o_year"}, {cudf::order::ASCENDING, cudf::order::DESCENDING}); - timer.print_elapsed_millis(); - // Write query result to a parquet file orderedby_table->to_parquet("q9.parquet"); return 0; diff --git a/cpp/examples/tpch/utils.hpp b/cpp/benchmarks/tpch/utils.hpp similarity index 99% rename from cpp/examples/tpch/utils.hpp rename to cpp/benchmarks/tpch/utils.hpp index e586da2c802..e0c364b95b4 100644 --- a/cpp/examples/tpch/utils.hpp +++ b/cpp/benchmarks/tpch/utils.hpp @@ -312,7 +312,7 @@ struct groupby_context_t { } auto agg_results = groupby_obj.aggregate(requests); std::vector> result_columns; - for (size_t i = 0; i < agg_results.first->num_columns(); i++) { + for (auto i = 0; i < agg_results.first->num_columns(); i++) { auto col = std::make_unique(agg_results.first->get_column(i)); result_columns.push_back(std::move(col)); } diff --git a/cpp/examples/build.sh b/cpp/examples/build.sh index 2d6f6f316c7..e44230e381f 100755 --- a/cpp/examples/build.sh +++ b/cpp/examples/build.sh @@ -57,7 +57,6 @@ build_example() { } build_example basic -build_example tpch build_example strings build_example nested_types build_example parquet_io diff --git a/cpp/examples/tpch/CMakeLists.txt b/cpp/examples/tpch/CMakeLists.txt deleted file mode 100644 index 373a6d72d56..00000000000 --- a/cpp/examples/tpch/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. - -cmake_minimum_required(VERSION 3.26.4) - -include(../set_cuda_architecture.cmake) - -rapids_cuda_init_architectures(tpch_example) -rapids_cuda_set_architectures(RAPIDS) - -project( - tpch_example - VERSION 0.0.1 - LANGUAGES CXX CUDA -) - -include(../fetch_dependencies.cmake) - -add_executable(tpch_q1 q1.cpp) -target_link_libraries(tpch_q1 PRIVATE cudf::cudf) -target_compile_features(tpch_q1 PRIVATE cxx_std_17) - -add_executable(tpch_q5 q5.cpp) -target_link_libraries(tpch_q5 PRIVATE cudf::cudf) -target_compile_features(tpch_q5 PRIVATE cxx_std_17) - -add_executable(tpch_q6 q6.cpp) -target_link_libraries(tpch_q6 PRIVATE cudf::cudf) -target_compile_features(tpch_q6 PRIVATE cxx_std_17) - -add_executable(tpch_q9 q9.cpp) -target_link_libraries(tpch_q9 PRIVATE cudf::cudf) -target_compile_features(tpch_q9 PRIVATE cxx_std_17) - -add_executable(tpch_q10 q10.cpp) -target_link_libraries(tpch_q10 PRIVATE cudf::cudf) -target_compile_features(tpch_q10 PRIVATE cxx_std_17)