Skip to content
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

[test] compression benchmarks #17145

Draft
wants to merge 15 commits into
base: branch-24.12
Choose a base branch
from
72 changes: 36 additions & 36 deletions cpp/benchmarks/io/parquet/parquet_reader_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ void parquet_read_common(cudf::size_type num_rows_to_read,
state.exec(
nvbench::exec_tag::sync | nvbench::exec_tag::timer, [&](nvbench::launch& launch, auto& timer) {
try_drop_l3_cache();

timer.start();
auto const result = cudf::io::read_parquet(read_opts);
timer.stop();

setenv("LOG_COMP", "1", 1);
cudf::io::read_parquet(read_opts);
setenv("LOG_COMP", "0", 1);

CUDF_EXPECTS(result.tbl->num_columns() == num_cols_to_read, "Unexpected number of columns");
CUDF_EXPECTS(result.tbl->num_rows() == num_rows_to_read, "Unexpected number of rows");
});
Expand All @@ -66,7 +69,6 @@ void BM_parquet_read_data_common(nvbench::state& state,
{
auto const d_type = get_type_or_group(static_cast<int32_t>(DataType));
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
auto const compression = cudf::io::compression_type::SNAPPY;
cuio_source_sink_pair source_sink(source_type);

auto const num_rows_written = [&]() {
Expand All @@ -75,8 +77,7 @@ void BM_parquet_read_data_common(nvbench::state& state,
auto const view = tbl->view();

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(compression);
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);
cudf::io::write_parquet(write_opts);
return view.num_rows();
}();
Expand Down Expand Up @@ -125,7 +126,6 @@ void BM_parquet_read_io_compression(nvbench::state& state)
auto const cardinality = static_cast<cudf::size_type>(state.get_int64("cardinality"));
auto const run_length = static_cast<cudf::size_type>(state.get_int64("run_length"));
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
auto const compression = retrieve_compression_type_enum(state.get_string("compression_type"));
cuio_source_sink_pair source_sink(source_type);

auto const num_rows_written = [&]() {
Expand All @@ -136,8 +136,7 @@ void BM_parquet_read_io_compression(nvbench::state& state)
auto const view = tbl->view();

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(compression);
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);
cudf::io::write_parquet(write_opts);
return view.num_rows();
}();
Expand Down Expand Up @@ -170,8 +169,7 @@ void BM_parquet_read_io_small_mixed(nvbench::state& state)

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.max_page_size_rows(10'000)
.compression(cudf::io::compression_type::NONE);
.max_page_size_rows(10'000);
cudf::io::write_parquet(write_opts);
}

Expand All @@ -186,7 +184,6 @@ void BM_parquet_read_chunks(nvbench::state& state, nvbench::type_list<nvbench::e
auto const run_length = static_cast<cudf::size_type>(state.get_int64("run_length"));
auto const byte_limit = static_cast<cudf::size_type>(state.get_int64("byte_limit"));
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
auto const compression = cudf::io::compression_type::SNAPPY;
cuio_source_sink_pair source_sink(source_type);

auto const num_rows_written = [&]() {
Expand All @@ -197,8 +194,7 @@ void BM_parquet_read_chunks(nvbench::state& state, nvbench::type_list<nvbench::e
auto const view = tbl->view();

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(compression);
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);

cudf::io::write_parquet(write_opts);
return view.num_rows();
Expand All @@ -223,6 +219,12 @@ void BM_parquet_read_chunks(nvbench::state& state, nvbench::type_list<nvbench::e
} while (reader.has_next());
timer.stop();

setenv("LOG_COMP", "1", 1);
do {
auto const _ = reader.read_chunk();
} while (reader.has_next());
setenv("LOG_COMP", "0", 1);

CUDF_EXPECTS(num_rows_read == num_rows_written, "Benchmark did not read the entire table");
});

Expand All @@ -243,7 +245,7 @@ void BM_parquet_read_wide_tables(nvbench::state& state,
auto const data_size_bytes = static_cast<size_t>(state.get_int64("data_size_mb") << 20);
auto const cardinality = static_cast<cudf::size_type>(state.get_int64("cardinality"));
auto const run_length = static_cast<cudf::size_type>(state.get_int64("run_length"));
auto const source_type = io_type::DEVICE_BUFFER;
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
cuio_source_sink_pair source_sink(source_type);

auto const num_rows_written = [&]() {
Expand All @@ -254,8 +256,7 @@ void BM_parquet_read_wide_tables(nvbench::state& state,
auto const view = tbl->view();

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(cudf::io::compression_type::NONE);
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);
cudf::io::write_parquet(write_opts);
return view.num_rows();
}();
Expand All @@ -277,7 +278,7 @@ void BM_parquet_read_wide_tables_mixed(nvbench::state& state)
auto const data_size_bytes = static_cast<size_t>(state.get_int64("data_size_mb") << 20);
auto const cardinality = static_cast<cudf::size_type>(state.get_int64("cardinality"));
auto const run_length = static_cast<cudf::size_type>(state.get_int64("run_length"));
auto const source_type = io_type::DEVICE_BUFFER;
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
cuio_source_sink_pair source_sink(source_type);

auto const num_rows_written = [&]() {
Expand All @@ -288,8 +289,7 @@ void BM_parquet_read_wide_tables_mixed(nvbench::state& state)
auto const view = tbl->view();

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(cudf::io::compression_type::NONE);
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);
cudf::io::write_parquet(write_opts);
return view.num_rows();
}();
Expand All @@ -299,7 +299,6 @@ void BM_parquet_read_wide_tables_mixed(nvbench::state& state)

using d_type_list = nvbench::enum_type_list<data_type::INTEGRAL,
data_type::FLOAT,
data_type::BOOL8,
data_type::DECIMAL,
data_type::TIMESTAMP,
data_type::DURATION,
Expand All @@ -312,50 +311,51 @@ NVBENCH_BENCH_TYPES(BM_parquet_read_data, NVBENCH_TYPE_AXES(d_type_list))
.set_type_axes_names({"data_type"})
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32});
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16});

