Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/branch-24.10' into pylibcudf/t…
Browse files Browse the repository at this point in the history
…ransform
  • Loading branch information
mroeschke committed Sep 10, 2024
2 parents 66fad1f + afc9f4f commit cd8f5ce
Show file tree
Hide file tree
Showing 660 changed files with 1,859 additions and 2,175 deletions.
14 changes: 7 additions & 7 deletions cpp/benchmarks/common/generate_input.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/utilities/memory_resource.hpp>

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

#include <cuda/functional>
#include <thrust/binary_search.h>
Expand Down Expand Up @@ -507,7 +507,7 @@ std::unique_ptr<cudf::column> create_random_column(data_profile const& profile,
null_mask.end(),
thrust::identity<bool>{},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());

return std::make_unique<cudf::column>(
dtype,
Expand Down Expand Up @@ -591,7 +591,7 @@ std::unique_ptr<cudf::column> create_random_utf8_string_column(data_profile cons
null_mask.end() - 1,
thrust::identity<bool>{},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());
return cudf::make_strings_column(
num_rows,
std::make_unique<cudf::column>(std::move(offsets), rmm::device_buffer{}, 0),
Expand Down Expand Up @@ -626,7 +626,7 @@ std::unique_ptr<cudf::column> create_random_column<cudf::string_view>(data_profi
cudf::out_of_bounds_policy::DONT_CHECK,
cudf::detail::negative_index_policy::NOT_ALLOWED,
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());
return std::move(str_table->release()[0]);
}

Expand Down Expand Up @@ -688,7 +688,7 @@ std::unique_ptr<cudf::column> create_random_column<cudf::struct_view>(data_profi
valids.end(),
thrust::identity<bool>{},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());
}
return std::pair<rmm::device_buffer, cudf::size_type>{};
}();
Expand Down Expand Up @@ -782,7 +782,7 @@ std::unique_ptr<cudf::column> create_random_column<cudf::list_view>(data_profile
valids.end(),
thrust::identity<bool>{},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());
list_column = cudf::make_lists_column(
current_num_rows,
std::move(offsets_column),
Expand Down Expand Up @@ -933,7 +933,7 @@ std::pair<rmm::device_buffer, cudf::size_type> create_random_null_mask(
thrust::make_counting_iterator<cudf::size_type>(size),
bool_generator{seed, 1.0 - *null_probability},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
cudf::get_current_device_resource_ref());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#pragma once

#include <cudf/column/column.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/memory_resource.hpp>

#include <string>

Expand All @@ -36,7 +38,7 @@ std::unique_ptr<cudf::column> generate_random_string_column(
cudf::size_type upper,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a column of random numbers
Expand All @@ -61,7 +63,7 @@ std::unique_ptr<cudf::column> generate_random_numeric_column(
T upper,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a primary key column
Expand All @@ -81,7 +83,7 @@ std::unique_ptr<cudf::column> generate_primary_key_column(
cudf::scalar const& start,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a column where all the rows have the same string value
Expand All @@ -101,7 +103,7 @@ std::unique_ptr<cudf::column> generate_repeat_string_column(
std::string const& value,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a column by randomly choosing from set of strings
Expand All @@ -121,7 +123,7 @@ std::unique_ptr<cudf::column> generate_random_string_column_from_set(
cudf::host_span<const char* const> set,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a column consisting of a repeating sequence of integers
Expand All @@ -145,6 +147,6 @@ std::unique_ptr<cudf::column> generate_repeat_sequence_column(
bool zero_indexed,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

} // namespace cudf::datagen
3 changes: 3 additions & 0 deletions cpp/benchmarks/common/tpch_data_generator/table_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include <cudf/transform.hpp>
#include <cudf/unary.hpp>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/resource_ref.hpp>

#include <vector>

namespace cudf::datagen {
Expand Down
20 changes: 11 additions & 9 deletions cpp/benchmarks/common/tpch_data_generator/table_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <cudf/column/column_view.hpp>
#include <cudf/table/table.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/memory_resource.hpp>

#include <vector>

Expand All @@ -37,7 +39,7 @@ std::unique_ptr<cudf::column> add_calendrical_days(
cudf::column_view const& timestamp_days,
cudf::column_view const& days,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Perform a left join operation between two tables
Expand All @@ -56,7 +58,7 @@ std::unique_ptr<cudf::table> perform_left_join(
std::vector<cudf::size_type> const& left_on,
std::vector<cudf::size_type> const& right_on,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `p_retailprice` column of the `part` table
Expand All @@ -68,7 +70,7 @@ std::unique_ptr<cudf::table> perform_left_join(
[[nodiscard]] std::unique_ptr<cudf::column> calculate_p_retailprice(
cudf::column_view const& p_partkey,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `l_suppkey` column of the `lineitem` table
Expand All @@ -84,7 +86,7 @@ std::unique_ptr<cudf::table> perform_left_join(
cudf::size_type scale_factor,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `ps_suppkey` column of the `partsupp` table
Expand All @@ -100,7 +102,7 @@ std::unique_ptr<cudf::table> perform_left_join(
cudf::size_type scale_factor,
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
/**
* @brief Calculate the cardinality of the `lineitem` table
*
Expand All @@ -111,7 +113,7 @@ std::unique_ptr<cudf::table> perform_left_join(
[[nodiscard]] cudf::size_type calculate_l_cardinality(
cudf::column_view const& o_rep_freqs,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
/**
* @brief Calculate the charge column for the `lineitem` table
*
Expand All @@ -126,7 +128,7 @@ std::unique_ptr<cudf::table> perform_left_join(
cudf::column_view const& tax,
cudf::column_view const& discount,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a column of random addresses according to TPC-H specification clause 4.2.2.7
Expand All @@ -138,7 +140,7 @@ std::unique_ptr<cudf::table> perform_left_join(
[[nodiscard]] std::unique_ptr<cudf::column> generate_address_column(
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate a phone number column according to TPC-H specification clause 4.2.2.9
Expand All @@ -150,6 +152,6 @@ std::unique_ptr<cudf::table> perform_left_join(
[[nodiscard]] std::unique_ptr<cudf::column> generate_phone_column(
cudf::size_type num_rows,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

} // namespace cudf::datagen
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include <cudf/transform.hpp>
#include <cudf/unary.hpp>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/resource_ref.hpp>

#include <array>
#include <string>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#pragma once

#include <cudf/table/table.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/memory_resource.hpp>

namespace CUDF_EXPORT cudf {
namespace datagen {
Expand All @@ -32,7 +34,7 @@ std::tuple<std::unique_ptr<cudf::table>, std::unique_ptr<cudf::table>, std::uniq
generate_orders_lineitem_part(
double scale_factor,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `partsupp` table
Expand All @@ -44,7 +46,7 @@ generate_orders_lineitem_part(
std::unique_ptr<cudf::table> generate_partsupp(
double scale_factor,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `supplier` table
Expand All @@ -56,7 +58,7 @@ std::unique_ptr<cudf::table> generate_partsupp(
std::unique_ptr<cudf::table> generate_supplier(
double scale_factor,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `customer` table
Expand All @@ -68,7 +70,7 @@ std::unique_ptr<cudf::table> generate_supplier(
std::unique_ptr<cudf::table> generate_customer(
double scale_factor,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `nation` table
Expand All @@ -78,7 +80,7 @@ std::unique_ptr<cudf::table> generate_customer(
*/
std::unique_ptr<cudf::table> generate_nation(
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

/**
* @brief Generate the `region` table
Expand All @@ -88,7 +90,7 @@ std::unique_ptr<cudf::table> generate_nation(
*/
std::unique_ptr<cudf::table> generate_region(
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());

} // namespace datagen
} // namespace CUDF_EXPORT cudf
5 changes: 3 additions & 2 deletions cpp/benchmarks/copying/contiguous_split.cu
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 All @@ -22,6 +22,7 @@

#include <cudf/column/column.hpp>
#include <cudf/contiguous_split.hpp>
#include <cudf/utilities/memory_resource.hpp>

#include <thrust/iterator/counting_iterator.h>

Expand All @@ -32,7 +33,7 @@ void contiguous_split(cudf::table_view const& src_table, std::vector<cudf::size_

void chunked_pack(cudf::table_view const& src_table, std::vector<cudf::size_type> const&)
{
auto const mr = rmm::mr::get_current_device_resource();
auto const mr = cudf::get_current_device_resource_ref();
auto const stream = cudf::get_default_stream();
auto user_buffer = rmm::device_uvector<std::uint8_t>(100L * 1024 * 1024, stream, mr);
auto chunked_pack = cudf::chunked_pack::create(src_table, user_buffer.size(), mr);
Expand Down
5 changes: 2 additions & 3 deletions cpp/benchmarks/copying/shift.cu
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
#include <cudf/copying.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>

#include <rmm/resource_ref.hpp>
#include <cudf/utilities/memory_resource.hpp>

template <typename T, typename ScalarType = cudf::scalar_type_t<T>>
std::unique_ptr<cudf::scalar> make_scalar(
T value = 0,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())
{
auto s = new ScalarType(value, true, stream, mr);
return std::unique_ptr<cudf::scalar>(s);
Expand Down
13 changes: 7 additions & 6 deletions cpp/benchmarks/fixture/benchmark_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

#pragma once

#include <cudf/utilities/memory_resource.hpp>

#include <rmm/cuda_device.hpp>
#include <rmm/mr/device/cuda_memory_resource.hpp>
#include <rmm/mr/device/owning_wrapper.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/mr/device/pool_memory_resource.hpp>
#include <rmm/mr/device/statistics_resource_adaptor.hpp>

Expand Down Expand Up @@ -83,13 +84,13 @@ class benchmark : public ::benchmark::Fixture {
void SetUp(::benchmark::State const& state) override
{
mr = make_pool_instance();
rmm::mr::set_current_device_resource(mr.get()); // set default resource to pool
cudf::set_current_device_resource(mr.get()); // set default resource to pool
}

void TearDown(::benchmark::State const& state) override
{
// reset default resource to the initial resource
rmm::mr::set_current_device_resource(nullptr);
cudf::set_current_device_resource(nullptr);
mr.reset();
}

Expand All @@ -106,13 +107,13 @@ class benchmark : public ::benchmark::Fixture {
class memory_stats_logger {
public:
memory_stats_logger()
: existing_mr(rmm::mr::get_current_device_resource()),
: existing_mr(cudf::get_current_device_resource()),
statistics_mr(rmm::mr::statistics_resource_adaptor(existing_mr))
{
rmm::mr::set_current_device_resource(&statistics_mr);
cudf::set_current_device_resource(&statistics_mr);
}

~memory_stats_logger() { rmm::mr::set_current_device_resource(existing_mr); }
~memory_stats_logger() { cudf::set_current_device_resource(existing_mr); }

[[nodiscard]] size_t peak_memory_usage() const noexcept
{
Expand Down
Loading

0 comments on commit cd8f5ce

Please sign in to comment.