Skip to content

Commit

Permalink
Merge branch 'branch-24.06' into eagerly-populate-class-dict
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke authored Apr 11, 2024
2 parents 16a647d + af33b0a commit 9891545
Show file tree
Hide file tree
Showing 28 changed files with 645 additions and 282 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ jobs:
state: CUSTOM_STATE = 'success'
} = contentJSON;
// Fetch the first job ID from the workflow run
const jobs = await github.rest.actions.listJobsForWorkflowRun({
// Fetch all jobs using pagination
const jobs = await github.paginate(
github.rest.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: process.env.WORKFLOW_RUN_ID,
});
const job = jobs.data.jobs.find(job => job.name === JOB_NAME);
}
);
// Fetch the first job ID from the workflow run
const job = jobs.find(job => job.name === JOB_NAME);
const JOB_ID = job ? job.id : null;
// Set default target URL if not defined
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
matrix_filter: map(select(.ARCH == "amd64")) | group_by(.CUDA_VER|split(".")|map(tonumber)|.[0]) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]))
matrix_filter: map(select(.ARCH == "amd64")) | group_by(.CUDA_VER|split(".")|map(tonumber)|.[0]) | map(min_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]))
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
Expand Down
297 changes: 297 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions ci/cudf_pandas_scripts/pandas-tests/diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
GH_JOB_NAME="pandas-tests-diff / build"
rapids-logger "Github job name: ${GH_JOB_NAME}"

MAIN_ARTIFACT=$(rapids-s3-path)cuda12_$(arch)_py310.main-results.json
PR_ARTIFACT=$(rapids-s3-path)cuda12_$(arch)_py39.pr-results.json
PY_VER="39"
MAIN_ARTIFACT=$(rapids-s3-path)cuda12_$(arch)_py${PY_VER}.main-results.json
PR_ARTIFACT=$(rapids-s3-path)cuda12_$(arch)_py${PY_VER}.pr-results.json

rapids-logger "Fetching latest available results from nightly"
aws s3api list-objects-v2 --bucket rapids-downloads --prefix "nightly/" --query "sort_by(Contents[?ends_with(Key, '.main-results.json')], &LastModified)[::-1].[Key]" --output text > s3_output.txt
cat s3_output.txt
aws s3api list-objects-v2 --bucket rapids-downloads --prefix "nightly/" --query "sort_by(Contents[?ends_with(Key, '_py${PY_VER}.main-results.json')], &LastModified)[::-1].[Key]" --output text > s3_output.txt

read -r COMPARE_ENV < s3_output.txt
export COMPARE_ENV
rapids-logger "Latest available results from nightly: ${COMPARE_ENV}"
Expand Down
36 changes: 6 additions & 30 deletions cpp/cmake/thirdparty/get_nanoarrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,20 @@

# This function finds nanoarrow and sets any additional necessary environment variables.
function(find_and_configure_nanoarrow)
set(oneValueArgs VERSION FORK PINNED_TAG)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
include(${rapids-cmake-dir}/cpm/package_override.cmake)

