-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'branch-22.06' of https://github.com/rapidsai/cudf into …
…bug-pq-metadata-array
- Loading branch information
Showing
102 changed files
with
3,766 additions
and
2,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (c) 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <benchmarks/common/generate_input.hpp> | ||
#include <benchmarks/fixture/benchmark_fixture.hpp> | ||
#include <benchmarks/io/cuio_common.hpp> | ||
#include <benchmarks/synchronization/synchronization.hpp> | ||
|
||
#include <nvbench/nvbench.cuh> | ||
|
||
#include <cudf/column/column.hpp> | ||
#include <cudf/io/orc.hpp> | ||
#include <cudf/table/table.hpp> | ||
|
||
// to enable, run cmake with -DBUILD_BENCHMARKS=ON | ||
|
||
constexpr int64_t data_size = 512 << 20; | ||
|
||
namespace cudf_io = cudf::io; | ||
|
||
void nvbench_orc_write(nvbench::state& state) | ||
{ | ||
cudf::size_type num_cols = state.get_int64("num_columns"); | ||
|
||
auto tbl = | ||
create_random_table(cycle_dtypes(get_type_or_group({int32_t(type_group_id::INTEGRAL_SIGNED), | ||
int32_t(type_group_id::FLOATING_POINT), | ||
int32_t(type_group_id::FIXED_POINT), | ||
int32_t(type_group_id::TIMESTAMP), | ||
int32_t(cudf::type_id::STRING), | ||
int32_t(cudf::type_id::STRUCT), | ||
int32_t(cudf::type_id::LIST)}), | ||
num_cols), | ||
table_size_bytes{data_size}); | ||
cudf::table_view view = tbl->view(); | ||
|
||
auto mem_stats_logger = cudf::memory_stats_logger(); | ||
|
||
state.add_global_memory_reads<int64_t>(data_size); | ||
state.add_element_count(view.num_columns() * view.num_rows()); | ||
|
||
size_t encoded_file_size = 0; | ||
|
||
state.exec(nvbench::exec_tag::timer | nvbench::exec_tag::sync, | ||
[&](nvbench::launch& launch, auto& timer) { | ||
cuio_source_sink_pair source_sink(io_type::VOID); | ||
timer.start(); | ||
|
||
cudf_io::orc_writer_options opts = | ||
cudf_io::orc_writer_options::builder(source_sink.make_sink_info(), view); | ||
cudf_io::write_orc(opts); | ||
|
||
timer.stop(); | ||
encoded_file_size = source_sink.size(); | ||
}); | ||
|
||
state.add_buffer_size(mem_stats_logger.peak_memory_usage(), "pmu", "Peak Memory Usage"); | ||
state.add_buffer_size(encoded_file_size, "efs", "Encoded File Size"); | ||
state.add_buffer_size(view.num_rows(), "trc", "Total Rows"); | ||
} | ||
|
||
void nvbench_orc_chunked_write(nvbench::state& state) | ||
{ | ||
cudf::size_type num_cols = state.get_int64("num_columns"); | ||
cudf::size_type num_tables = state.get_int64("num_chunks"); | ||
|
||
std::vector<std::unique_ptr<cudf::table>> tables; | ||
for (cudf::size_type idx = 0; idx < num_tables; idx++) { | ||
tables.push_back( | ||
create_random_table(cycle_dtypes(get_type_or_group({int32_t(type_group_id::INTEGRAL_SIGNED), | ||
int32_t(type_group_id::FLOATING_POINT), | ||
int32_t(type_group_id::FIXED_POINT), | ||
int32_t(type_group_id::TIMESTAMP), | ||
int32_t(cudf::type_id::STRING), | ||
int32_t(cudf::type_id::STRUCT), | ||
int32_t(cudf::type_id::LIST)}), | ||
num_cols), | ||
table_size_bytes{size_t(data_size / num_tables)})); | ||
} | ||
|
||
auto mem_stats_logger = cudf::memory_stats_logger(); | ||
|
||
auto size_iter = thrust::make_transform_iterator( | ||
tables.begin(), [](auto const& i) { return i->num_columns() * i->num_rows(); }); | ||
auto row_count_iter = | ||
thrust::make_transform_iterator(tables.begin(), [](auto const& i) { return i->num_rows(); }); | ||
auto total_elements = std::accumulate(size_iter, size_iter + num_tables, 0); | ||
auto total_rows = std::accumulate(row_count_iter, row_count_iter + num_tables, 0); | ||
|
||
state.add_global_memory_reads<int64_t>(data_size); | ||
state.add_element_count(total_elements); | ||
|
||
size_t encoded_file_size = 0; | ||
|
||
state.exec( | ||
nvbench::exec_tag::timer | nvbench::exec_tag::sync, [&](nvbench::launch& launch, auto& timer) { | ||
cuio_source_sink_pair source_sink(io_type::VOID); | ||
timer.start(); | ||
|
||
cudf_io::chunked_orc_writer_options opts = | ||
cudf_io::chunked_orc_writer_options::builder(source_sink.make_sink_info()); | ||
cudf_io::orc_chunked_writer writer(opts); | ||
std::for_each(tables.begin(), | ||
tables.end(), | ||
[&writer](std::unique_ptr<cudf::table> const& tbl) { writer.write(*tbl); }); | ||
writer.close(); | ||
|
||
timer.stop(); | ||
encoded_file_size = source_sink.size(); | ||
}); | ||
|
||
state.add_buffer_size(mem_stats_logger.peak_memory_usage(), "pmu", "Peak Memory Usage"); | ||
state.add_buffer_size(encoded_file_size, "efs", "Encoded File Size"); | ||
state.add_buffer_size(total_rows, "trc", "Total Rows"); | ||
} | ||
|
||
NVBENCH_BENCH(nvbench_orc_write) | ||
.set_name("orc_write") | ||
.set_min_samples(4) | ||
.add_int64_axis("num_columns", {8, 64}); | ||
|
||
NVBENCH_BENCH(nvbench_orc_chunked_write) | ||
.set_name("orc_chunked_write") | ||
.set_min_samples(4) | ||
.add_int64_axis("num_columns", {8, 64}) | ||
.add_int64_axis("num_chunks", {8, 64}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include <cudf/column/column.hpp> | ||
#include <cudf/lists/lists_column_view.hpp> | ||
|
||
#include <rmm/mr/device/device_memory_resource.hpp> | ||
|
||
namespace cudf::lists::detail { | ||
|
||
/** | ||
* @copydoc cudf::lists::apply_boolean_mask(lists_column_view const&, lists_column_view const&, | ||
* rmm::mr::device_memory_resource*) | ||
* | ||
* @param stream CUDA stream used for device memory operations and kernel launches | ||
*/ | ||
std::unique_ptr<column> apply_boolean_mask( | ||
lists_column_view const& input, | ||
lists_column_view const& boolean_mask, | ||
rmm::cuda_stream_view stream, | ||
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); | ||
|
||
} // namespace cudf::lists::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include <cudf/column/column.hpp> | ||
#include <cudf/lists/lists_column_view.hpp> | ||
|
||
#include <rmm/mr/device/device_memory_resource.hpp> | ||
|
||
namespace cudf::lists { | ||
|
||
/** | ||
* @brief Filters elements in each row of `input` LIST column using `boolean_mask` | ||
* LIST of booleans as a mask. | ||
* | ||
* Given an input `LIST` column and a list-of-bools column, the function produces | ||
* a new `LIST` column of the same type as `input`, where each element is copied | ||
* from the input row *only* if the corresponding `boolean_mask` is non-null and `true`. | ||
* | ||
* E.g. | ||
* @code{.pseudo} | ||
* input = { {0,1,2}, {3,4}, {5,6,7}, {8,9} }; | ||
* boolean_mask = { {0,1,1}, {1,0}, {1,1,1}, {0,0} }; | ||
* results = { {1,2}, {3}, {5,6,7}, {} }; | ||
* @endcode | ||
* | ||
* `input` and `boolean_mask` must have the same number of rows. | ||
* The output column has the same number of rows as the input column. | ||
* An element is copied to an output row *only* if the corresponding boolean_mask element is `true`. | ||
* An output row is invalid only if the input row is invalid. | ||
* | ||
* @throws cudf::logic_error if `boolean_mask` is not a "lists of bools" column | ||
* @throws cudf::logic_error if `input` and `boolean_mask` have different number of rows | ||
* | ||
* @param input The input list column view to be filtered | ||
* @param boolean_mask A nullable list of bools column used to filter `input` elements | ||
* @param mr Device memory resource used to allocate the returned table's device memory | ||
* @return List column of the same type as `input`, containing filtered list rows | ||
*/ | ||
std::unique_ptr<column> apply_boolean_mask( | ||
lists_column_view const& input, | ||
lists_column_view const& boolean_mask, | ||
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); | ||
|
||
} // namespace cudf::lists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.