Skip to content

Commit

Permalink
Merge branch 'branch-25.02' into high-lvl-comp-api
Browse files Browse the repository at this point in the history
  • Loading branch information
vuule authored Jan 8, 2025
2 parents ea04f43 + f017f86 commit 3e403b0
Show file tree
Hide file tree
Showing 48 changed files with 1,339 additions and 3,332 deletions.
13 changes: 3 additions & 10 deletions ci/test_python_other.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

# Support invoking test_python_cudf.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../
Expand All @@ -24,8 +24,8 @@ EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest dask_cudf (dask-expr)"
DASK_DATAFRAME__QUERY_PLANNING=True ./ci/run_dask_cudf_pytests.sh \
rapids-logger "pytest dask_cudf"
./ci/run_dask_cudf_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-dask-cudf.xml" \
--numprocesses=8 \
--dist=worksteal \
Expand All @@ -34,13 +34,6 @@ DASK_DATAFRAME__QUERY_PLANNING=True ./ci/run_dask_cudf_pytests.sh \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/dask-cudf-coverage.xml" \
--cov-report=term

rapids-logger "pytest dask_cudf (legacy)"
DASK_DATAFRAME__QUERY_PLANNING=False ./ci/run_dask_cudf_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-dask-cudf-legacy.xml" \
--numprocesses=8 \
--dist=worksteal \
.

rapids-logger "pytest cudf_kafka"
./ci/run_cudf_kafka_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cudf-kafka.xml"
Expand Down
16 changes: 3 additions & 13 deletions ci/test_wheel_dask_cudf.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

set -eou pipefail

Expand Down Expand Up @@ -30,21 +30,11 @@ RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${RESULTS_DIR}/test-results"}/
mkdir -p "${RAPIDS_TESTS_DIR}"

# Run tests in dask_cudf/tests and dask_cudf/io/tests
rapids-logger "pytest dask_cudf (dask-expr)"
rapids-logger "pytest dask_cudf"
pushd python/dask_cudf/dask_cudf
DASK_DATAFRAME__QUERY_PLANNING=True python -m pytest \
python -m pytest \
--junitxml="${RAPIDS_TESTS_DIR}/junit-dask-cudf.xml" \
--numprocesses=8 \
--dist=worksteal \
.
popd

# Run tests in dask_cudf/tests and dask_cudf/io/tests (legacy)
rapids-logger "pytest dask_cudf (legacy)"
pushd python/dask_cudf/dask_cudf
DASK_DATAFRAME__QUERY_PLANNING=False python -m pytest \
--junitxml="${RAPIDS_TESTS_DIR}/junit-dask-cudf-legacy.xml" \
--numprocesses=8 \
--dist=worksteal \
.
popd
7 changes: 6 additions & 1 deletion cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
# Copyright (c) 2018-2025, 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
Expand Down Expand Up @@ -425,6 +425,11 @@ ConfigureNVBench(DECIMAL_NVBENCH decimal/convert_floating.cpp)
# ---------------------------------------------------------------------------------
ConfigureNVBench(RESHAPE_NVBENCH reshape/interleave.cpp)

# ##################################################################################################
# * rolling benchmark
# ---------------------------------------------------------------------------------
ConfigureNVBench(ROLLING_NVBENCH rolling/grouped_rolling_sum.cpp rolling/rolling_sum.cpp)