# Only run if PKG_VERSION is < 0.5.0
if(PKG_VERSION VERSION_LESS 0.5.0)
set(patch_files_to_run "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches/nanoarrow_cmake.diff")
set(patch_issues_to_ref
"Fix issues with nanoarrow CMake [https://github.com/apache/arrow-nanoarrow/pull/406]"
)
set(patch_script "${CMAKE_BINARY_DIR}/rapids-cmake/patches/nanoarrow/patch.cmake")
set(log_file "${CMAKE_BINARY_DIR}/rapids-cmake/patches/nanoarrow/log")
string(TIMESTAMP current_year "%Y" UTC)
configure_file(
${rapids-cmake-dir}/cpm/patches/command_template.cmake.in "${patch_script}" @ONLY
)
else()
message(
FATAL_ERROR
"Nanoarrow version ${PKG_VERSION} already contains the necessary patch. Please remove this patch from cudf."
)
endif()
set(cudf_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches")
rapids_cpm_package_override("${cudf_patch_dir}/nanoarrow_override.json")

# The git_repo and git_tag are provided by the nanoarrow_override file
rapids_cpm_find(
nanoarrow ${PKG_VERSION}
nanoarrow 0.4.0
GLOBAL_TARGETS nanoarrow
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/arrow-nanoarrow.git
GIT_TAG ${PKG_PINNED_TAG}
# TODO: Commit hashes are not supported with shallow clones. Can switch this if and when we pin
# to an actual tag.
GIT_SHALLOW FALSE
PATCH_COMMAND ${CMAKE_COMMAND} -P ${patch_script}
OPTIONS "BUILD_SHARED_LIBS OFF" "NANOARROW_NAMESPACE cudf"
)
set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
rapids_export_find_package_root(BUILD nanoarrow "${nanoarrow_BINARY_DIR}" EXPORT_SET cudf-exports)
endfunction()

find_and_configure_nanoarrow(
VERSION 0.4.0 FORK apache PINNED_TAG c97720003ff863b81805bcdb9f7c91306ab6b6a8
)
find_and_configure_nanoarrow()
18 changes: 18 additions & 0 deletions cpp/cmake/thirdparty/patches/nanoarrow_override.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

{
"packages" : {
"nanoarrow" : {
"version" : "0.4.0",
"git_url" : "https://github.com/apache/arrow-nanoarrow.git",
"git_tag" : "c97720003ff863b81805bcdb9f7c91306ab6b6a8",
"git_shallow" : false,
"patches" : [
{
"file" : "${current_json_dir}/nanoarrow_cmake.diff",
"issue" : "Fix add support for global setup to initialize RMM in nvbench [https://github.com/NVIDIA/nvbench/pull/123]",
"fixed_in" : "0.5.0"
}
]
}
}
}
4 changes: 3 additions & 1 deletion cpp/examples/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.

# libcudf examples build script

set -euo pipefail

# Parallelism control
PARALLEL_LEVEL=${PARALLEL_LEVEL:-4}

Expand Down
4 changes: 3 additions & 1 deletion cpp/examples/strings/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <cudf/column/column_view.hpp>
#include <cudf/io/csv.hpp>
#include <cudf/io/datasource.hpp>
#include <cudf/strings/strings_column_view.hpp>
#include <cudf/table/table.hpp>
#include <cudf/table/table_view.hpp>

Expand Down Expand Up @@ -110,7 +111,8 @@ int main(int argc, char const** argv)

std::chrono::duration<double> elapsed = std::chrono::steady_clock::now() - st;
std::cout << "Wall time: " << elapsed.count() << " seconds\n";
std::cout << "Output size " << result->view().child(1).size() << " bytes\n";
auto const scv = cudf::strings_column_view(result->view());
std::cout << "Output size " << scv.chars_size(rmm::cuda_stream_default) << " bytes\n";

return 0;
}
8 changes: 6 additions & 2 deletions cpp/examples/strings/custom_optimized.cu
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,12 @@ std::unique_ptr<cudf::column> redact_strings(cudf::column_view const& names,
redact_kernel<<<blocks, block_size, 0, stream.value()>>>(
*d_names, *d_visibilities, offsets.data(), chars.data());

// create column from offsets and chars vectors (no copy is performed)
auto result = cudf::make_strings_column(names.size(), std::move(offsets), chars.release(), {}, 0);
// create column from offsets vector (move only)
auto offsets_column = std::make_unique<cudf::column>(std::move(offsets), rmm::device_buffer{}, 0);

// create column for chars vector (no copy is performed)
auto result = cudf::make_strings_column(
names.size(), std::move(offsets_column), chars.release(), 0, rmm::device_buffer{});

// wait for all of the above to finish
stream.synchronize();
Expand Down
49 changes: 4 additions & 45 deletions cpp/include/cudf/fixed_point/fixed_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ constexpr inline auto is_supported_representation_type()
cuda::std::is_same_v<T, __int128_t>;
}

/**
* @brief Returns `true` if the value type is supported for constructing a `fixed_point`
*
* @tparam T The construction value type
* @return `true` if the value type is supported to construct a `fixed_point` type
*/
template <typename T>
constexpr inline auto is_supported_construction_value_type()
{
return cuda::std::is_integral<T>() || cuda::std::is_floating_point_v<T>;
}

/** @} */ // end of group

