diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 15bcf207b1b..47b377013ce 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -75,7 +75,7 @@ dependencies: - pydata-sphinx-theme!=0.14.2 - pytest - pytest-benchmark -- pytest-cases<3.8.2 +- pytest-cases>=3.8.2 - pytest-cov - pytest-xdist - python-confluent-kafka>=1.9.0,<1.10.0a0 diff --git a/conda/environments/all_cuda-120_arch-x86_64.yaml b/conda/environments/all_cuda-120_arch-x86_64.yaml index ccad6a366fb..de59bc1d43c 100644 --- a/conda/environments/all_cuda-120_arch-x86_64.yaml +++ b/conda/environments/all_cuda-120_arch-x86_64.yaml @@ -72,7 +72,7 @@ dependencies: - pydata-sphinx-theme!=0.14.2 - pytest - pytest-benchmark -- pytest-cases<3.8.2 +- pytest-cases>=3.8.2 - pytest-cov - pytest-xdist - python-confluent-kafka>=1.9.0,<1.10.0a0 diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 9c3a05a2f5f..35b03fa33d0 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2018-2023, NVIDIA CORPORATION. +# Copyright (c) 2018-2024, 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 @@ -183,6 +183,11 @@ ConfigureNVBench( sort/sort_lists.cpp sort/sort_structs.cpp ) +# ################################################################################################## +# * structs benchmark +# -------------------------------------------------------------------------------- +ConfigureNVBench(STRUCT_CREATION_NVBENCH structs/create_structs.cpp) + # ################################################################################################## # * quantiles benchmark # -------------------------------------------------------------------------------- diff --git a/cpp/benchmarks/structs/create_structs.cpp b/cpp/benchmarks/structs/create_structs.cpp new file mode 100644 index 00000000000..480a719461e --- /dev/null +++ b/cpp/benchmarks/structs/create_structs.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024, 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 + +#include + +void nvbench_create_structs(nvbench::state& state) +{ + state.exec(nvbench::exec_tag::sync, + [&](nvbench::launch& launch) { auto const table_ptr = create_structs_data(state); }); +} + +NVBENCH_BENCH(nvbench_create_structs) + .set_name("create_structs") + .add_int64_power_of_two_axis("NumRows", {10, 18, 26}) + .add_int64_axis("Depth", {1, 8, 16}) + .add_int64_axis("Nulls", {0, 1}); diff --git a/cpp/src/structs/utilities.cpp b/cpp/src/structs/utilities.cpp index acb153f28d6..f47d066852c 100644 --- a/cpp/src/structs/utilities.cpp +++ b/cpp/src/structs/utilities.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2023, NVIDIA CORPORATION. + * Copyright (c) 2020-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -229,6 +230,7 @@ std::unique_ptr superimpose_nulls_no_sanitize(bitmask_type const* null_m rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { + CUDF_FUNC_RANGE(); if (input->type().id() == cudf::type_id::EMPTY) { // EMPTY columns should not have a null mask, // so don't superimpose null mask on empty columns. @@ -258,19 +260,11 @@ std::unique_ptr superimpose_nulls_no_sanitize(bitmask_type const* null_m // If the input is also a struct, repeat for all its children. Otherwise just return. if (input->type().id() != cudf::type_id::STRUCT) { return std::move(input); } - auto const current_mask = input->view().null_mask(); auto const new_null_count = input->null_count(); // this was just computed in the step above auto content = input->release(); - // Build new children columns. - std::for_each(content.children.begin(), - content.children.end(), - [current_mask, new_null_count, stream, mr](auto& child) { - child = superimpose_nulls_no_sanitize( - current_mask, new_null_count, std::move(child), stream, mr); - }); - // Replace the children columns. + // make_structs_column recursively calls superimpose_nulls return cudf::make_structs_column(num_rows, std::move(content.children), new_null_count, diff --git a/dependencies.yaml b/dependencies.yaml index 1c6d5086bf3..9cf808907ec 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -620,7 +620,7 @@ dependencies: - fastavro>=0.22.9 - hypothesis - pytest-benchmark - - pytest-cases<3.8.2 + - pytest-cases>=3.8.2 - python-snappy>=0.6.0 - scipy - output_types: conda diff --git a/docs/cudf/source/conf.py b/docs/cudf/source/conf.py index b997c78fba8..a0bb555365e 100644 --- a/docs/cudf/source/conf.py +++ b/docs/cudf/source/conf.py @@ -109,12 +109,12 @@ def clean_definitions(root): # All of these in type declarations cause Breathe to choke. # For friend, see https://github.com/breathe-doc/breathe/issues/916 strings_to_remove = ("__forceinline__", "CUDF_HOST_DEVICE", "decltype(auto)", "friend") - for field in (".//type", ".//definition"): - for type_ in root.findall(field): - if type_.text is not None: - for string in strings_to_remove: - type_.text = type_.text.replace(string, "") - + for node in root.iter(): + for string in strings_to_remove: + if node.text is not None: + node.text = node.text.replace(string, "") + if node.tail is not None: + node.tail = node.tail.replace(string, "") def clean_all_xml_files(path): for fn in glob.glob(os.path.join(path, "*.xml")): diff --git a/python/cudf/benchmarks/API/bench_dataframe.py b/python/cudf/benchmarks/API/bench_dataframe.py index f908a995c2a..59d73015962 100644 --- a/python/cudf/benchmarks/API/bench_dataframe.py +++ b/python/cudf/benchmarks/API/bench_dataframe.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Benchmarks of DataFrame methods.""" @@ -178,6 +178,8 @@ def bench_nsmallest(benchmark, dataframe, num_cols_to_sort, n): benchmark(dataframe.nsmallest, n, by) -@pytest_cases.parametrize_with_cases("dataframe, cond, other", prefix="where") +@pytest_cases.parametrize_with_cases( + "dataframe, cond, other", prefix="where", cases="cases_dataframe" +) def bench_where(benchmark, dataframe, cond, other): benchmark(dataframe.where, cond, other) diff --git a/python/cudf/benchmarks/API/bench_functions.py b/python/cudf/benchmarks/API/bench_functions.py index ec4be221d9f..93109838900 100644 --- a/python/cudf/benchmarks/API/bench_functions.py +++ b/python/cudf/benchmarks/API/bench_functions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Benchmarks of free functions that accept cudf objects.""" @@ -9,7 +9,9 @@ from utils import benchmark_with_object -@pytest_cases.parametrize_with_cases("objs", prefix="concat") +@pytest_cases.parametrize_with_cases( + "objs", prefix="concat", cases="cases_functions" +) @pytest.mark.parametrize( "axis", [ diff --git a/python/cudf/benchmarks/API/bench_dataframe_cases.py b/python/cudf/benchmarks/API/cases_dataframe.py similarity index 88% rename from python/cudf/benchmarks/API/bench_dataframe_cases.py rename to python/cudf/benchmarks/API/cases_dataframe.py index fc41d141c8a..d12b9776f1b 100644 --- a/python/cudf/benchmarks/API/bench_dataframe_cases.py +++ b/python/cudf/benchmarks/API/cases_dataframe.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. from utils import benchmark_with_object diff --git a/python/cudf/benchmarks/API/bench_functions_cases.py b/python/cudf/benchmarks/API/cases_functions.py similarity index 99% rename from python/cudf/benchmarks/API/bench_functions_cases.py rename to python/cudf/benchmarks/API/cases_functions.py index c81f8f20f80..6bc66aa4a9b 100644 --- a/python/cudf/benchmarks/API/bench_functions_cases.py +++ b/python/cudf/benchmarks/API/cases_functions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Test cases for benchmarks in bench_functions.py.""" diff --git a/python/cudf/pyproject.toml b/python/cudf/pyproject.toml index 18771804f61..c7b66abea27 100644 --- a/python/cudf/pyproject.toml +++ b/python/cudf/pyproject.toml @@ -59,7 +59,7 @@ test = [ "msgpack", "pytest", "pytest-benchmark", - "pytest-cases<3.8.2", + "pytest-cases>=3.8.2", "pytest-cov", "pytest-xdist", "python-snappy>=0.6.0",