add_custom_target(
run_benchmarks
DEPENDS CUDF_BENCHMARKS
Expand Down
70 changes: 70 additions & 0 deletions cpp/benchmarks/rolling/grouped_rolling_sum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2024-2025, 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 <cudf/aggregation.hpp>
#include <cudf/rolling.hpp>
#include <cudf/sorting.hpp>
#include <cudf/utilities/default_stream.hpp>

#include <nvbench/nvbench.cuh>

template <typename Type>
void bench_row_grouped_rolling_sum(nvbench::state& state, nvbench::type_list<Type>)
{
auto const num_rows = static_cast<cudf::size_type>(state.get_int64("num_rows"));
auto const cardinality = static_cast<cudf::size_type>(state.get_int64("cardinality"));
auto const preceding_size = static_cast<cudf::size_type>(state.get_int64("preceding_size"));
auto const following_size = static_cast<cudf::size_type>(state.get_int64("following_size"));
auto const min_periods = static_cast<cudf::size_type>(state.get_int64("min_periods"));

auto const keys = [&] {
data_profile const profile =
data_profile_builder()
.cardinality(cardinality)
.no_validity()
.distribution(cudf::type_to_id<int32_t>(), distribution_id::UNIFORM, 0, num_rows);
auto keys = create_random_column(cudf::type_to_id<int32_t>(), row_count{num_rows}, profile);
return cudf::sort(cudf::table_view{{keys->view()}});
}();
data_profile const profile = data_profile_builder().cardinality(0).no_validity().distribution(
cudf::type_to_id<Type>(), distribution_id::UNIFORM, 0, 100);
auto vals = create_random_column(cudf::type_to_id<Type>(), row_count{num_rows}, profile);

auto req = cudf::make_sum_aggregation<cudf::rolling_aggregation>();

auto const mem_stats_logger = cudf::memory_stats_logger();
state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value()));
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
auto const result = cudf::grouped_rolling_window(
keys->view(), vals->view(), preceding_size, following_size, min_periods, *req);
});
auto const elapsed_time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value");
state.add_element_count(static_cast<double>(num_rows) / elapsed_time / 1'000'000., "Mrows/s");
state.add_buffer_size(
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
}

NVBENCH_BENCH_TYPES(bench_row_grouped_rolling_sum,
NVBENCH_TYPE_AXES(nvbench::type_list<std::int32_t, double>))
.set_name("row_grouped_rolling_sum")
.add_int64_power_of_two_axis("num_rows", {14, 28})
.add_int64_axis("preceding_size", {1, 10})
.add_int64_axis("following_size", {2})
.add_int64_axis("min_periods", {1})
.add_int64_axis("cardinality", {10, 100, 1'000'000, 100'000'000});
134 changes: 134 additions & 0 deletions cpp/benchmarks/rolling/rolling_sum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright (c) 2024-2025, 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 <cudf/aggregation.hpp>
#include <cudf/rolling.hpp>
#include <cudf/sorting.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>

#include <rmm/device_buffer.hpp>
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

#include <thrust/iterator/counting_iterator.h>

#include <nvbench/nvbench.cuh>

#include <algorithm>

template <typename Type>
void bench_row_fixed_rolling_sum(nvbench::state& state, nvbench::type_list<Type>)
{
auto const num_rows = static_cast<cudf::size_type>(state.get_int64("num_rows"));
auto const preceding_size = static_cast<cudf::size_type>(state.get_int64("preceding_size"));
auto const following_size = static_cast<cudf::size_type>(state.get_int64("following_size"));
auto const min_periods = static_cast<cudf::size_type>(state.get_int64("min_periods"));

data_profile const profile = data_profile_builder().cardinality(0).no_validity().distribution(
cudf::type_to_id<Type>(), distribution_id::UNIFORM, 0, 100);
auto vals = create_random_column(cudf::type_to_id<Type>(), row_count{num_rows}, profile);

auto req = cudf::make_sum_aggregation<cudf::rolling_aggregation>();

auto const mem_stats_logger = cudf::memory_stats_logger();
state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value()));
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
auto const result =
cudf::rolling_window(vals->view(), preceding_size, following_size, min_periods, *req);
});
auto const elapsed_time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value");
state.add_element_count(static_cast<double>(num_rows) / elapsed_time / 1'000'000., "Mrows/s");
state.add_buffer_size(
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
}