NVBENCH_BENCH(BM_parquet_read_io_compression)
.set_name("parquet_read_io_compression")
.add_string_axis("io_type", {"FILEPATH", "HOST_BUFFER", "DEVICE_BUFFER"})
.add_string_axis("compression_type", {"SNAPPY", "NONE"})
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32});
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16});

NVBENCH_BENCH_TYPES(BM_parquet_read_chunks, NVBENCH_TYPE_AXES(d_type_list))
.set_name("parquet_read_chunks")
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32})
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16})
.add_int64_axis("byte_limit", {0, 500'000});

NVBENCH_BENCH(BM_parquet_read_io_small_mixed)
.set_name("parquet_read_io_small_mixed")
.add_string_axis("io_type", {"FILEPATH"})
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32})
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16})
.add_int64_axis("num_string_cols", {1, 2, 3});

using d_type_list_wide_table = nvbench::enum_type_list<data_type::DECIMAL, data_type::STRING>;
NVBENCH_BENCH_TYPES(BM_parquet_read_wide_tables, NVBENCH_TYPE_AXES(d_type_list_wide_table))
.set_name("parquet_read_wide_tables")
.set_min_samples(4)
.set_type_axes_names({"data_type"})
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.add_int64_axis("data_size_mb", {1024, 2048, 4096})
.add_int64_axis("num_cols", {256, 512, 1024})
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32});
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16});

NVBENCH_BENCH(BM_parquet_read_wide_tables_mixed)
.set_name("parquet_read_wide_tables_mixed")
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("data_size_mb", {1024, 2048, 4096})
.add_int64_axis("num_cols", {256, 512, 1024})
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32});
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16});

// a benchmark for structs that only contain fixed-width types
using d_type_list_struct_only = nvbench::enum_type_list<data_type::STRUCT>;
Expand All @@ -364,5 +364,5 @@ NVBENCH_BENCH_TYPES(BM_parquet_read_fixed_width_struct, NVBENCH_TYPE_AXES(d_type
.set_type_axes_names({"data_type"})
.add_string_axis("io_type", {"DEVICE_BUFFER"})
.set_min_samples(4)
.add_int64_axis("cardinality", {0, 1000})
.add_int64_axis("run_length", {1, 32});
.add_int64_axis("cardinality", {0, 2000})
.add_int64_axis("run_length", {1, 16});
17 changes: 8 additions & 9 deletions cpp/benchmarks/io/parquet/parquet_reader_multithread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ std::tuple<std::vector<cuio_source_sink_pair>, size_t, size_t> write_file_data(

cudf::io::parquet_writer_options write_opts =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.compression(cudf::io::compression_type::SNAPPY)
.max_page_size_rows(50000)
.max_page_size_bytes(1024 * 1024);

Expand Down Expand Up @@ -281,7 +280,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_mixed)
.add_int64_axis("num_iterations", {1})
.add_int64_axis("num_cols", {4})
.add_int64_axis("run_length", {8})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_fixed_width)
.set_name("parquet_multithreaded_read_decode_fixed_width")
Expand All @@ -292,7 +291,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_fixed_width)
.add_int64_axis("num_iterations", {1})
.add_int64_axis("num_cols", {4})
.add_int64_axis("run_length", {8})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_string)
.set_name("parquet_multithreaded_read_decode_string")
Expand All @@ -303,7 +302,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_string)
.add_int64_axis("num_iterations", {1})
.add_int64_axis("num_cols", {4})
.add_int64_axis("run_length", {8})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_list)
.set_name("parquet_multithreaded_read_decode_list")
Expand All @@ -314,7 +313,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_list)
.add_int64_axis("num_iterations", {1})
.add_int64_axis("num_cols", {4})
.add_int64_axis("run_length", {8})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