// Helper functions for `fixed_point` type
Expand Down Expand Up @@ -222,23 +210,8 @@ class fixed_point {
scale_type _scale;

public:
using rep = Rep; ///< The representation type

/**
* @brief Constructor that will perform shifting to store value appropriately (from floating point
* types)
*
* @tparam T The floating point type that you are constructing from
* @param value The value that will be constructed from
* @param scale The exponent that is applied to Rad to perform shifting
*/
template <typename T,
typename cuda::std::enable_if_t<cuda::std::is_floating_point<T>() &&
is_supported_representation_type<Rep>()>* = nullptr>
CUDF_HOST_DEVICE inline explicit fixed_point(T const& value, scale_type const& scale)
: _value{static_cast<Rep>(detail::shift<Rep, Rad>(value, scale))}, _scale{scale}
{
}
using rep = Rep; ///< The representation type
static constexpr auto rad = Rad; ///< The base

/**
* @brief Constructor that will perform shifting to store value appropriately (from integral
Expand All @@ -249,7 +222,7 @@ class fixed_point {
* @param scale The exponent that is applied to Rad to perform shifting
*/
template <typename T,
typename cuda::std::enable_if_t<cuda::std::is_integral<T>() &&
typename cuda::std::enable_if_t<cuda::std::is_integral_v<T> &&
is_supported_representation_type<Rep>()>* = nullptr>
CUDF_HOST_DEVICE inline explicit fixed_point(T const& value, scale_type const& scale)
// `value` is cast to `Rep` to avoid overflow in cases where
Expand All @@ -275,8 +248,7 @@ class fixed_point {
* @tparam T The value type being constructing from
* @param value The value that will be constructed from
*/
template <typename T,
typename cuda::std::enable_if_t<is_supported_construction_value_type<T>()>* = nullptr>
template <typename T, typename cuda::std::enable_if_t<cuda::std::is_integral_v<T>>* = nullptr>
CUDF_HOST_DEVICE inline fixed_point(T const& value)
: _value{static_cast<Rep>(value)}, _scale{scale_type{0}}
{
Expand All @@ -288,19 +260,6 @@ class fixed_point {
*/
CUDF_HOST_DEVICE inline fixed_point() : _scale{scale_type{0}} {}

/**
* @brief Explicit conversion operator for casting to floating point types
*
* @tparam U The floating point type that is being explicitly converted to
* @return The `fixed_point` number in base 10 (aka human readable format)
*/
template <typename U,
typename cuda::std::enable_if_t<cuda::std::is_floating_point_v<U>>* = nullptr>
explicit constexpr operator U() const
{
return detail::shift<Rep, Rad>(static_cast<U>(_value), scale_type{-_scale});
}

/**
* @brief Explicit conversion operator for casting to integral types
*
Expand Down
75 changes: 74 additions & 1 deletion cpp/include/cudf/unary.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -16,8 +16,10 @@

#pragma once

#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/traits.hpp>

#include <rmm/mr/device/per_device_resource.hpp>

Expand All @@ -31,6 +33,77 @@ namespace cudf {
* @brief Column APIs for unary ops
*/

/**
* @brief Convert a floating-point value to fixed point
*
* @note This conversion was moved from fixed-point member functions to free functions.
* This is so that the complex conversion code is not included into many parts of the
* code base that don't need it, and so that it's more obvious to pinpoint where these
* conversions are occurring.
*
* @tparam Fixed The fixed-point type to convert to
* @tparam Floating The floating-point type to convert from
* @param floating The floating-point value to convert
* @param scale The desired scale of the fixed-point value
* @return The converted fixed-point value
*/
template <typename Fixed,
typename Floating,
typename cuda::std::enable_if_t<is_fixed_point<Fixed>() &&
cuda::std::is_floating_point_v<Floating>>* = nullptr>
CUDF_HOST_DEVICE Fixed convert_floating_to_fixed(Floating floating, numeric::scale_type scale)
{
using Rep = typename Fixed::rep;
auto const shifted = numeric::detail::shift<Rep, Fixed::rad>(floating, scale);
numeric::scaled_integer<Rep> scaled{static_cast<Rep>(shifted), scale};
return Fixed(scaled);
}

/**
* @brief Convert a fixed-point value to floating point
*
* @note This conversion was moved from fixed-point member functions to free functions.
* This is so that the complex conversion code is not included into many parts of the
* code base that don't need it, and so that it's more obvious to pinpoint where these
* conversions are occurring.
*
* @tparam Floating The floating-point type to convert to
* @tparam Fixed The fixed-point type to convert from
* @param fixed The fixed-point value to convert
* @return The converted floating-point value
*/
template <typename Floating,
typename Fixed,
typename cuda::std::enable_if_t<cuda::std::is_floating_point_v<Floating> &&
is_fixed_point<Fixed>()>* = nullptr>
CUDF_HOST_DEVICE Floating convert_fixed_to_floating(Fixed fixed)
{
using Rep = typename Fixed::rep;
auto const casted = static_cast<Floating>(fixed.value());
auto const scale = numeric::scale_type{-fixed.scale()};
return numeric::detail::shift<Rep, Fixed::rad>(casted, scale);
}

/**
* @brief Convert a value to floating point
*
* @tparam Floating The floating-point type to convert to
* @tparam Input The input type to convert from
* @param input The input value to convert
* @return The converted floating-point value
*/
template <typename Floating,
typename Input,
typename cuda::std::enable_if_t<cuda::std::is_floating_point_v<Floating>>* = nullptr>
CUDF_HOST_DEVICE Floating convert_to_floating(Input input)
{
if constexpr (is_fixed_point<Input>()) {
return convert_fixed_to_floating<Floating>(input);
} else {
return static_cast<Floating>(input);
}
}

/**
* @brief Types of unary operations that can be performed on data.
*/
Expand Down
7 changes: 5 additions & 2 deletions cpp/include/cudf/utilities/traits.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-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.
Expand Down Expand Up @@ -397,7 +397,10 @@ template <typename T>
constexpr inline bool is_fixed_point()
{
return std::is_same_v<numeric::decimal32, T> || std::is_same_v<numeric::decimal64, T> ||
std::is_same_v<numeric::decimal128, T>;
std::is_same_v<numeric::decimal128, T> ||
std::is_same_v<numeric::fixed_point<int32_t, numeric::Radix::BASE_2>, T> ||
std::is_same_v<numeric::fixed_point<int64_t, numeric::Radix::BASE_2>, T> ||
std::is_same_v<numeric::fixed_point<__int128_t, numeric::Radix::BASE_2>, T>;
}

/**
Expand Down
19 changes: 12 additions & 7 deletions cpp/src/binaryop/compiled/binary_ops.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cudf/column/column_device_view.cuh>
#include <cudf/column/column_view.hpp>
#include <cudf/detail/utilities/integer_utils.hpp>
#include <cudf/unary.hpp>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/exec_policy.hpp>
Expand Down Expand Up @@ -69,13 +70,17 @@ struct typed_casted_writer {
if constexpr (mutable_column_device_view::has_element_accessor<Element>() and
std::is_constructible_v<Element, FromType>) {
col.element<Element>(i) = static_cast<Element>(val);
} else if constexpr (is_fixed_point<Element>() and
(is_fixed_point<FromType>() or
std::is_constructible_v<Element, FromType>)) {
if constexpr (is_fixed_point<FromType>())
col.data<Element::rep>()[i] = val.rescaled(numeric::scale_type{col.type().scale()}).value();
else
col.data<Element::rep>()[i] = Element{val, numeric::scale_type{col.type().scale()}}.value();
} else if constexpr (is_fixed_point<Element>()) {
auto const scale = numeric::scale_type{col.type().scale()};
if constexpr (is_fixed_point<FromType>()) {
col.data<Element::rep>()[i] = val.rescaled(scale).value();
} else if constexpr (cuda::std::is_constructible_v<Element, FromType>) {
col.data<Element::rep>()[i] = Element{val, scale}.value();
} else if constexpr (cuda::std::is_floating_point_v<FromType>) {
col.data<Element::rep>()[i] = convert_floating_to_fixed<Element>(val, scale).value();
}
} else if constexpr (cuda::std::is_floating_point_v<Element> and is_fixed_point<FromType>()) {
col.data<Element>()[i] = convert_fixed_to_floating<Element>(val);
}
}
};
Expand Down
Loading

0 comments on commit 9891545

Please sign in to comment.