template <typename Type>
void bench_row_variable_rolling_sum(nvbench::state& state, nvbench::type_list<Type>)
{
auto const num_rows = static_cast<cudf::size_type>(state.get_int64("num_rows"));
auto const preceding_size = static_cast<cudf::size_type>(state.get_int64("preceding_size"));
auto const following_size = static_cast<cudf::size_type>(state.get_int64("following_size"));

auto vals = [&]() {
data_profile const profile = data_profile_builder().cardinality(0).no_validity().distribution(
cudf::type_to_id<Type>(), distribution_id::UNIFORM, 0, 100);
return create_random_column(cudf::type_to_id<Type>(), row_count{num_rows}, profile);
}();

auto preceding = [&]() {
auto data = std::vector<cudf::size_type>(num_rows);
auto it = thrust::make_counting_iterator<cudf::size_type>(0);
std::transform(it, it + num_rows, data.begin(), [num_rows, preceding_size](auto i) {
return std::min(i + 1, std::max(preceding_size, i + 1 - num_rows));
});
auto buf = rmm::device_buffer(
data.data(), num_rows * sizeof(cudf::size_type), cudf::get_default_stream());
cudf::get_default_stream().synchronize();
return std::make_unique<cudf::column>(cudf::data_type(cudf::type_to_id<cudf::size_type>()),
num_rows,
std::move(buf),
rmm::device_buffer{},
0);
}();

auto following = [&]() {
auto data = std::vector<cudf::size_type>(num_rows);
auto it = thrust::make_counting_iterator<cudf::size_type>(0);
std::transform(it, it + num_rows, data.begin(), [num_rows, following_size](auto i) {
return std::max(-i - 1, std::min(following_size, num_rows - i - 1));
});
auto buf = rmm::device_buffer(
data.data(), num_rows * sizeof(cudf::size_type), cudf::get_default_stream());
cudf::get_default_stream().synchronize();
return std::make_unique<cudf::column>(cudf::data_type(cudf::type_to_id<cudf::size_type>()),
num_rows,
std::move(buf),
rmm::device_buffer{},
0);
}();

auto req = cudf::make_sum_aggregation<cudf::rolling_aggregation>();

auto const mem_stats_logger = cudf::memory_stats_logger();
state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value()));
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
auto const result =
cudf::rolling_window(vals->view(), preceding->view(), following->view(), 1, *req);
});
auto const elapsed_time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value");
state.add_element_count(static_cast<double>(num_rows) / elapsed_time / 1'000'000., "Mrows/s");
state.add_buffer_size(
mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage");
}

NVBENCH_BENCH_TYPES(bench_row_fixed_rolling_sum,
NVBENCH_TYPE_AXES(nvbench::type_list<std::int32_t, double>))
.set_name("row_fixed_rolling_sum")
.add_int64_power_of_two_axis("num_rows", {14, 22, 28})
.add_int64_axis("preceding_size", {1, 10, 100})
.add_int64_axis("following_size", {2})
.add_int64_axis("min_periods", {1, 20});

NVBENCH_BENCH_TYPES(bench_row_variable_rolling_sum,
NVBENCH_TYPE_AXES(nvbench::type_list<std::int32_t, double>))
.set_name("row_variable_rolling_sum")
.add_int64_power_of_two_axis("num_rows", {14, 22, 28})
.add_int64_axis("preceding_size", {10, 100})
.add_int64_axis("following_size", {2});
19 changes: 16 additions & 3 deletions cpp/scripts/sort_ninja_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
import argparse
import os
import re
import sys
import xml.etree.ElementTree as ET
from pathlib import Path
Expand Down Expand Up @@ -144,6 +145,16 @@ def format_file_size(input_size):
return file_size_str


def replace_placeholder_patterns(input_string: str) -> str:
pattern = r'(_h_env_placehold)[_placehold]+'
return re.sub(pattern, r'\1...', input_string)


# adjust name for display
def format_file_name(name: str) -> str:
return replace_placeholder_patterns(name)


# Output chart results in HTML format
# Builds a standalone html file with no javascript or styles
def output_html(entries, sorted_list, cmp_entries, args):
Expand Down Expand Up @@ -223,7 +234,8 @@ def output_html(entries, sorted_list, cmp_entries, args):
print("<td height='20px' width='", size, "px' ", sep="", end="")
# title text is shown as hover-text by most browsers
print(color, "title='", end="")
print(name, "\n", build_time_str, "' ", sep="", end="")
display_name = format_file_name(name)
print(display_name, "\n", build_time_str, "' ", sep="", end="")
# centers the name if it fits in the box
print("align='center' nowrap>", end="")
# use a slightly smaller, fixed-width font
Expand Down Expand Up @@ -265,7 +277,8 @@ def output_html(entries, sorted_list, cmp_entries, args):
file_size_str = format_file_size(file_size)

# output entry row
print("<tr ", color, "><td>", name, "</td>", sep="", end="")
display_name = format_file_name(name)
print("<tr ", color, "><td>", display_name, "</td>", sep="", end="")
print("<td align='right'>", build_time_str, "</td>", sep="", end="")
print("<td align='right'>", file_size_str, "</td>", sep="", end="")
# output diff column
Expand Down
Loading

0 comments on commit 3e403b0

Please sign in to comment.