// mixed data types: fixed width, strings
NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_mixed)
Expand All @@ -328,7 +327,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_mixed)
.add_int64_axis("run_length", {8})
.add_int64_axis("input_limit", {640 * 1024 * 1024})
.add_int64_axis("output_limit", {640 * 1024 * 1024})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_fixed_width)
.set_name("parquet_multithreaded_read_decode_chunked_fixed_width")
Expand All @@ -341,7 +340,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_fixed_width)
.add_int64_axis("run_length", {8})
.add_int64_axis("input_limit", {640 * 1024 * 1024})
.add_int64_axis("output_limit", {640 * 1024 * 1024})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_string)
.set_name("parquet_multithreaded_read_decode_chunked_string")
Expand All @@ -354,7 +353,7 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_string)
.add_int64_axis("run_length", {8})
.add_int64_axis("input_limit", {640 * 1024 * 1024})
.add_int64_axis("output_limit", {640 * 1024 * 1024})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});

NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_list)
.set_name("parquet_multithreaded_read_decode_chunked_list")
Expand All @@ -367,4 +366,4 @@ NVBENCH_BENCH(BM_parquet_multithreaded_read_chunked_list)
.add_int64_axis("run_length", {8})
.add_int64_axis("input_limit", {640 * 1024 * 1024})
.add_int64_axis("output_limit", {640 * 1024 * 1024})
.add_string_axis("io_type", {"PINNED_BUFFER"});
.add_string_axis("io_type", {"DEVICE_BUFFER"});
52 changes: 2 additions & 50 deletions cpp/benchmarks/io/parquet/parquet_reader_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void BM_parquet_read_options(nvbench::state& state,
auto const tbl = create_random_table(data_types, table_size_bytes{data_size});
auto const view = tbl->view();

cuio_source_sink_pair source_sink(io_type::HOST_BUFFER);
auto const source_type = retrieve_io_type_enum(state.get_string("io_type"));
cuio_source_sink_pair source_sink(source_type);
cudf::io::parquet_writer_options options =
cudf::io::parquet_writer_options::builder(source_sink.make_sink_info(), view);
cudf::io::write_parquet(options);
Expand Down Expand Up @@ -133,52 +134,3 @@ void BM_parquet_read_options(nvbench::state& state,
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
state.add_buffer_size(source_sink.size(), "encoded_file_size", "encoded_file_size");
}

using row_selections =
nvbench::enum_type_list<row_selection::ALL, row_selection::NROWS, row_selection::ROW_GROUPS>;
NVBENCH_BENCH_TYPES(BM_parquet_read_options,
NVBENCH_TYPE_AXES(nvbench::enum_type_list<column_selection::ALL>,
row_selections,
nvbench::enum_type_list<converts_strings::YES>,
nvbench::enum_type_list<uses_pandas_metadata::YES>,
nvbench::enum_type_list<cudf::type_id::EMPTY>))
.set_name("parquet_read_row_selection")
.set_type_axes_names({"column_selection",
"row_selection",
"str_to_categories",
"uses_pandas_metadata",
"timestamp_type"})
.set_min_samples(4);

using col_selections = nvbench::enum_type_list<column_selection::ALL,
column_selection::ALTERNATE,
column_selection::FIRST_HALF,
column_selection::SECOND_HALF>;
NVBENCH_BENCH_TYPES(BM_parquet_read_options,
NVBENCH_TYPE_AXES(col_selections,
nvbench::enum_type_list<row_selection::ALL>,
nvbench::enum_type_list<converts_strings::YES>,
nvbench::enum_type_list<uses_pandas_metadata::YES>,
nvbench::enum_type_list<cudf::type_id::EMPTY>))
.set_name("parquet_read_column_selection")
.set_type_axes_names({"column_selection",
"row_selection",
"str_to_categories",
"uses_pandas_metadata",
"timestamp_type"})
.set_min_samples(4);

NVBENCH_BENCH_TYPES(
BM_parquet_read_options,
NVBENCH_TYPE_AXES(nvbench::enum_type_list<column_selection::ALL>,
nvbench::enum_type_list<row_selection::ALL>,
nvbench::enum_type_list<converts_strings::YES, converts_strings::NO>,
nvbench::enum_type_list<uses_pandas_metadata::YES, uses_pandas_metadata::NO>,
nvbench::enum_type_list<cudf::type_id::EMPTY>))
.set_name("parquet_read_misc_options")
.set_type_axes_names({"column_selection",
"row_selection",
"str_to_categories",
"uses_pandas_metadata",
"timestamp_type"})
.set_min_samples(4);
Loading
Loading