From 565efb74a85153088eee43e45d5d877cae731685 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 20 Mar 2023 12:57:35 -0400 Subject: [PATCH] Remove default detail mrs: part6 (#12969) This is the sixth PR in a sequence removing default mr parameters in detail APIs. Contributes to https://github.com/rapidsai/cudf/issues/12944. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - David Wendt (https://github.com/davidwendt) - Yunsong Wang (https://github.com/PointKernel) - Jason Lowe (https://github.com/jlowe) URL: https://github.com/rapidsai/cudf/pull/12969 --- cpp/benchmarks/iterator/iterator.cu | 8 +- cpp/include/cudf/detail/gather.cuh | 6 +- cpp/include/cudf/detail/null_mask.cuh | 3 +- .../detail/utilities/vector_factories.hpp | 58 ++--- .../cudf/lists/lists_column_factories.hpp | 11 +- .../cudf/structs/detail/concatenate.hpp | 9 +- cpp/include/cudf_test/column_wrapper.hpp | 21 +- cpp/include/cudf_test/tdigest_utilities.cuh | 5 +- cpp/src/copying/concatenate.cu | 6 +- cpp/src/dictionary/detail/concatenate.cu | 5 +- cpp/src/groupby/hash/groupby.cu | 3 +- cpp/src/groupby/sort/group_quantiles.cu | 5 +- cpp/src/hash/unordered_multiset.cuh | 10 +- cpp/src/io/avro/reader_impl.cu | 9 +- cpp/src/io/comp/uncomp.cpp | 7 +- cpp/src/io/csv/csv_gpu.cu | 6 +- cpp/src/io/csv/reader_impl.cu | 31 +-- cpp/src/io/json/experimental/read_json.cpp | 3 +- cpp/src/io/json/json_column.cu | 6 +- cpp/src/io/json/json_gpu.cu | 4 +- cpp/src/io/json/nested_json_gpu.cu | 6 +- cpp/src/io/json/reader_impl.cu | 39 ++-- cpp/src/io/json/write_json.cu | 6 +- cpp/src/io/orc/reader_impl.cu | 9 +- cpp/src/io/orc/timezone.cpp | 12 +- cpp/src/io/orc/writer_impl.cu | 27 ++- cpp/src/io/parquet/reader_impl_preprocess.cu | 16 +- cpp/src/io/parquet/writer_impl.cu | 12 +- cpp/src/io/utilities/column_buffer.cpp | 7 +- cpp/src/io/utilities/parsing_utils.cu | 8 +- cpp/src/io/utilities/trie.cu | 5 +- cpp/src/lists/dremel.cu | 3 +- cpp/src/merge/merge.cu | 6 +- cpp/src/partitioning/partitioning.cu | 8 +- cpp/src/quantiles/quantile.cu | 5 +- cpp/src/quantiles/quantiles.cu | 5 +- cpp/src/reductions/struct_minmax_util.cuh | 3 +- cpp/src/rolling/grouped_rolling.cu | 8 +- cpp/src/strings/convert/convert_datetime.cu | 3 +- cpp/src/strings/copying/concatenate.cu | 3 +- cpp/src/strings/filter_chars.cu | 5 +- cpp/src/strings/json/json_path.cu | 9 +- cpp/src/strings/replace/backref_re.cu | 8 +- cpp/src/strings/replace/multi_re.cu | 5 +- cpp/src/strings/translate.cu | 4 +- cpp/src/table/row_operators.cu | 14 +- cpp/src/transform/row_bit_count.cu | 5 +- cpp/tests/bitmask/bitmask_tests.cpp | 2 +- .../device_atomics/device_atomics_test.cu | 15 +- cpp/tests/fixed_point/fixed_point_tests.cu | 8 +- cpp/tests/io/nested_json_test.cpp | 34 ++- cpp/tests/io/parquet_test.cpp | 3 +- cpp/tests/io/type_inference_test.cu | 86 ++++---- cpp/tests/iterator/iterator_tests.cuh | 6 +- cpp/tests/iterator/value_iterator_test.cuh | 5 +- .../iterator/value_iterator_test_strings.cu | 20 +- .../partitioning/hash_partition_test.cpp | 4 +- .../reductions/segmented_reduction_tests.cpp | 206 +++++++++--------- cpp/tests/scalar/scalar_device_view_test.cu | 5 +- cpp/tests/strings/contains_tests.cpp | 8 +- cpp/tests/strings/factories_test.cu | 18 +- cpp/tests/strings/integers_tests.cpp | 5 +- cpp/tests/table/table_view_tests.cu | 6 +- cpp/tests/types/type_dispatcher_test.cu | 8 +- cpp/tests/utilities/tdigest_utilities.cu | 12 +- cpp/tests/utilities_tests/span_tests.cu | 6 +- java/src/main/native/src/row_conversion.cu | 62 ++++-- 67 files changed, 547 insertions(+), 429 deletions(-) diff --git a/cpp/benchmarks/iterator/iterator.cu b/cpp/benchmarks/iterator/iterator.cu index 73060200d00..1b1cf9b7e9d 100644 --- a/cpp/benchmarks/iterator/iterator.cu +++ b/cpp/benchmarks/iterator/iterator.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -140,8 +140,8 @@ void BM_iterator(benchmark::State& state) cudf::column_view hasnull_F = wrap_hasnull_F; // Initialize dev_result to false - auto dev_result = - cudf::detail::make_zeroed_device_uvector_sync(1, cudf::get_default_stream()); + auto dev_result = cudf::detail::make_zeroed_device_uvector_sync( + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); for (auto _ : state) { cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0 if (cub_or_thrust) { @@ -210,7 +210,7 @@ void BM_pair_iterator(benchmark::State& state) // Initialize dev_result to false auto dev_result = cudf::detail::make_zeroed_device_uvector_sync>( - 1, cudf::get_default_stream()); + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); for (auto _ : state) { cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0 if (cub_or_thrust) { diff --git a/cpp/include/cudf/detail/gather.cuh b/cpp/include/cudf/detail/gather.cuh index ac2865c05c5..5460a0e5a76 100644 --- a/cpp/include/cudf/detail/gather.cuh +++ b/cpp/include/cudf/detail/gather.cuh @@ -583,10 +583,12 @@ void gather_bitmask(table_view const& source, std::transform(target.begin(), target.end(), target_masks.begin(), [](auto const& col) { return col->mutable_view().null_mask(); }); - auto d_target_masks = make_device_uvector_async(target_masks, stream); + auto d_target_masks = + make_device_uvector_async(target_masks, stream, rmm::mr::get_current_device_resource()); auto const device_source = table_device_view::create(source, stream); - auto d_valid_counts = make_zeroed_device_uvector_async(target.size(), stream); + auto d_valid_counts = make_zeroed_device_uvector_async( + target.size(), stream, rmm::mr::get_current_device_resource()); // Dispatch operation enum to get implementation auto const impl = [op]() { diff --git a/cpp/include/cudf/detail/null_mask.cuh b/cpp/include/cudf/detail/null_mask.cuh index cb9ced6fc28..ce2619d767e 100644 --- a/cpp/include/cudf/detail/null_mask.cuh +++ b/cpp/include/cudf/detail/null_mask.cuh @@ -426,7 +426,8 @@ std::vector segmented_count_bits(bitmask_type const* bitmask, // Construct a contiguous host buffer of indices and copy to device. auto const h_indices = std::vector(indices_begin, indices_end); - auto const d_indices = make_device_uvector_async(h_indices, stream); + auto const d_indices = + make_device_uvector_async(h_indices, stream, rmm::mr::get_current_device_resource()); // Compute the bit counts over each segment. auto first_bit_indices_begin = thrust::make_transform_iterator( diff --git a/cpp/include/cudf/detail/utilities/vector_factories.hpp b/cpp/include/cudf/detail/utilities/vector_factories.hpp index 75df0d92d0a..c446a7b5148 100644 --- a/cpp/include/cudf/detail/utilities/vector_factories.hpp +++ b/cpp/include/cudf/detail/utilities/vector_factories.hpp @@ -48,10 +48,9 @@ namespace detail { * @return A device_uvector containing zeros */ template -rmm::device_uvector make_zeroed_device_uvector_async( - std::size_t size, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_zeroed_device_uvector_async(std::size_t size, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { rmm::device_uvector ret(size, stream, mr); CUDF_CUDA_TRY(cudaMemsetAsync(ret.data(), 0, size * sizeof(T), stream.value())); @@ -70,10 +69,9 @@ rmm::device_uvector make_zeroed_device_uvector_async( * @return A device_uvector containing zeros */ template -rmm::device_uvector make_zeroed_device_uvector_sync( - std::size_t size, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_zeroed_device_uvector_sync(std::size_t size, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { rmm::device_uvector ret(size, stream, mr); CUDF_CUDA_TRY(cudaMemsetAsync(ret.data(), 0, size * sizeof(T), stream.value())); @@ -94,10 +92,9 @@ rmm::device_uvector make_zeroed_device_uvector_sync( * @return A device_uvector containing the copied data */ template -rmm::device_uvector make_device_uvector_async( - host_span source_data, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_device_uvector_async(host_span source_data, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { rmm::device_uvector ret(source_data.size(), stream, mr); CUDF_CUDA_TRY(cudaMemcpyAsync(ret.data(), @@ -126,9 +123,7 @@ template < std::enable_if_t< std::is_convertible_v>>* = nullptr> rmm::device_uvector make_device_uvector_async( - Container const& c, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) + Container const& c, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { return make_device_uvector_async(host_span{c}, stream, mr); } @@ -146,10 +141,9 @@ rmm::device_uvector make_device_uvector_async( * @return A device_uvector containing the copied data */ template -rmm::device_uvector make_device_uvector_async( - device_span source_data, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_device_uvector_async(device_span source_data, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { rmm::device_uvector ret(source_data.size(), stream, mr); CUDF_CUDA_TRY(cudaMemcpyAsync(ret.data(), @@ -178,9 +172,7 @@ template < std::enable_if_t< std::is_convertible_v>>* = nullptr> rmm::device_uvector make_device_uvector_async( - Container const& c, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) + Container const& c, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { return make_device_uvector_async( device_span{c}, stream, mr); @@ -199,10 +191,9 @@ rmm::device_uvector make_device_uvector_async( * @return A device_uvector containing the copied data */ template -rmm::device_uvector make_device_uvector_sync( - host_span source_data, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_device_uvector_sync(host_span source_data, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { auto ret = make_device_uvector_async(source_data, stream, mr); stream.synchronize(); @@ -227,9 +218,7 @@ template < std::enable_if_t< std::is_convertible_v>>* = nullptr> rmm::device_uvector make_device_uvector_sync( - Container const& c, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) + Container const& c, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { return make_device_uvector_sync(host_span{c}, stream, mr); } @@ -247,10 +236,9 @@ rmm::device_uvector make_device_uvector_sync( * @return A device_uvector containing the copied data */ template -rmm::device_uvector make_device_uvector_sync( - device_span source_data, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) +rmm::device_uvector make_device_uvector_sync(device_span source_data, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { auto ret = make_device_uvector_async(source_data, stream, mr); stream.synchronize(); @@ -275,9 +263,7 @@ template < std::enable_if_t< std::is_convertible_v>>* = nullptr> rmm::device_uvector make_device_uvector_sync( - Container const& c, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) + Container const& c, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { return make_device_uvector_sync(device_span{c}, stream, mr); } diff --git a/cpp/include/cudf/lists/lists_column_factories.hpp b/cpp/include/cudf/lists/lists_column_factories.hpp index a6eacb97e91..fea1118748c 100644 --- a/cpp/include/cudf/lists/lists_column_factories.hpp +++ b/cpp/include/cudf/lists/lists_column_factories.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, NVIDIA CORPORATION. + * Copyright (c) 2021-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,11 +35,10 @@ namespace detail { * @param[in] stream CUDA stream used for device memory operations and kernel launches. * @param[in] mr Device memory resource used to allocate the returned column's device memory. */ -std::unique_ptr make_lists_column_from_scalar( - list_scalar const& value, - size_type size, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); +std::unique_ptr make_lists_column_from_scalar(list_scalar const& value, + size_type size, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr); } // namespace detail } // namespace lists diff --git a/cpp/include/cudf/structs/detail/concatenate.hpp b/cpp/include/cudf/structs/detail/concatenate.hpp index a098703e4b0..82ccca188e2 100644 --- a/cpp/include/cudf/structs/detail/concatenate.hpp +++ b/cpp/include/cudf/structs/detail/concatenate.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,10 +48,9 @@ namespace detail { * @param mr Device memory resource used to allocate the returned column's device memory. * @return New column with concatenated results. */ -std::unique_ptr concatenate( - host_span columns, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); +std::unique_ptr concatenate(host_span columns, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr); } // namespace detail } // namespace structs diff --git a/cpp/include/cudf_test/column_wrapper.hpp b/cpp/include/cudf_test/column_wrapper.hpp index 91773b2c3f1..6341e2e10b0 100644 --- a/cpp/include/cudf_test/column_wrapper.hpp +++ b/cpp/include/cudf_test/column_wrapper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -732,9 +732,11 @@ class strings_column_wrapper : public detail::column_wrapper { { auto all_valid = thrust::make_constant_iterator(true); auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, all_valid); - auto d_chars = cudf::detail::make_device_uvector_sync(chars, cudf::get_default_stream()); - auto d_offsets = cudf::detail::make_device_uvector_sync(offsets, cudf::get_default_stream()); - wrapped = cudf::make_strings_column(d_chars, d_offsets); + auto d_chars = cudf::detail::make_device_uvector_sync( + chars, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_offsets = cudf::detail::make_device_uvector_sync( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + wrapped = cudf::make_strings_column(d_chars, d_offsets); } /** @@ -772,10 +774,13 @@ class strings_column_wrapper : public detail::column_wrapper { size_type num_strings = std::distance(begin, end); auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, v); auto null_mask = detail::make_null_mask_vector(v, v + num_strings); - auto d_chars = cudf::detail::make_device_uvector_sync(chars, cudf::get_default_stream()); - auto d_offsets = cudf::detail::make_device_uvector_sync(offsets, cudf::get_default_stream()); - auto d_bitmask = cudf::detail::make_device_uvector_sync(null_mask, cudf::get_default_stream()); - wrapped = cudf::make_strings_column(d_chars, d_offsets, d_bitmask); + auto d_chars = cudf::detail::make_device_uvector_sync( + chars, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_offsets = cudf::detail::make_device_uvector_sync( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_bitmask = cudf::detail::make_device_uvector_sync( + null_mask, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + wrapped = cudf::make_strings_column(d_chars, d_offsets, d_bitmask); } /** diff --git a/cpp/include/cudf_test/tdigest_utilities.cuh b/cpp/include/cudf_test/tdigest_utilities.cuh index ce45ad91be1..d23d7f29a6c 100644 --- a/cpp/include/cudf_test/tdigest_utilities.cuh +++ b/cpp/include/cudf_test/tdigest_utilities.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, NVIDIA CORPORATION. + * Copyright (c) 2022-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,7 +168,8 @@ void tdigest_minmax_compare(cudf::tdigest::tdigest_column_view const& tdv, // verify min/max thrust::host_vector> h_spans; h_spans.push_back({input_values.begin(), static_cast(input_values.size())}); - auto spans = cudf::detail::make_device_uvector_async(h_spans, cudf::get_default_stream()); + auto spans = cudf::detail::make_device_uvector_async( + h_spans, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto expected_min = cudf::make_fixed_width_column( data_type{type_id::FLOAT64}, spans.size(), mask_state::UNALLOCATED); diff --git a/cpp/src/copying/concatenate.cu b/cpp/src/copying/concatenate.cu index 5d36d70696c..6d6ef9fd7b0 100644 --- a/cpp/src/copying/concatenate.cu +++ b/cpp/src/copying/concatenate.cu @@ -76,7 +76,8 @@ auto create_device_views(host_span views, rmm::cuda_stream_vi std::back_inserter(device_views), [](auto const& col) { return *col; }); - auto d_views = make_device_uvector_async(device_views, stream); + auto d_views = + make_device_uvector_async(device_views, stream, rmm::mr::get_current_device_resource()); // Compute the partition offsets auto offsets = thrust::host_vector(views.size() + 1); @@ -87,7 +88,8 @@ auto create_device_views(host_span views, rmm::cuda_stream_vi std::next(offsets.begin()), [](auto const& col) { return col.size(); }, thrust::plus{}); - auto d_offsets = make_device_uvector_async(offsets, stream); + auto d_offsets = + make_device_uvector_async(offsets, stream, rmm::mr::get_current_device_resource()); auto const output_size = offsets.back(); return std::make_tuple( diff --git a/cpp/src/dictionary/detail/concatenate.cu b/cpp/src/dictionary/detail/concatenate.cu index d4f3a9ca495..bc54f65bbd3 100644 --- a/cpp/src/dictionary/detail/concatenate.cu +++ b/cpp/src/dictionary/detail/concatenate.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -114,7 +114,8 @@ struct compute_children_offsets_fn { [](auto lhs, auto rhs) { return offsets_pair{lhs.first + rhs.first, lhs.second + rhs.second}; }); - return cudf::detail::make_device_uvector_sync(offsets, stream); + return cudf::detail::make_device_uvector_sync( + offsets, stream, rmm::mr::get_current_device_resource()); } private: diff --git a/cpp/src/groupby/hash/groupby.cu b/cpp/src/groupby/hash/groupby.cu index 72ac6255549..f8203218760 100644 --- a/cpp/src/groupby/hash/groupby.cu +++ b/cpp/src/groupby/hash/groupby.cu @@ -481,7 +481,8 @@ void compute_single_pass_aggs(table_view const& keys, // prepare to launch kernel to do the actual aggregation auto d_sparse_table = mutable_table_device_view::create(sparse_table, stream); auto d_values = table_device_view::create(flattened_values, stream); - auto const d_aggs = cudf::detail::make_device_uvector_async(agg_kinds, stream); + auto const d_aggs = cudf::detail::make_device_uvector_async( + agg_kinds, stream, rmm::mr::get_current_device_resource()); auto const skip_key_rows_with_nulls = keys_have_nulls and include_null_keys == null_policy::EXCLUDE; diff --git a/cpp/src/groupby/sort/group_quantiles.cu b/cpp/src/groupby/sort/group_quantiles.cu index 90ca5a5c90e..a9edcfecbf7 100644 --- a/cpp/src/groupby/sort/group_quantiles.cu +++ b/cpp/src/groupby/sort/group_quantiles.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -156,7 +156,8 @@ std::unique_ptr group_quantiles(column_view const& values, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - auto dv_quantiles = cudf::detail::make_device_uvector_async(quantiles, stream); + auto dv_quantiles = cudf::detail::make_device_uvector_async( + quantiles, stream, rmm::mr::get_current_device_resource()); auto values_type = cudf::is_dictionary(values.type()) ? dictionary_column_view(values).keys().type() diff --git a/cpp/src/hash/unordered_multiset.cuh b/cpp/src/hash/unordered_multiset.cuh index c017fd43079..55036bec6a6 100644 --- a/cpp/src/hash/unordered_multiset.cuh +++ b/cpp/src/hash/unordered_multiset.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,10 +84,10 @@ class unordered_multiset { auto d_column = column_device_view::create(col, stream); auto d_col = *d_column; - auto hash_bins_start = - cudf::detail::make_zeroed_device_uvector_async(2 * d_col.size() + 1, stream); - auto hash_bins_end = - cudf::detail::make_zeroed_device_uvector_async(2 * d_col.size() + 1, stream); + auto hash_bins_start = cudf::detail::make_zeroed_device_uvector_async( + 2 * d_col.size() + 1, stream, rmm::mr::get_current_device_resource()); + auto hash_bins_end = cudf::detail::make_zeroed_device_uvector_async( + 2 * d_col.size() + 1, stream, rmm::mr::get_current_device_resource()); auto hash_data = rmm::device_uvector(d_col.size(), stream); Hasher hasher; diff --git a/cpp/src/io/avro/reader_impl.cu b/cpp/src/io/avro/reader_impl.cu index cd557ff166a..60a1b4263b2 100644 --- a/cpp/src/io/avro/reader_impl.cu +++ b/cpp/src/io/avro/reader_impl.cu @@ -444,7 +444,8 @@ std::vector decode_data(metadata& meta, } } - auto block_list = cudf::detail::make_device_uvector_async(meta.block_list, stream); + auto block_list = cudf::detail::make_device_uvector_async( + meta.block_list, stream, rmm::mr::get_current_device_resource()); schema_desc.host_to_device(stream); @@ -574,8 +575,10 @@ table_with_metadata read_avro(std::unique_ptr&& source, } } - d_global_dict = cudf::detail::make_device_uvector_async(h_global_dict, stream); - d_global_dict_data = cudf::detail::make_device_uvector_async(h_global_dict_data, stream); + d_global_dict = cudf::detail::make_device_uvector_async( + h_global_dict, stream, rmm::mr::get_current_device_resource()); + d_global_dict_data = cudf::detail::make_device_uvector_async( + h_global_dict_data, stream, rmm::mr::get_current_device_resource()); stream.synchronize(); } diff --git a/cpp/src/io/comp/uncomp.cpp b/cpp/src/io/comp/uncomp.cpp index 6778ddead28..008c7215cca 100644 --- a/cpp/src/io/comp/uncomp.cpp +++ b/cpp/src/io/comp/uncomp.cpp @@ -509,9 +509,10 @@ size_t decompress_zstd(host_span src, rmm::cuda_stream_view stream) { // Init device span of spans (source) - auto const d_src = cudf::detail::make_device_uvector_async(src, stream); - auto hd_srcs = hostdevice_vector>(1, stream); - hd_srcs[0] = d_src; + auto const d_src = + cudf::detail::make_device_uvector_async(src, stream, rmm::mr::get_current_device_resource()); + auto hd_srcs = hostdevice_vector>(1, stream); + hd_srcs[0] = d_src; hd_srcs.host_to_device(stream); // Init device span of spans (temporary destination) diff --git a/cpp/src/io/csv/csv_gpu.cu b/cpp/src/io/csv/csv_gpu.cu index 4f6f8162246..51e3783bac5 100644 --- a/cpp/src/io/csv/csv_gpu.cu +++ b/cpp/src/io/csv/csv_gpu.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -794,8 +794,8 @@ std::vector detect_column_types( const int block_size = csvparse_block_dim; const int grid_size = (row_starts.size() + block_size - 1) / block_size; - auto d_stats = - detail::make_zeroed_device_uvector_async(num_active_columns, stream); + auto d_stats = detail::make_zeroed_device_uvector_async( + num_active_columns, stream, rmm::mr::get_current_device_resource()); data_type_detection<<>>( options, data, column_flags, row_starts, d_stats); diff --git a/cpp/src/io/csv/reader_impl.cu b/cpp/src/io/csv/reader_impl.cu index 2e38ea7f4ab..9c1ff67d97c 100644 --- a/cpp/src/io/csv/reader_impl.cu +++ b/cpp/src/io/csv/reader_impl.cu @@ -523,13 +523,13 @@ void infer_column_types(parse_options const& parse_opts, }); if (num_inferred_columns == 0) { return; } - auto const column_stats = - cudf::io::csv::gpu::detect_column_types(parse_opts.view(), - data, - make_device_uvector_async(column_flags, stream), - row_offsets, - num_inferred_columns, - stream); + auto const column_stats = cudf::io::csv::gpu::detect_column_types( + parse_opts.view(), + data, + make_device_uvector_async(column_flags, stream, rmm::mr::get_current_device_resource()), + row_offsets, + num_inferred_columns, + stream); stream.synchronize(); auto inf_col_idx = 0; @@ -595,14 +595,15 @@ std::vector decode_data(parse_options const& parse_opts, h_valid[i] = out_buffers[i].null_mask(); } - cudf::io::csv::gpu::decode_row_column_data(parse_opts.view(), - data, - make_device_uvector_async(column_flags, stream), - row_offsets, - make_device_uvector_async(column_types, stream), - make_device_uvector_async(h_data, stream), - make_device_uvector_async(h_valid, stream), - stream); + cudf::io::csv::gpu::decode_row_column_data( + parse_opts.view(), + data, + make_device_uvector_async(column_flags, stream, rmm::mr::get_current_device_resource()), + row_offsets, + make_device_uvector_async(column_types, stream, rmm::mr::get_current_device_resource()), + make_device_uvector_async(h_data, stream, rmm::mr::get_current_device_resource()), + make_device_uvector_async(h_valid, stream, rmm::mr::get_current_device_resource()), + stream); return out_buffers; } diff --git a/cpp/src/io/json/experimental/read_json.cpp b/cpp/src/io/json/experimental/read_json.cpp index 70a0b66ebc6..c18b15708ab 100644 --- a/cpp/src/io/json/experimental/read_json.cpp +++ b/cpp/src/io/json/experimental/read_json.cpp @@ -80,7 +80,8 @@ rmm::device_uvector ingest_raw_input(host_span auto const uncomp_data = decompress(compression, buffer); return cudf::detail::make_device_uvector_sync( host_span{reinterpret_cast(uncomp_data.data()), uncomp_data.size()}, - stream); + stream, + rmm::mr::get_current_device_resource()); } } diff --git a/cpp/src/io/json/json_column.cu b/cpp/src/io/json/json_column.cu index d174cc8aca3..f4d65f37cdb 100644 --- a/cpp/src/io/json/json_column.cu +++ b/cpp/src/io/json/json_column.cu @@ -602,8 +602,10 @@ void make_device_json_column(device_span input, col.validity.data()}; } - auto d_ignore_vals = cudf::detail::make_device_uvector_async(ignore_vals, stream); - auto d_columns_data = cudf::detail::make_device_uvector_async(columns_data, stream); + auto d_ignore_vals = cudf::detail::make_device_uvector_async( + ignore_vals, stream, rmm::mr::get_current_device_resource()); + auto d_columns_data = cudf::detail::make_device_uvector_async( + columns_data, stream, rmm::mr::get_current_device_resource()); // 3. scatter string offsets to respective columns, set validity bits thrust::for_each_n( diff --git a/cpp/src/io/json/json_gpu.cu b/cpp/src/io/json/json_gpu.cu index 8b6c0f9d528..d1711db0484 100644 --- a/cpp/src/io/json/json_gpu.cu +++ b/cpp/src/io/json/json_gpu.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -578,7 +578,7 @@ std::vector detect_data_types( return d_column_infos; } else { return cudf::detail::make_zeroed_device_uvector_async( - num_columns, stream); + num_columns, stream, rmm::mr::get_current_device_resource()); } }(); diff --git a/cpp/src/io/json/nested_json_gpu.cu b/cpp/src/io/json/nested_json_gpu.cu index 30b3911089f..77749b42781 100644 --- a/cpp/src/io/json/nested_json_gpu.cu +++ b/cpp/src/io/json/nested_json_gpu.cu @@ -1597,9 +1597,11 @@ std::pair, std::vector> json_column_to // Move string_offsets and string_lengths to GPU rmm::device_uvector d_string_offsets = - cudf::detail::make_device_uvector_async(json_col.string_offsets, stream); + cudf::detail::make_device_uvector_async( + json_col.string_offsets, stream, rmm::mr::get_current_device_resource()); rmm::device_uvector d_string_lengths = - cudf::detail::make_device_uvector_async(json_col.string_lengths, stream); + cudf::detail::make_device_uvector_async( + json_col.string_lengths, stream, rmm::mr::get_current_device_resource()); // Prepare iterator that returns (string_offset, string_length)-tuples auto offset_length_it = diff --git a/cpp/src/io/json/reader_impl.cu b/cpp/src/io/json/reader_impl.cu index 6e1089796de..7ae8deb8055 100644 --- a/cpp/src/io/json/reader_impl.cu +++ b/cpp/src/io/json/reader_impl.cu @@ -340,8 +340,8 @@ rmm::device_uvector upload_data_to_device(json_reader_options const& reade "Error finding the record within the specified byte range.\n"); // Upload the raw data that is within the rows of interest - return cudf::detail::make_device_uvector_async(h_data.subspan(start_offset, bytes_to_upload), - stream); + return cudf::detail::make_device_uvector_async( + h_data.subspan(start_offset, bytes_to_upload), stream, rmm::mr::get_current_device_resource()); } std::pair, col_map_ptr_type> get_column_names_and_map( @@ -512,11 +512,14 @@ table_with_metadata convert_data_to_table(parse_options_view const& parse_opts, h_valid[i] = out_buffers[i].null_mask(); } - auto d_dtypes = cudf::detail::make_device_uvector_async(h_dtypes, stream); - auto d_data = cudf::detail::make_device_uvector_async(h_data, stream); - auto d_valid = cudf::detail::make_device_uvector_async(h_valid, stream); - auto d_valid_counts = - cudf::detail::make_zeroed_device_uvector_async(num_columns, stream); + auto d_dtypes = cudf::detail::make_device_uvector_async( + h_dtypes, stream, rmm::mr::get_current_device_resource()); + auto d_data = cudf::detail::make_device_uvector_async( + h_data, stream, rmm::mr::get_current_device_resource()); + auto d_valid = cudf::detail::make_device_uvector_async( + h_valid, stream, rmm::mr::get_current_device_resource()); + auto d_valid_counts = cudf::detail::make_zeroed_device_uvector_async( + num_columns, stream, rmm::mr::get_current_device_resource()); cudf::io::json::gpu::convert_json_to_columns( parse_opts, data, rec_starts, d_dtypes, column_map, d_data, d_valid, d_valid_counts, stream); @@ -530,13 +533,18 @@ table_with_metadata convert_data_to_table(parse_options_view const& parse_opts, auto repl_chars = std::vector{'"', '\\', '\t', '\r', '\b'}; auto repl_offsets = std::vector{0, 1, 2, 3, 4, 5}; - auto target = make_strings_column(cudf::detail::make_device_uvector_async(target_chars, stream), - cudf::detail::make_device_uvector_async(target_offsets, stream), - {}, - 0, - stream); - auto repl = make_strings_column(cudf::detail::make_device_uvector_async(repl_chars, stream), - cudf::detail::make_device_uvector_async(repl_offsets, stream), + auto target = + make_strings_column(cudf::detail::make_device_uvector_async( + target_chars, stream, rmm::mr::get_current_device_resource()), + cudf::detail::make_device_uvector_async( + target_offsets, stream, rmm::mr::get_current_device_resource()), + {}, + 0, + stream); + auto repl = make_strings_column(cudf::detail::make_device_uvector_async( + repl_chars, stream, rmm::mr::get_current_device_resource()), + cudf::detail::make_device_uvector_async( + repl_offsets, stream, rmm::mr::get_current_device_resource()), {}, 0, stream); @@ -617,7 +625,8 @@ table_with_metadata read_json(std::vector>& sources, auto d_data = rmm::device_uvector(0, stream); if (should_load_whole_source(reader_opts)) { - d_data = cudf::detail::make_device_uvector_async(h_data, stream); + d_data = cudf::detail::make_device_uvector_async( + h_data, stream, rmm::mr::get_current_device_resource()); } auto rec_starts = find_record_starts(reader_opts, h_data, d_data, stream); diff --git a/cpp/src/io/json/write_json.cu b/cpp/src/io/json/write_json.cu index b4bcb5548de..9e56b20114c 100644 --- a/cpp/src/io/json/write_json.cu +++ b/cpp/src/io/json/write_json.cu @@ -552,14 +552,16 @@ std::unique_ptr make_strings_column_from_host(host_span offsets(host_strings.size() + 1, 0); std::transform_inclusive_scan(host_strings.begin(), host_strings.end(), offsets.begin() + 1, std::plus{}, [](auto& str) { return str.size(); }); - auto d_offsets = cudf::detail::make_device_uvector_sync(offsets, stream); + auto d_offsets = + cudf::detail::make_device_uvector_sync(offsets, stream, rmm::mr::get_current_device_resource()); return cudf::make_strings_column( host_strings.size(), std::move(d_offsets), std::move(d_chars), {}, 0); } diff --git a/cpp/src/io/orc/reader_impl.cu b/cpp/src/io/orc/reader_impl.cu index 96eb20e1e66..bbc88a16c6a 100644 --- a/cpp/src/io/orc/reader_impl.cu +++ b/cpp/src/io/orc/reader_impl.cu @@ -576,8 +576,8 @@ void scan_null_counts(cudf::detail::hostdevice_2dvector const& prefix_sums_to_update.emplace_back(col_idx, prefix_sums[col_idx]); } } - auto const d_prefix_sums_to_update = - cudf::detail::make_device_uvector_async(prefix_sums_to_update, stream); + auto const d_prefix_sums_to_update = cudf::detail::make_device_uvector_async( + prefix_sums_to_update, stream, rmm::mr::get_current_device_resource()); thrust::for_each(rmm::exec_policy(stream), d_prefix_sums_to_update.begin(), @@ -1038,7 +1038,7 @@ table_with_metadata reader::impl::read(size_type skip_rows, selected_columns.levels[level].size(), [&]() { return cudf::detail::make_zeroed_device_uvector_async( - total_num_stripes, stream); + total_num_stripes, stream, rmm::mr::get_current_device_resource()); }); // Tracker for eventually deallocating compressed and uncompressed data @@ -1270,7 +1270,8 @@ table_with_metadata reader::impl::read(size_type skip_rows, }); if (buff_data.size()) { - auto const dev_buff_data = cudf::detail::make_device_uvector_async(buff_data, stream); + auto const dev_buff_data = cudf::detail::make_device_uvector_async( + buff_data, stream, rmm::mr::get_current_device_resource()); generate_offsets_for_list(dev_buff_data, stream); } } diff --git a/cpp/src/io/orc/timezone.cpp b/cpp/src/io/orc/timezone.cpp index 810dfe87320..416369cc3f0 100644 --- a/cpp/src/io/orc/timezone.cpp +++ b/cpp/src/io/orc/timezone.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, NVIDIA CORPORATION. + * Copyright (c) 2018-2023, 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,8 @@ #include +#include + #include #include @@ -461,9 +463,11 @@ timezone_table build_timezone_transition_table(std::string const& timezone_name, .count(); } - rmm::device_uvector d_ttimes = cudf::detail::make_device_uvector_async(ttimes, stream); - rmm::device_uvector d_offsets = cudf::detail::make_device_uvector_async(offsets, stream); - auto const gmt_offset = get_gmt_offset(ttimes, offsets, orc_utc_offset); + rmm::device_uvector d_ttimes = + cudf::detail::make_device_uvector_async(ttimes, stream, rmm::mr::get_current_device_resource()); + rmm::device_uvector d_offsets = cudf::detail::make_device_uvector_async( + offsets, stream, rmm::mr::get_current_device_resource()); + auto const gmt_offset = get_gmt_offset(ttimes, offsets, orc_utc_offset); stream.synchronize(); return {gmt_offset, std::move(d_ttimes), std::move(d_offsets)}; diff --git a/cpp/src/io/orc/writer_impl.cu b/cpp/src/io/orc/writer_impl.cu index 00b5c5428b1..1ee90bde1d2 100644 --- a/cpp/src/io/orc/writer_impl.cu +++ b/cpp/src/io/orc/writer_impl.cu @@ -418,7 +418,7 @@ void init_dictionaries(orc_table_view& orc_table, [&](auto& col_idx) { auto& str_column = orc_table.column(col_idx); return cudf::detail::make_zeroed_device_uvector_async( - str_column.size(), stream); + str_column.size(), stream, rmm::mr::get_current_device_resource()); }); // Create views of the temporary buffers in device memory @@ -428,7 +428,8 @@ void init_dictionaries(orc_table_view& orc_table, dict_indices.begin(), dict_indices.end(), std::back_inserter(dict_indices_views), [](auto& di) { return device_span{di}; }); - auto d_dict_indices_views = cudf::detail::make_device_uvector_async(dict_indices_views, stream); + auto d_dict_indices_views = cudf::detail::make_device_uvector_async( + dict_indices_views, stream, rmm::mr::get_current_device_resource()); gpu::InitDictionaryIndices(orc_table.d_columns, *dict, @@ -772,7 +773,8 @@ std::vector> calculate_aligned_rowgroup_bounds( aligned_rgs.count() * sizeof(rowgroup_rows), cudaMemcpyDefault, stream.value())); - auto const d_stripes = cudf::detail::make_device_uvector_async(segmentation.stripes, stream); + auto const d_stripes = cudf::detail::make_device_uvector_async( + segmentation.stripes, stream, rmm::mr::get_current_device_resource()); // One thread per column, per stripe thrust::for_each_n( @@ -1675,7 +1677,8 @@ pushdown_null_masks init_pushdown_null_masks(orc_table_view& orc_table, } // Attach null masks to device column views (async) - auto const d_mask_ptrs = cudf::detail::make_device_uvector_async(mask_ptrs, stream); + auto const d_mask_ptrs = cudf::detail::make_device_uvector_async( + mask_ptrs, stream, rmm::mr::get_current_device_resource()); thrust::for_each_n( rmm::exec_policy(stream), thrust::make_counting_iterator(0ul), @@ -1765,7 +1768,8 @@ orc_table_view make_orc_table_view(table_view const& table, orc_columns.cbegin(), orc_columns.cend(), std::back_inserter(type_kinds), [](auto& orc_column) { return orc_column.orc_kind(); }); - auto const d_type_kinds = cudf::detail::make_device_uvector_async(type_kinds, stream); + auto const d_type_kinds = cudf::detail::make_device_uvector_async( + type_kinds, stream, rmm::mr::get_current_device_resource()); rmm::device_uvector d_orc_columns(orc_columns.size(), stream); using stack_value_type = thrust::pair>; @@ -1815,7 +1819,8 @@ orc_table_view make_orc_table_view(table_view const& table, return {std::move(orc_columns), std::move(d_orc_columns), str_col_indexes, - cudf::detail::make_device_uvector_sync(str_col_indexes, stream)}; + cudf::detail::make_device_uvector_sync( + str_col_indexes, stream, rmm::mr::get_current_device_resource())}; } hostdevice_2dvector calculate_rowgroup_bounds(orc_table_view const& orc_table, @@ -1983,7 +1988,7 @@ string_dictionaries allocate_dictionaries(orc_table_view const& orc_table, std::back_inserter(data), [&](auto& idx) { return cudf::detail::make_zeroed_device_uvector_async( - orc_table.columns[idx].size(), stream); + orc_table.columns[idx].size(), stream, rmm::mr::get_current_device_resource()); }); std::vector> index; std::transform(orc_table.string_column_indices.begin(), @@ -1991,7 +1996,7 @@ string_dictionaries allocate_dictionaries(orc_table_view const& orc_table, std::back_inserter(index), [&](auto& idx) { return cudf::detail::make_zeroed_device_uvector_async( - orc_table.columns[idx].size(), stream); + orc_table.columns[idx].size(), stream, rmm::mr::get_current_device_resource()); }); stream.synchronize(); @@ -2006,8 +2011,10 @@ string_dictionaries allocate_dictionaries(orc_table_view const& orc_table, return {std::move(data), std::move(index), - cudf::detail::make_device_uvector_sync(data_ptrs, stream), - cudf::detail::make_device_uvector_sync(index_ptrs, stream), + cudf::detail::make_device_uvector_sync( + data_ptrs, stream, rmm::mr::get_current_device_resource()), + cudf::detail::make_device_uvector_sync( + index_ptrs, stream, rmm::mr::get_current_device_resource()), std::move(is_dict_enabled)}; } diff --git a/cpp/src/io/parquet/reader_impl_preprocess.cu b/cpp/src/io/parquet/reader_impl_preprocess.cu index 6b5d4ba3640..e5c2b7aa842 100644 --- a/cpp/src/io/parquet/reader_impl_preprocess.cu +++ b/cpp/src/io/parquet/reader_impl_preprocess.cu @@ -468,10 +468,12 @@ void decode_page_headers(hostdevice_vector& chunks, host_span const> comp_in_view{comp_in.data() + start_pos, codec.num_pages}; - auto const d_comp_in = cudf::detail::make_device_uvector_async(comp_in_view, stream); + auto const d_comp_in = cudf::detail::make_device_uvector_async( + comp_in_view, stream, rmm::mr::get_current_device_resource()); host_span const> comp_out_view(comp_out.data() + start_pos, codec.num_pages); - auto const d_comp_out = cudf::detail::make_device_uvector_async(comp_out_view, stream); + auto const d_comp_out = cudf::detail::make_device_uvector_async( + comp_out_view, stream, rmm::mr::get_current_device_resource()); device_span d_comp_res_view(comp_res.data() + start_pos, codec.num_pages); switch (codec.compression_type) { @@ -523,8 +525,10 @@ void decode_page_headers(hostdevice_vector& chunks, // now copy the uncompressed V2 def and rep level data if (not copy_in.empty()) { - auto const d_copy_in = cudf::detail::make_device_uvector_async(copy_in, stream); - auto const d_copy_out = cudf::detail::make_device_uvector_async(copy_out, stream); + auto const d_copy_in = cudf::detail::make_device_uvector_async( + copy_in, stream, rmm::mr::get_current_device_resource()); + auto const d_copy_out = cudf::detail::make_device_uvector_async( + copy_out, stream, rmm::mr::get_current_device_resource()); gpu_copy_uncompressed_blocks(d_copy_in, d_copy_out, stream); stream.synchronize(); @@ -1489,8 +1493,8 @@ void reader::impl::preprocess_pages(size_t skip_rows, // Build index for string dictionaries since they can't be indexed // directly due to variable-sized elements _chunk_itm_data.str_dict_index = - cudf::detail::make_zeroed_device_uvector_async(total_str_dict_indexes, - _stream); + cudf::detail::make_zeroed_device_uvector_async( + total_str_dict_indexes, _stream, rmm::mr::get_current_device_resource()); // Update chunks with pointers to string dict indices for (size_t c = 0, page_count = 0, str_ofs = 0; c < chunks.size(); c++) { diff --git a/cpp/src/io/parquet/writer_impl.cu b/cpp/src/io/parquet/writer_impl.cu index 5f407b5e774..e6e14908f36 100644 --- a/cpp/src/io/parquet/writer_impl.cu +++ b/cpp/src/io/parquet/writer_impl.cu @@ -853,7 +853,8 @@ parquet_column_view::parquet_column_view(schema_tree_node const& schema_node, _nullability = std::vector(r_nullability.crbegin(), r_nullability.crend()); // TODO(cp): Explore doing this for all columns in a single go outside this ctor. Maybe using // hostdevice_vector. Currently this involves a cudaMemcpyAsync for each column. - _d_nullability = cudf::detail::make_device_uvector_async(_nullability, stream); + _d_nullability = cudf::detail::make_device_uvector_async( + _nullability, stream, rmm::mr::get_current_device_resource()); _is_list = (_max_rep_level > 0); @@ -928,7 +929,8 @@ void writer::impl::init_row_group_fragments( device_span part_frag_offset, uint32_t fragment_size) { - auto d_partitions = cudf::detail::make_device_uvector_async(partitions, stream); + auto d_partitions = cudf::detail::make_device_uvector_async( + partitions, stream, rmm::mr::get_current_device_resource()); gpu::InitRowGroupFragments(frag, col_desc, d_partitions, part_frag_offset, fragment_size, stream); frag.device_to_host(stream, true); } @@ -936,7 +938,8 @@ void writer::impl::init_row_group_fragments( void writer::impl::calculate_page_fragments(device_span frag, host_span frag_sizes) { - auto d_frag_sz = cudf::detail::make_device_uvector_async(frag_sizes, stream); + auto d_frag_sz = cudf::detail::make_device_uvector_async( + frag_sizes, stream, rmm::mr::get_current_device_resource()); gpu::CalculatePageFragments(frag, d_frag_sz, stream); } @@ -1507,7 +1510,8 @@ void writer::impl::write(table_view const& table, std::vector co num_frag_in_part.begin(), num_frag_in_part.end(), std::back_inserter(part_frag_offset), 0); part_frag_offset.push_back(part_frag_offset.back() + num_frag_in_part.back()); - auto d_part_frag_offset = cudf::detail::make_device_uvector_async(part_frag_offset, stream); + auto d_part_frag_offset = cudf::detail::make_device_uvector_async( + part_frag_offset, stream, rmm::mr::get_current_device_resource()); cudf::detail::hostdevice_2dvector row_group_fragments( num_columns, num_fragments, stream); diff --git a/cpp/src/io/utilities/column_buffer.cpp b/cpp/src/io/utilities/column_buffer.cpp index 6c14975101c..430d7c4a26d 100644 --- a/cpp/src/io/utilities/column_buffer.cpp +++ b/cpp/src/io/utilities/column_buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, NVIDIA CORPORATION. + * Copyright (c) 2021-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ #include #include +#include + namespace cudf { namespace io { namespace detail { @@ -43,7 +45,8 @@ void column_buffer::create(size_type _size, // make_zeroed_device_uvector_async here and instead let it use the // default rmm memory resource. _strings = std::make_unique>( - cudf::detail::make_zeroed_device_uvector_async(size, stream)); + cudf::detail::make_zeroed_device_uvector_async( + size, stream, rmm::mr::get_current_device_resource())); break; // list columns store a buffer of int32's as offsets to represent diff --git a/cpp/src/io/utilities/parsing_utils.cu b/cpp/src/io/utilities/parsing_utils.cu index a03789464cc..5c5cbd1c01d 100644 --- a/cpp/src/io/utilities/parsing_utils.cu +++ b/cpp/src/io/utilities/parsing_utils.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,7 +126,8 @@ cudf::size_type find_all_from_set(device_span data, cudaOccupancyMaxPotentialBlockSize(&min_grid_size, &block_size, count_and_set_positions)); const int grid_size = divCeil(data.size(), (size_t)block_size); - auto d_count = cudf::detail::make_zeroed_device_uvector_async(1, stream); + auto d_count = cudf::detail::make_zeroed_device_uvector_async( + 1, stream, rmm::mr::get_current_device_resource()); for (char key : keys) { count_and_set_positions<<>>( data.data(), data.size(), result_offset, key, d_count.data(), positions); @@ -143,7 +144,8 @@ cudf::size_type find_all_from_set(host_span data, rmm::cuda_stream_view stream) { rmm::device_buffer d_chunk(std::min(max_chunk_bytes, data.size()), stream); - auto d_count = cudf::detail::make_zeroed_device_uvector_async(1, stream); + auto d_count = cudf::detail::make_zeroed_device_uvector_async( + 1, stream, rmm::mr::get_current_device_resource()); int block_size = 0; // suggested thread count to use int min_grid_size = 0; // minimum block count required diff --git a/cpp/src/io/utilities/trie.cu b/cpp/src/io/utilities/trie.cu index bf03d6a6a89..e2ace7258f7 100644 --- a/cpp/src/io/utilities/trie.cu +++ b/cpp/src/io/utilities/trie.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,7 +101,8 @@ rmm::device_uvector create_serialized_trie(const std::vector rep_level(max_vals_size, stream); rmm::device_uvector def_level(max_vals_size, stream); diff --git a/cpp/src/merge/merge.cu b/cpp/src/merge/merge.cu index ec0cc5af44d..83ee6793efb 100644 --- a/cpp/src/merge/merge.cu +++ b/cpp/src/merge/merge.cu @@ -187,10 +187,12 @@ index_vector generate_merged_indices(table_view const& left_table, auto lhs_device_view = table_device_view::create(left_table, stream); auto rhs_device_view = table_device_view::create(right_table, stream); - auto d_column_order = cudf::detail::make_device_uvector_async(column_order, stream); + auto d_column_order = cudf::detail::make_device_uvector_async( + column_order, stream, rmm::mr::get_current_device_resource()); if (nullable) { - auto d_null_precedence = cudf::detail::make_device_uvector_async(null_precedence, stream); + auto d_null_precedence = cudf::detail::make_device_uvector_async( + null_precedence, stream, rmm::mr::get_current_device_resource()); auto ineq_op = detail::row_lexicographic_tagged_comparator( *lhs_device_view, *rhs_device_view, d_column_order.data(), d_null_precedence.data()); diff --git a/cpp/src/partitioning/partitioning.cu b/cpp/src/partitioning/partitioning.cu index 54dffc85aca..13f46195392 100644 --- a/cpp/src/partitioning/partitioning.cu +++ b/cpp/src/partitioning/partitioning.cu @@ -493,11 +493,11 @@ std::pair, std::vector> hash_partition_table( rmm::device_uvector(grid_size * num_partitions, stream); // Holds the total number of rows in each partition - auto global_partition_sizes = - cudf::detail::make_zeroed_device_uvector_async(num_partitions, stream); + auto global_partition_sizes = cudf::detail::make_zeroed_device_uvector_async( + num_partitions, stream, rmm::mr::get_current_device_resource()); - auto row_partition_offset = - cudf::detail::make_zeroed_device_uvector_async(num_rows, stream); + auto row_partition_offset = cudf::detail::make_zeroed_device_uvector_async( + num_rows, stream, rmm::mr::get_current_device_resource()); auto const row_hasher = experimental::row::hash::row_hasher(table_to_hash, stream); auto const hasher = diff --git a/cpp/src/quantiles/quantile.cu b/cpp/src/quantiles/quantile.cu index 785aa839956..4a9c2e3a902 100644 --- a/cpp/src/quantiles/quantile.cu +++ b/cpp/src/quantiles/quantile.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,8 @@ struct quantile_functor { auto d_input = column_device_view::create(input, stream); auto d_output = mutable_column_device_view::create(output->mutable_view(), stream); - auto q_device = cudf::detail::make_device_uvector_sync(q, stream); + auto q_device = + cudf::detail::make_device_uvector_sync(q, stream, rmm::mr::get_current_device_resource()); if (!cudf::is_dictionary(input.type())) { auto sorted_data = diff --git a/cpp/src/quantiles/quantiles.cu b/cpp/src/quantiles/quantiles.cu index e71508bab09..c6760e77403 100644 --- a/cpp/src/quantiles/quantiles.cu +++ b/cpp/src/quantiles/quantiles.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,8 @@ std::unique_ptr quantiles(table_view const& input, return detail::select_quantile(selector, size, q, interp); }; - auto const q_device = cudf::detail::make_device_uvector_async(q, stream); + auto const q_device = + cudf::detail::make_device_uvector_async(q, stream, rmm::mr::get_current_device_resource()); auto quantile_idx_iter = thrust::make_transform_iterator(q_device.begin(), quantile_idx_lookup); diff --git a/cpp/src/reductions/struct_minmax_util.cuh b/cpp/src/reductions/struct_minmax_util.cuh index 796d10a3477..b2106066ff2 100644 --- a/cpp/src/reductions/struct_minmax_util.cuh +++ b/cpp/src/reductions/struct_minmax_util.cuh @@ -118,7 +118,8 @@ class comparison_binop_generator { // level structs column (which is stored at the first position in the null_orders array) to // achieve this purpose. if (input.has_nulls()) { null_orders.front() = cudf::null_order::AFTER; } - null_orders_dvec = cudf::detail::make_device_uvector_async(null_orders, stream); + null_orders_dvec = cudf::detail::make_device_uvector_async( + null_orders, stream, rmm::mr::get_current_device_resource()); } // else: Don't need to generate nulls order to copy to device memory if we have all null orders // are BEFORE (that happens when we have is_min_op == false). diff --git a/cpp/src/rolling/grouped_rolling.cu b/cpp/src/rolling/grouped_rolling.cu index 2b4b6373c35..b208e7cd980 100644 --- a/cpp/src/rolling/grouped_rolling.cu +++ b/cpp/src/rolling/grouped_rolling.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -467,8 +467,10 @@ get_null_bounds_for_orderby_column(column_view const& orderby_column, cudf::device_span(group_offsets.data(), num_groups); // When there are no nulls, just copy the input group offsets to the output. - return std::make_tuple(cudf::detail::make_device_uvector_async(group_offsets_span, stream), - cudf::detail::make_device_uvector_async(group_offsets_span, stream)); + return std::make_tuple(cudf::detail::make_device_uvector_async( + group_offsets_span, stream, rmm::mr::get_current_device_resource()), + cudf::detail::make_device_uvector_async( + group_offsets_span, stream, rmm::mr::get_current_device_resource())); } } diff --git a/cpp/src/strings/convert/convert_datetime.cu b/cpp/src/strings/convert/convert_datetime.cu index 177fcab03f9..8d273eff4bb 100644 --- a/cpp/src/strings/convert/convert_datetime.cu +++ b/cpp/src/strings/convert/convert_datetime.cu @@ -160,7 +160,8 @@ struct format_compiler { } // copy format_items to device memory - d_items = cudf::detail::make_device_uvector_async(items, stream); + d_items = cudf::detail::make_device_uvector_async( + items, stream, rmm::mr::get_current_device_resource()); } device_span format_items() { return device_span(d_items); } diff --git a/cpp/src/strings/copying/concatenate.cu b/cpp/src/strings/copying/concatenate.cu index e3ee59c631f..92b71d128e1 100644 --- a/cpp/src/strings/copying/concatenate.cu +++ b/cpp/src/strings/copying/concatenate.cu @@ -85,7 +85,8 @@ auto create_strings_device_views(host_span views, rmm::cuda_s return static_cast(col.size()); }); thrust::inclusive_scan(thrust::host, offset_it, input_offsets.end(), offset_it); - auto d_input_offsets = cudf::detail::make_device_uvector_async(input_offsets, stream); + auto d_input_offsets = cudf::detail::make_device_uvector_async( + input_offsets, stream, rmm::mr::get_current_device_resource()); auto const output_size = input_offsets.back(); // Compute the partition offsets and size of chars column diff --git a/cpp/src/strings/filter_chars.cu b/cpp/src/strings/filter_chars.cu index 8a6a4d44b1e..3e38b5fa775 100644 --- a/cpp/src/strings/filter_chars.cu +++ b/cpp/src/strings/filter_chars.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -132,7 +132,8 @@ std::unique_ptr filter_characters( characters_to_filter.begin(), characters_to_filter.end(), htable.begin(), [](auto entry) { return char_range{entry.first, entry.second}; }); - rmm::device_uvector table = cudf::detail::make_device_uvector_async(htable, stream); + rmm::device_uvector table = + cudf::detail::make_device_uvector_async(htable, stream, rmm::mr::get_current_device_resource()); auto d_strings = column_device_view::create(strings.parent(), stream); diff --git a/cpp/src/strings/json/json_path.cu b/cpp/src/strings/json/json_path.cu index c6ea47ec0f3..128d450cbe8 100644 --- a/cpp/src/strings/json/json_path.cu +++ b/cpp/src/strings/json/json_path.cu @@ -673,11 +673,10 @@ std::pair>, int> build_comma } while (op.type != path_operator_type::END); auto const is_empty = h_operators.size() == 1 && h_operators[0].type == path_operator_type::END; - return is_empty - ? std::pair(thrust::nullopt, 0) - : std::pair( - thrust::make_optional(cudf::detail::make_device_uvector_sync(h_operators, stream)), - max_stack_depth); + return is_empty ? std::pair(thrust::nullopt, 0) + : std::pair(thrust::make_optional(cudf::detail::make_device_uvector_sync( + h_operators, stream, rmm::mr::get_current_device_resource())), + max_stack_depth); } #define PARSE_TRY(_x) \ diff --git a/cpp/src/strings/replace/backref_re.cu b/cpp/src/strings/replace/backref_re.cu index 383337c9088..d25af8c8931 100644 --- a/cpp/src/strings/replace/backref_re.cu +++ b/cpp/src/strings/replace/backref_re.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,9 +118,9 @@ std::unique_ptr replace_with_backrefs(strings_column_view const& input, // parse the repl string for back-ref indicators auto group_count = std::min(99, d_prog->group_counts()); // group count should NOT exceed 99 - auto const parse_result = parse_backrefs(replacement, group_count); - rmm::device_uvector backrefs = - cudf::detail::make_device_uvector_async(parse_result.second, stream); + auto const parse_result = parse_backrefs(replacement, group_count); + rmm::device_uvector backrefs = cudf::detail::make_device_uvector_async( + parse_result.second, stream, rmm::mr::get_current_device_resource()); string_scalar repl_scalar(parse_result.first, true, stream); string_view const d_repl_template = repl_scalar.value(); diff --git a/cpp/src/strings/replace/multi_re.cu b/cpp/src/strings/replace/multi_re.cu index f3bc7fc82ec..50b2dc27671 100644 --- a/cpp/src/strings/replace/multi_re.cu +++ b/cpp/src/strings/replace/multi_re.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -169,7 +169,8 @@ std::unique_ptr replace_re(strings_column_view const& input, prog->set_working_memory(d_buffer, size); return *prog; }); - auto d_progs = cudf::detail::make_device_uvector_async(progs, stream); + auto d_progs = + cudf::detail::make_device_uvector_async(progs, stream, rmm::mr::get_current_device_resource()); auto const d_strings = column_device_view::create(input.parent(), stream); auto const d_repls = column_device_view::create(replacements.parent(), stream); diff --git a/cpp/src/strings/translate.cu b/cpp/src/strings/translate.cu index 7f134059ded..e7b637c52f3 100644 --- a/cpp/src/strings/translate.cu +++ b/cpp/src/strings/translate.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ std::unique_ptr translate(strings_column_view const& strings, }); // copy translate table to device memory rmm::device_uvector table = - cudf::detail::make_device_uvector_async(htable, stream); + cudf::detail::make_device_uvector_async(htable, stream, rmm::mr::get_current_device_resource()); auto d_strings = column_device_view::create(strings.parent(), stream); diff --git a/cpp/src/table/row_operators.cu b/cpp/src/table/row_operators.cu index 8a63a6f6411..ae49ad17e53 100644 --- a/cpp/src/table/row_operators.cu +++ b/cpp/src/table/row_operators.cu @@ -268,7 +268,8 @@ auto list_lex_preprocess(table_view table, rmm::cuda_stream_view stream) dremel_device_views.push_back(dremel_data.back()); } } - auto d_dremel_device_views = detail::make_device_uvector_sync(dremel_device_views, stream); + auto d_dremel_device_views = detail::make_device_uvector_sync( + dremel_device_views, stream, rmm::mr::get_current_device_resource()); return std::make_tuple(std::move(dremel_data), std::move(d_dremel_device_views)); } @@ -355,10 +356,13 @@ std::shared_ptr preprocessed_table::create( auto [verticalized_lhs, new_column_order, new_null_precedence, verticalized_col_depths] = decompose_structs(t, column_order, null_precedence); - auto d_t = table_device_view::create(verticalized_lhs, stream); - auto d_column_order = detail::make_device_uvector_async(new_column_order, stream); - auto d_null_precedence = detail::make_device_uvector_async(new_null_precedence, stream); - auto d_depths = detail::make_device_uvector_async(verticalized_col_depths, stream); + auto d_t = table_device_view::create(verticalized_lhs, stream); + auto d_column_order = detail::make_device_uvector_async( + new_column_order, stream, rmm::mr::get_current_device_resource()); + auto d_null_precedence = detail::make_device_uvector_async( + new_null_precedence, stream, rmm::mr::get_current_device_resource()); + auto d_depths = detail::make_device_uvector_async( + verticalized_col_depths, stream, rmm::mr::get_current_device_resource()); if (detail::has_nested_columns(t)) { auto [dremel_data, d_dremel_device_view] = list_lex_preprocess(verticalized_lhs, stream); diff --git a/cpp/src/transform/row_bit_count.cu b/cpp/src/transform/row_bit_count.cu index 634fdd70831..b982a010e6e 100644 --- a/cpp/src/transform/row_bit_count.cu +++ b/cpp/src/transform/row_bit_count.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, NVIDIA CORPORATION. + * Copyright (c) 2021-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -500,7 +500,8 @@ std::unique_ptr row_bit_count(table_view const& t, auto d_cols = contiguous_copy_column_device_views(cols, stream); // move stack info to the gpu - rmm::device_uvector d_info = cudf::detail::make_device_uvector_async(info, stream); + rmm::device_uvector d_info = + cudf::detail::make_device_uvector_async(info, stream, rmm::mr::get_current_device_resource()); // each thread needs to maintain a stack of row spans of size max_branch_depth. we will use // shared memory to do this rather than allocating a potentially gigantic temporary buffer diff --git a/cpp/tests/bitmask/bitmask_tests.cpp b/cpp/tests/bitmask/bitmask_tests.cpp index 00ec7bd218b..7805828ad55 100644 --- a/cpp/tests/bitmask/bitmask_tests.cpp +++ b/cpp/tests/bitmask/bitmask_tests.cpp @@ -87,7 +87,7 @@ rmm::device_uvector make_mask(cudf::size_type size, bool fil { if (!fill_valid) { return cudf::detail::make_zeroed_device_uvector_sync( - size, cudf::get_default_stream()); + size, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); } else { auto ret = rmm::device_uvector(size, cudf::get_default_stream()); CUDF_CUDA_TRY(cudaMemsetAsync(ret.data(), diff --git a/cpp/tests/device_atomics/device_atomics_test.cu b/cpp/tests/device_atomics/device_atomics_test.cu index 43874b84114..5694513647b 100644 --- a/cpp/tests/device_atomics/device_atomics_test.cu +++ b/cpp/tests/device_atomics/device_atomics_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, NVIDIA CORPORATION. + * Copyright (c) 2021-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -141,9 +141,10 @@ struct AtomicsTest : public cudf::test::BaseFixture { result_init[4] = result_init[1]; result_init[5] = result_init[2]; - auto dev_data = cudf::detail::make_device_uvector_sync(v, cudf::get_default_stream()); - auto dev_result = - cudf::detail::make_device_uvector_sync(result_init, cudf::get_default_stream()); + auto dev_data = cudf::detail::make_device_uvector_sync( + v, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto dev_result = cudf::detail::make_device_uvector_sync( + result_init, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); if (block_size == 0) { block_size = vec_size; } @@ -294,8 +295,10 @@ struct AtomicsBitwiseOpTest : public cudf::test::BaseFixture { exact[2] = std::accumulate( v.begin(), v.end(), identity[2], [](T acc, uint64_t i) { return acc ^ T(i); }); - auto dev_result = cudf::detail::make_device_uvector_sync(identity, cudf::get_default_stream()); - auto dev_data = cudf::detail::make_device_uvector_sync(v, cudf::get_default_stream()); + auto dev_result = cudf::detail::make_device_uvector_sync( + identity, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto dev_data = cudf::detail::make_device_uvector_sync( + v, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); if (block_size == 0) { block_size = vec_size; } diff --git a/cpp/tests/fixed_point/fixed_point_tests.cu b/cpp/tests/fixed_point/fixed_point_tests.cu index ab9970dc370..9631e433a5e 100644 --- a/cpp/tests/fixed_point/fixed_point_tests.cu +++ b/cpp/tests/fixed_point/fixed_point_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,8 @@ TEST_F(FixedPointTest, DecimalXXThrustOnDevice) using decimal32 = fixed_point; std::vector vec1(1000, decimal32{1, scale_type{-2}}); - auto d_vec1 = cudf::detail::make_device_uvector_sync(vec1, cudf::get_default_stream()); + auto d_vec1 = cudf::detail::make_device_uvector_sync( + vec1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const sum = thrust::reduce(rmm::exec_policy(cudf::get_default_stream()), std::cbegin(d_vec1), @@ -96,7 +97,8 @@ TEST_F(FixedPointTest, DecimalXXThrustOnDevice) // change inclusive scan to run on device (avoid copying to host) thrust::inclusive_scan(std::cbegin(vec1), std::cend(vec1), std::begin(vec1)); - d_vec1 = cudf::detail::make_device_uvector_sync(vec1, cudf::get_default_stream()); + d_vec1 = cudf::detail::make_device_uvector_sync( + vec1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); std::vector vec2(1000); std::iota(std::begin(vec2), std::end(vec2), 1); diff --git a/cpp/tests/io/nested_json_test.cpp b/cpp/tests/io/nested_json_test.cpp index 3c01bd4de25..8af530b0002 100644 --- a/cpp/tests/io/nested_json_test.cpp +++ b/cpp/tests/io/nested_json_test.cpp @@ -470,7 +470,9 @@ TEST_P(JsonParserTest, ExtractColumn) std::string const input = R"( [{"a":0.0, "b":1.0}, {"a":0.1, "b":1.1}, {"a":0.2, "b":1.2}] )"; auto const d_input = cudf::detail::make_device_uvector_async( - cudf::host_span{input.c_str(), input.size()}, stream); + cudf::host_span{input.c_str(), input.size()}, + stream, + rmm::mr::get_current_device_resource()); // Get the JSON's tree representation auto const cudf_table = json_parser(d_input, default_options, stream, mr); @@ -508,7 +510,9 @@ TEST_P(JsonParserTest, UTF_JSON) {"a":1,"b":null,"c":null}, {"a":1,"b":Infinity,"c":[null], "d": {"year":-600,"author": "Kaniyan"}}])"; auto const d_ascii_pass = cudf::detail::make_device_uvector_sync( - cudf::host_span{ascii_pass.c_str(), ascii_pass.size()}, stream); + cudf::host_span{ascii_pass.c_str(), ascii_pass.size()}, + stream, + rmm::mr::get_current_device_resource()); CUDF_EXPECT_NO_THROW(json_parser(d_ascii_pass, default_options, stream, mr)); @@ -521,7 +525,9 @@ TEST_P(JsonParserTest, UTF_JSON) {"a":1,"b":null,"c":null}, {"a":1,"b":Infinity,"c":[null], "d": {"year":-600,"author": "filip ʒakotɛ"}}])"; auto const d_utf_failed = cudf::detail::make_device_uvector_sync( - cudf::host_span{utf_failed.c_str(), utf_failed.size()}, stream); + cudf::host_span{utf_failed.c_str(), utf_failed.size()}, + stream, + rmm::mr::get_current_device_resource()); CUDF_EXPECT_NO_THROW(json_parser(d_utf_failed, default_options, stream, mr)); // utf-8 string that passes parsing. @@ -534,7 +540,9 @@ TEST_P(JsonParserTest, UTF_JSON) {"a":1,"b":Infinity,"c":[null], "d": {"year":-600,"author": "Kaniyan"}}, {"a":1,"b":NaN,"c":[null, null], "d": {"year": 2, "author": "filip ʒakotɛ"}}])"; auto const d_utf_pass = cudf::detail::make_device_uvector_sync( - cudf::host_span{utf_pass.c_str(), utf_pass.size()}, stream); + cudf::host_span{utf_pass.c_str(), utf_pass.size()}, + stream, + rmm::mr::get_current_device_resource()); CUDF_EXPECT_NO_THROW(json_parser(d_utf_pass, default_options, stream, mr)); } @@ -555,7 +563,9 @@ TEST_P(JsonParserTest, ExtractColumnWithQuotes) std::string const input = R"( [{"a":"0.0", "b":1.0}, {"b":1.1}, {"b":2.1, "a":"2.0"}] )"; auto const d_input = cudf::detail::make_device_uvector_async( - cudf::host_span{input.c_str(), input.size()}, stream); + cudf::host_span{input.c_str(), input.size()}, + stream, + rmm::mr::get_current_device_resource()); // Get the JSON's tree representation auto const cudf_table = json_parser(d_input, options, stream, mr); @@ -599,14 +609,18 @@ TEST_P(JsonParserTest, ExpectFailMixStructAndList) // libcudf does not currently support a mix of lists and structs. for (auto const& input : inputs_fail) { auto const d_input = cudf::detail::make_device_uvector_async( - cudf::host_span{input.c_str(), input.size()}, stream); + cudf::host_span{input.c_str(), input.size()}, + stream, + rmm::mr::get_current_device_resource()); EXPECT_THROW(auto const cudf_table = json_parser(d_input, options, stream, mr), cudf::logic_error); } for (auto const& input : inputs_succeed) { auto const d_input = cudf::detail::make_device_uvector_async( - cudf::host_span{input.c_str(), input.size()}, stream); + cudf::host_span{input.c_str(), input.size()}, + stream, + rmm::mr::get_current_device_resource()); CUDF_EXPECT_NO_THROW(auto const cudf_table = json_parser(d_input, options, stream, mr)); } } @@ -626,8 +640,10 @@ TEST_P(JsonParserTest, EmptyString) cudf::io::json_reader_options default_options{}; std::string const input = R"([])"; - auto const d_input = cudf::detail::make_device_uvector_sync( - cudf::host_span{input.c_str(), input.size()}, stream); + auto const d_input = + cudf::detail::make_device_uvector_sync(cudf::host_span{input.c_str(), input.size()}, + stream, + rmm::mr::get_current_device_resource()); // Get the JSON's tree representation auto const cudf_table = json_parser(d_input, default_options, stream, mr); diff --git a/cpp/tests/io/parquet_test.cpp b/cpp/tests/io/parquet_test.cpp index e82b0c670b8..8a16fd9a05a 100644 --- a/cpp/tests/io/parquet_test.cpp +++ b/cpp/tests/io/parquet_test.cpp @@ -1128,7 +1128,8 @@ TEST_F(ParquetWriterTest, BufferSource) auto const d_input = cudf::detail::make_device_uvector_sync( cudf::host_span{reinterpret_cast(out_buffer.data()), out_buffer.size()}, - cudf::get_default_stream()); + cudf::get_default_stream(), + rmm::mr::get_current_device_resource()); auto const d_buffer = cudf::device_span( reinterpret_cast(d_input.data()), d_input.size()); cudf::io::parquet_reader_options in_opts = diff --git a/cpp/tests/io/type_inference_test.cu b/cpp/tests/io/type_inference_test.cu index ea6eb9b93ef..81c6563cd2d 100644 --- a/cpp/tests/io/type_inference_test.cu +++ b/cpp/tests/io/type_inference_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, NVIDIA CORPORATION. + * Copyright (c) 2022-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,12 +51,12 @@ TEST_F(TypeInference, Basic) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 4, 7}; - auto const string_length = std::vector{2, 2, 1}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 4, 7}; + auto const string_length = std::vector{2, 2, 1}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -84,12 +84,12 @@ TEST_F(TypeInference, Null) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 1, 4}; - auto const string_length = std::vector{0, 2, 1}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 1, 4}; + auto const string_length = std::vector{0, 2, 1}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -117,12 +117,12 @@ TEST_F(TypeInference, AllNull) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 1, 1}; - auto const string_length = std::vector{0, 0, 4}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 1, 1}; + auto const string_length = std::vector{0, 0, 4}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -150,12 +150,12 @@ TEST_F(TypeInference, String) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 8, 12}; - auto const string_length = std::vector{6, 3, 4}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 8, 12}; + auto const string_length = std::vector{6, 3, 4}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -183,12 +183,12 @@ TEST_F(TypeInference, Bool) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 6, 12}; - auto const string_length = std::vector{4, 5, 5}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 6, 12}; + auto const string_length = std::vector{4, 5, 5}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -216,12 +216,12 @@ TEST_F(TypeInference, Timestamp) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 10}; - auto const string_length = std::vector{8, 9}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 10}; + auto const string_length = std::vector{8, 9}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); @@ -250,12 +250,12 @@ TEST_F(TypeInference, InvalidInput) auto d_data = cudf::make_string_scalar(data); auto& d_string_scalar = static_cast(*d_data); - auto const string_offset = std::vector{1, 3, 5, 7, 9}; - auto const string_length = std::vector{1, 1, 1, 1, 1}; - auto const d_string_offset = - cudf::detail::make_device_uvector_async(string_offset, cudf::get_default_stream()); - auto const d_string_length = - cudf::detail::make_device_uvector_async(string_length, cudf::get_default_stream()); + auto const string_offset = std::vector{1, 3, 5, 7, 9}; + auto const string_length = std::vector{1, 1, 1, 1, 1}; + auto const d_string_offset = cudf::detail::make_device_uvector_async( + string_offset, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto const d_string_length = cudf::detail::make_device_uvector_async( + string_length, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_col_strings = thrust::make_zip_iterator(thrust::make_tuple(d_string_offset.begin(), d_string_length.begin())); diff --git a/cpp/tests/iterator/iterator_tests.cuh b/cpp/tests/iterator/iterator_tests.cuh index 894e117ba40..882de994e67 100644 --- a/cpp/tests/iterator/iterator_tests.cuh +++ b/cpp/tests/iterator/iterator_tests.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,8 +87,8 @@ struct IteratorTest : public cudf::test::BaseFixture { { InputIterator d_in_last = d_in + num_items; EXPECT_EQ(thrust::distance(d_in, d_in_last), num_items); - auto dev_expected = - cudf::detail::make_device_uvector_sync(expected, cudf::get_default_stream()); + auto dev_expected = cudf::detail::make_device_uvector_sync( + expected, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); // using a temporary vector and calling transform and all_of separately is // equivalent to thrust::equal but compiles ~3x faster diff --git a/cpp/tests/iterator/value_iterator_test.cuh b/cpp/tests/iterator/value_iterator_test.cuh index fa931d34a0e..8252ce88f39 100644 --- a/cpp/tests/iterator/value_iterator_test.cuh +++ b/cpp/tests/iterator/value_iterator_test.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,8 @@ template void non_null_iterator(IteratorTest& testFixture) { auto host_array = cudf::test::make_type_param_vector({0, 6, 0, -14, 13, 64, -13, -20, 45}); - auto dev_array = cudf::detail::make_device_uvector_sync(host_array, cudf::get_default_stream()); + auto dev_array = cudf::detail::make_device_uvector_sync( + host_array, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); // calculate the expected value by CPU. thrust::host_vector replaced_array(host_array); diff --git a/cpp/tests/iterator/value_iterator_test_strings.cu b/cpp/tests/iterator/value_iterator_test_strings.cu index 8b4080fa493..d0e62c09a03 100644 --- a/cpp/tests/iterator/value_iterator_test_strings.cu +++ b/cpp/tests/iterator/value_iterator_test_strings.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,8 @@ auto strings_to_string_views(std::vector& input_strings) std::vector offsets; std::tie(chars, offsets) = cudf::test::detail::make_chars_and_offsets( input_strings.begin(), input_strings.end(), all_valid); - auto dev_chars = cudf::detail::make_device_uvector_sync(chars, cudf::get_default_stream()); + auto dev_chars = cudf::detail::make_device_uvector_sync( + chars, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); // calculate the expected value by CPU. (but contains device pointers) thrust::host_vector replaced_array(input_strings.size()); @@ -51,8 +52,9 @@ TEST_F(StringIteratorTest, string_view_null_iterator) using T = cudf::string_view; std::string zero("zero"); // the char data has to be in GPU - auto initmsg = cudf::detail::make_device_uvector_sync(zero, cudf::get_default_stream()); - T init = T{initmsg.data(), int(initmsg.size())}; + auto initmsg = cudf::detail::make_device_uvector_sync( + zero, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + T init = T{initmsg.data(), int(initmsg.size())}; // data and valid arrays std::vector host_values( @@ -86,8 +88,9 @@ TEST_F(StringIteratorTest, string_view_no_null_iterator) // T init = T{"", 0}; std::string zero("zero"); // the char data has to be in GPU - auto initmsg = cudf::detail::make_device_uvector_sync(zero, cudf::get_default_stream()); - T init = T{initmsg.data(), int(initmsg.size())}; + auto initmsg = cudf::detail::make_device_uvector_sync( + zero, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + T init = T{initmsg.data(), int(initmsg.size())}; // data array std::vector host_values( @@ -110,8 +113,9 @@ TEST_F(StringIteratorTest, string_scalar_iterator) // T init = T{"", 0}; std::string zero("zero"); // the char data has to be in GPU - auto initmsg = cudf::detail::make_device_uvector_sync(zero, cudf::get_default_stream()); - T init = T{initmsg.data(), int(initmsg.size())}; + auto initmsg = cudf::detail::make_device_uvector_sync( + zero, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + T init = T{initmsg.data(), int(initmsg.size())}; // data array std::vector host_values(100, zero); diff --git a/cpp/tests/partitioning/hash_partition_test.cpp b/cpp/tests/partitioning/hash_partition_test.cpp index 9d206c5397d..a1508b5b973 100644 --- a/cpp/tests/partitioning/hash_partition_test.cpp +++ b/cpp/tests/partitioning/hash_partition_test.cpp @@ -308,8 +308,8 @@ void run_fixed_width_test(size_t cols, // Make a table view of the partition numbers constexpr cudf::data_type dtype{cudf::type_id::INT32}; - auto d_partitions = - cudf::detail::make_device_uvector_sync(partitions, cudf::get_default_stream()); + auto d_partitions = cudf::detail::make_device_uvector_sync( + partitions, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); cudf::column_view partitions_col(dtype, rows, d_partitions.data()); cudf::table_view partitions_table({partitions_col}); diff --git a/cpp/tests/reductions/segmented_reduction_tests.cpp b/cpp/tests/reductions/segmented_reduction_tests.cpp index 47bcbb874cf..40b0d268580 100644 --- a/cpp/tests/reductions/segmented_reduction_tests.cpp +++ b/cpp/tests/reductions/segmented_reduction_tests.cpp @@ -49,9 +49,9 @@ TYPED_TEST(SegmentedReductionTest, SumExcludeNulls) // output nullmask: {1, 1, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{6, 4, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 0, 0}}; @@ -97,9 +97,9 @@ TYPED_TEST(SegmentedReductionTest, ProductExcludeNulls) // output nullmask: {1, 1, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 3, 5, XXX, 3, 5, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 1, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{15, 15, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 0, 0}}; @@ -147,9 +147,9 @@ TYPED_TEST(SegmentedReductionTest, MaxExcludeNulls) // output nullmask: {1, 1, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{3, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 0, 0}}; @@ -195,9 +195,9 @@ TYPED_TEST(SegmentedReductionTest, MinExcludeNulls) // output nullmask: {1, 1, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{1, 1, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 0, 0}}; @@ -244,9 +244,9 @@ TYPED_TEST(SegmentedReductionTest, AnyExcludeNulls) auto const input = cudf::test::fixed_width_column_wrapper{ {0, 0, 0, 0, XXX, 0, 0, 1, 0, 1, XXX, 0, 0, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 9, 12, 12, 13, 14, 15, 17}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 9, 12, 12, 13, 14, 15, 17}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{ {false, false, true, true, bool{XXX}, false, true, bool{XXX}, bool{XXX}}, {true, true, true, true, false, true, true, false, false}}; @@ -284,9 +284,9 @@ TYPED_TEST(SegmentedReductionTest, AllExcludeNulls) auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX, 1, 0, 3, 1, XXX, 0, 0}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1}}; - auto const offsets = std::vector{0, 3, 6, 6, 7, 8, 10, 13, 16, 17}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 6, 7, 8, 10, 13, 16, 17}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{ {true, true, bool{XXX}, true, bool{XXX}, bool{XXX}, false, false, false}, {true, true, false, true, false, false, true, true, true}}; @@ -335,9 +335,9 @@ TYPED_TEST(SegmentedReductionTest, SumIncludeNulls) // output nullmask: {1, 0, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{6, XXX, 1, XXX, XXX, XXX}, {1, 0, 1, 0, 0, 0}}; @@ -386,9 +386,9 @@ TYPED_TEST(SegmentedReductionTest, ProductIncludeNulls) // output nullmask: {1, 0, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 3, 5, XXX, 3, 5, 1, XXX, XXX, XXX}, {1, 1, 1, 0, 1, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{15, XXX, 1, XXX, XXX, XXX}, {1, 0, 1, 0, 0, 0}}; @@ -439,9 +439,9 @@ TYPED_TEST(SegmentedReductionTest, MaxIncludeNulls) // output nullmask: {1, 0, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{3, XXX, 1, XXX, XXX, XXX}, {1, 0, 1, 0, 0, 0}}; @@ -490,9 +490,9 @@ TYPED_TEST(SegmentedReductionTest, MinIncludeNulls) // output nullmask: {1, 0, 1, 0, 0, 0} auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{1, XXX, 1, XXX, XXX, XXX}, {1, 0, 1, 0, 0, 0}}; @@ -542,9 +542,9 @@ TYPED_TEST(SegmentedReductionTest, AnyIncludeNulls) auto const input = cudf::test::fixed_width_column_wrapper{ {0, 0, 0, 0, XXX, 0, 0, 1, 0, 1, XXX, 0, 0, 1, XXX, XXX, XXX}, {1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0}}; - auto const offsets = std::vector{0, 3, 6, 9, 12, 12, 13, 14, 15, 17}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 9, 12, 12, 13, 14, 15, 17}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{ {false, bool{XXX}, true, bool{XXX}, bool{XXX}, false, true, bool{XXX}, bool{XXX}}, {true, false, true, false, false, true, true, false, false}}; @@ -605,9 +605,9 @@ TYPED_TEST(SegmentedReductionTest, AllIncludeNulls) auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 1, XXX, 3, 1, XXX, XXX, XXX, 1, 0, 3, 1, XXX, 0, 0}, {1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1}}; - auto const offsets = std::vector{0, 3, 6, 6, 7, 8, 10, 13, 16, 17}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 6, 7, 8, 10, 13, 16, 17}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{ {true, bool{XXX}, bool{XXX}, true, bool{XXX}, bool{XXX}, false, bool{XXX}, false}, {true, false, false, true, false, false, true, false, true}}; @@ -670,9 +670,9 @@ TEST_F(SegmentedReductionTestUntyped, PartialSegmentReduction) auto const input = cudf::test::fixed_width_column_wrapper{ {1, 2, 3, 4, 5, 6, 7}, {true, true, true, true, true, true, true}}; - auto const offsets = std::vector{1, 3, 4}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{1, 3, 4}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{5, 4}, {true, true}}; auto res = @@ -720,10 +720,10 @@ TEST_F(SegmentedReductionTestUntyped, NonNullableInput) // outputs: {1, 5, 4} // output nullmask: {1, 1, 1} - auto const input = cudf::test::fixed_width_column_wrapper{1, 2, 3, 4, 5, 6, 7}; - auto const offsets = std::vector{0, 1, 1, 3, 7}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const input = cudf::test::fixed_width_column_wrapper{1, 2, 3, 4, 5, 6, 7}; + auto const offsets = std::vector{0, 1, 1, 3, 7}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{1, XXX, 5, 22}, {true, false, true, true}}; @@ -767,9 +767,9 @@ TEST_F(SegmentedReductionTestUntyped, Mean) { auto const input = cudf::test::fixed_width_column_wrapper{10, 20, 30, 40, 50, 60, 70, 80, 90}; - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_mean_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT32}; @@ -786,9 +786,9 @@ TEST_F(SegmentedReductionTestUntyped, MeanNulls) { auto const input = cudf::test::fixed_width_column_wrapper( {10, 20, 30, 40, 50, 60, 0, 80, 90}, {1, 1, 1, 1, 1, 1, 0, 1, 1}); - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_mean_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT64}; @@ -806,9 +806,9 @@ TEST_F(SegmentedReductionTestUntyped, SumOfSquares) { auto const input = cudf::test::fixed_width_column_wrapper{10, 20, 30, 40, 50, 60, 70, 80, 90}; - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_sum_of_squares_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::INT32}; @@ -826,9 +826,9 @@ TEST_F(SegmentedReductionTestUntyped, SumOfSquaresNulls) { auto const input = cudf::test::fixed_width_column_wrapper( {10, 20, 30, 40, 50, 60, 0, 80, 90}, {1, 1, 1, 1, 1, 1, 0, 1, 1}); - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_sum_of_squares_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::INT64}; @@ -848,9 +848,9 @@ TEST_F(SegmentedReductionTestUntyped, StandardDeviation) constexpr float NaN{std::numeric_limits::quiet_NaN()}; auto const input = cudf::test::fixed_width_column_wrapper{10, 20, 30, 40, 50, 60, 70, 80, 90}; - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_std_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT32}; @@ -868,9 +868,9 @@ TEST_F(SegmentedReductionTestUntyped, StandardDeviationNulls) constexpr double NaN{std::numeric_limits::quiet_NaN()}; auto const input = cudf::test::fixed_width_column_wrapper( {10, 0, 20, 30, 54, 63, 0, 72, 81}, {1, 0, 1, 1, 1, 1, 0, 1, 1}); - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_std_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT64}; @@ -890,9 +890,9 @@ TEST_F(SegmentedReductionTestUntyped, Variance) constexpr float NaN{std::numeric_limits::quiet_NaN()}; auto const input = cudf::test::fixed_width_column_wrapper{10, 20, 30, 40, 50, 60, 70, 80, 90}; - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_variance_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT32}; @@ -910,9 +910,9 @@ TEST_F(SegmentedReductionTestUntyped, VarianceNulls) constexpr double NaN{std::numeric_limits::quiet_NaN()}; auto const input = cudf::test::fixed_width_column_wrapper( {10, 0, 20, 30, 54, 63, 0, 72, 81}, {1, 0, 1, 1, 1, 1, 0, 1, 1}); - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_variance_aggregation(); auto const output_type = cudf::data_type{cudf::type_id::FLOAT64}; @@ -931,9 +931,9 @@ TEST_F(SegmentedReductionTestUntyped, Errors) { auto const input = cudf::test::fixed_width_column_wrapper( {10, 0, 20, 30, 54, 63, 0, 72, 81}, {1, 0, 1, 1, 1, 1, 0, 1, 1}); - auto const offsets = std::vector{0, 1, 1, 4, 9}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 1, 1, 4, 9}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const null_policy = cudf::null_policy::EXCLUDE; auto const output_type = cudf::data_type{cudf::type_id::TIMESTAMP_DAYS}; auto const str_input = @@ -999,10 +999,10 @@ TEST_F(SegmentedReductionTestUntyped, Errors) TEST_F(SegmentedReductionTestUntyped, ReduceEmptyColumn) { - auto const input = cudf::test::fixed_width_column_wrapper{}; - auto const offsets = std::vector{0}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const input = cudf::test::fixed_width_column_wrapper{}; + auto const offsets = std::vector{0}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{}; auto res = @@ -1036,10 +1036,10 @@ TEST_F(SegmentedReductionTestUntyped, ReduceEmptyColumn) TEST_F(SegmentedReductionTestUntyped, EmptyInputWithOffsets) { - auto const input = cudf::test::fixed_width_column_wrapper{}; - auto const offsets = std::vector{0, 0, 0, 0, 0, 0}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const input = cudf::test::fixed_width_column_wrapper{}; + auto const offsets = std::vector{0, 0, 0, 0, 0, 0}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::fixed_width_column_wrapper{{XXX, XXX, XXX, XXX, XXX}, {0, 0, 0, 0, 0}}; @@ -1087,9 +1087,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, MaxWithNulls) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_max_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1115,9 +1115,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, MinWithNulls) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_min_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1143,9 +1143,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, MaxNonNullableInput) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 4, 4}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 4, 4}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_max_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1168,9 +1168,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, MinNonNullableInput) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 4, 4}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 4, 4}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_min_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1193,9 +1193,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, Sum) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_sum_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1231,9 +1231,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, Product) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 6, 7, 8, 12, 12}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 12, 12}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_product_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1268,9 +1268,9 @@ TYPED_TEST(SegmentedReductionFixedPointTest, SumOfSquares) { using RepType = cudf::device_storage_type_t; - auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const offsets = std::vector{0, 3, 6, 7, 8, 10, 10}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const agg = cudf::make_sum_of_squares_aggregation(); for (auto scale : {-2, 0, 5}) { @@ -1431,10 +1431,10 @@ TEST_F(SegmentedReductionStringTest, MinExcludeNulls) TEST_F(SegmentedReductionStringTest, EmptyInputWithOffsets) { - auto const input = cudf::test::strings_column_wrapper{}; - auto const offsets = std::vector{0, 0, 0, 0}; - auto const d_offsets = - cudf::detail::make_device_uvector_async(offsets, cudf::get_default_stream()); + auto const input = cudf::test::strings_column_wrapper{}; + auto const offsets = std::vector{0, 0, 0, 0}; + auto const d_offsets = cudf::detail::make_device_uvector_async( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto const expect = cudf::test::strings_column_wrapper({XXX, XXX, XXX}, {0, 0, 0}); auto result = diff --git a/cpp/tests/scalar/scalar_device_view_test.cu b/cpp/tests/scalar/scalar_device_view_test.cu index c7365d63e1c..9e0f68573a5 100644 --- a/cpp/tests/scalar/scalar_device_view_test.cu +++ b/cpp/tests/scalar/scalar_device_view_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,8 @@ TEST_F(StringScalarDeviceViewTest, Value) auto scalar_device_view = cudf::get_scalar_device_view(s); rmm::device_scalar result{cudf::get_default_stream()}; - auto value_v = cudf::detail::make_device_uvector_sync(value, cudf::get_default_stream()); + auto value_v = cudf::detail::make_device_uvector_sync( + value, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); test_string_value<<<1, 1, 0, cudf::get_default_stream().value()>>>( scalar_device_view, value_v.data(), value.size(), result.data()); diff --git a/cpp/tests/strings/contains_tests.cpp b/cpp/tests/strings/contains_tests.cpp index 5331c4c34d8..316f24e4167 100644 --- a/cpp/tests/strings/contains_tests.cpp +++ b/cpp/tests/strings/contains_tests.cpp @@ -298,9 +298,11 @@ TEST_F(StringsContainsTests, HexTest) std::vector offsets( {thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + count + 1}); - auto d_chars = cudf::detail::make_device_uvector_sync(ascii_chars, cudf::get_default_stream()); - auto d_offsets = cudf::detail::make_device_uvector_sync(offsets, cudf::get_default_stream()); - auto input = cudf::make_strings_column(d_chars, d_offsets); + auto d_chars = cudf::detail::make_device_uvector_sync( + ascii_chars, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_offsets = cudf::detail::make_device_uvector_sync( + offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto input = cudf::make_strings_column(d_chars, d_offsets); auto strings_view = cudf::strings_column_view(input->view()); for (auto ch : ascii_chars) { diff --git a/cpp/tests/strings/factories_test.cu b/cpp/tests/strings/factories_test.cu index e3df8db721d..77857049e7a 100644 --- a/cpp/tests/strings/factories_test.cu +++ b/cpp/tests/strings/factories_test.cu @@ -78,7 +78,8 @@ TEST_F(StringsFactoriesTest, CreateColumnFromPair) } h_offsets[idx + 1] = offset; } - auto d_strings = cudf::detail::make_device_uvector_sync(strings, cudf::get_default_stream()); + auto d_strings = cudf::detail::make_device_uvector_sync( + strings, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); CUDF_CUDA_TRY(cudaMemcpy(d_buffer.data(), h_buffer.data(), memsize, cudaMemcpyDefault)); auto column = cudf::make_strings_column(d_strings); EXPECT_EQ(column->type(), cudf::data_type{cudf::type_id::STRING}); @@ -143,10 +144,13 @@ TEST_F(StringsFactoriesTest, CreateColumnFromOffsets) } std::vector h_nulls{h_null_mask}; - auto d_buffer = cudf::detail::make_device_uvector_sync(h_buffer, cudf::get_default_stream()); - auto d_offsets = cudf::detail::make_device_uvector_sync(h_offsets, cudf::get_default_stream()); - auto d_nulls = cudf::detail::make_device_uvector_sync(h_nulls, cudf::get_default_stream()); - auto column = cudf::make_strings_column(d_buffer, d_offsets, d_nulls, null_count); + auto d_buffer = cudf::detail::make_device_uvector_sync( + h_buffer, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_offsets = cudf::detail::make_device_uvector_sync( + h_offsets, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_nulls = cudf::detail::make_device_uvector_sync( + h_nulls, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto column = cudf::make_strings_column(d_buffer, d_offsets, d_nulls, null_count); EXPECT_EQ(column->type(), cudf::data_type{cudf::type_id::STRING}); EXPECT_EQ(column->null_count(), null_count); EXPECT_EQ(2, column->num_children()); @@ -184,8 +188,8 @@ TEST_F(StringsFactoriesTest, CreateScalar) TEST_F(StringsFactoriesTest, EmptyStringsColumn) { rmm::device_uvector d_chars{0, cudf::get_default_stream()}; - auto d_offsets = - cudf::detail::make_zeroed_device_uvector_sync(1, cudf::get_default_stream()); + auto d_offsets = cudf::detail::make_zeroed_device_uvector_sync( + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); rmm::device_uvector d_nulls{0, cudf::get_default_stream()}; auto results = cudf::make_strings_column(d_chars, d_offsets, d_nulls, 0); diff --git a/cpp/tests/strings/integers_tests.cpp b/cpp/tests/strings/integers_tests.cpp index 04e6886a08a..79e96ff5121 100644 --- a/cpp/tests/strings/integers_tests.cpp +++ b/cpp/tests/strings/integers_tests.cpp @@ -297,8 +297,9 @@ TYPED_TEST(StringsIntegerConvertTest, FromToInteger) std::iota(h_integers.begin(), h_integers.end(), -(TypeParam)(h_integers.size() / 2)); h_integers.push_back(std::numeric_limits::min()); h_integers.push_back(std::numeric_limits::max()); - auto d_integers = cudf::detail::make_device_uvector_sync(h_integers, cudf::get_default_stream()); - auto integers = cudf::make_numeric_column(cudf::data_type{cudf::type_to_id()}, + auto d_integers = cudf::detail::make_device_uvector_sync( + h_integers, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto integers = cudf::make_numeric_column(cudf::data_type{cudf::type_to_id()}, (cudf::size_type)d_integers.size()); auto integers_view = integers->mutable_view(); CUDF_CUDA_TRY(cudaMemcpy(integers_view.data(), diff --git a/cpp/tests/table/table_view_tests.cu b/cpp/tests/table/table_view_tests.cu index 0542d007ca0..5127f69162f 100644 --- a/cpp/tests/table/table_view_tests.cu +++ b/cpp/tests/table/table_view_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,8 +47,8 @@ void row_comparison(cudf::table_view input1, auto device_table_1 = cudf::table_device_view::create(input1, stream); auto device_table_2 = cudf::table_device_view::create(input2, stream); - auto d_column_order = - cudf::detail::make_device_uvector_sync(column_order, cudf::get_default_stream()); + auto d_column_order = cudf::detail::make_device_uvector_sync( + column_order, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto comparator = cudf::row_lexicographic_comparator( cudf::nullate::NO{}, *device_table_1, *device_table_2, d_column_order.data()); diff --git a/cpp/tests/types/type_dispatcher_test.cu b/cpp/tests/types/type_dispatcher_test.cu index 911911851f2..a27d8931ee6 100644 --- a/cpp/tests/types/type_dispatcher_test.cu +++ b/cpp/tests/types/type_dispatcher_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,8 @@ __global__ void dispatch_test_kernel(cudf::type_id id, bool* d_result) TYPED_TEST(TypedDispatcherTest, DeviceDispatch) { - auto result = cudf::detail::make_zeroed_device_uvector_sync(1, cudf::get_default_stream()); + auto result = cudf::detail::make_zeroed_device_uvector_sync( + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); dispatch_test_kernel<<<1, 1, 0, cudf::get_default_stream().value()>>>( cudf::type_to_id(), result.data()); CUDF_CUDA_TRY(cudaDeviceSynchronize()); @@ -130,7 +131,8 @@ __global__ void double_dispatch_test_kernel(cudf::type_id id1, cudf::type_id id2 TYPED_TEST(TypedDoubleDispatcherTest, DeviceDoubleDispatch) { - auto result = cudf::detail::make_zeroed_device_uvector_sync(1, cudf::get_default_stream()); + auto result = cudf::detail::make_zeroed_device_uvector_sync( + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); double_dispatch_test_kernel<<<1, 1, 0, cudf::get_default_stream().value()>>>( cudf::type_to_id(), cudf::type_to_id(), result.data()); CUDF_CUDA_TRY(cudaDeviceSynchronize()); diff --git a/cpp/tests/utilities/tdigest_utilities.cu b/cpp/tests/utilities/tdigest_utilities.cu index 15998e32bd0..d2e95812894 100644 --- a/cpp/tests/utilities/tdigest_utilities.cu +++ b/cpp/tests/utilities/tdigest_utilities.cu @@ -64,12 +64,12 @@ void tdigest_sample_compare(cudf::tdigest::tdigest_column_view const& tdv, }); } - auto d_expected_src = - cudf::detail::make_device_uvector_async(h_expected_src, cudf::get_default_stream()); - auto d_expected_mean = - cudf::detail::make_device_uvector_async(h_expected_mean, cudf::get_default_stream()); - auto d_expected_weight = - cudf::detail::make_device_uvector_async(h_expected_weight, cudf::get_default_stream()); + auto d_expected_src = cudf::detail::make_device_uvector_async( + h_expected_src, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_expected_mean = cudf::detail::make_device_uvector_async( + h_expected_mean, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + auto d_expected_weight = cudf::detail::make_device_uvector_async( + h_expected_weight, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto iter = thrust::make_counting_iterator(0); thrust::for_each( diff --git a/cpp/tests/utilities_tests/span_tests.cu b/cpp/tests/utilities_tests/span_tests.cu index a043e723eda..66f9fbfc0d6 100644 --- a/cpp/tests/utilities_tests/span_tests.cu +++ b/cpp/tests/utilities_tests/span_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2023, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -238,8 +238,8 @@ __global__ void simple_device_kernel(device_span result) { result[0] = tru TEST(SpanTest, CanUseDeviceSpan) { - auto d_message = - cudf::detail::make_zeroed_device_uvector_async(1, cudf::get_default_stream()); + auto d_message = cudf::detail::make_zeroed_device_uvector_async( + 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); auto d_span = device_span(d_message.data(), d_message.size()); diff --git a/java/src/main/native/src/row_conversion.cu b/java/src/main/native/src/row_conversion.cu index 5cf7658106f..747ff24f055 100644 --- a/java/src/main/native/src/row_conversion.cu +++ b/java/src/main/native/src/row_conversion.cu @@ -226,7 +226,8 @@ build_string_row_offsets(table_view const &tbl, size_type fixed_width_and_validi std::copy_if(offsets_iter, offsets_iter + tbl.num_columns(), std::back_inserter(offsets_iterators), [](auto const &offset_ptr) { return offset_ptr != nullptr; }); - return make_device_uvector_async(offsets_iterators, stream); + return make_device_uvector_async(offsets_iterators, stream, + rmm::mr::get_current_device_resource()); }(); auto const num_columns = static_cast(d_offsets_iterators.size()); @@ -1539,7 +1540,9 @@ batch_data build_batches(size_type num_rows, RowSize row_sizes, bool all_fixed_w last_row_end = row_end; } - return {std::move(batch_row_offsets), make_device_uvector_async(batch_row_boundaries, stream), + return {std::move(batch_row_offsets), + make_device_uvector_async(batch_row_boundaries, stream, + rmm::mr::get_current_device_resource()), std::move(batch_row_boundaries), std::move(row_batches)}; } @@ -1750,8 +1753,10 @@ std::vector> convert_to_rows( return table_view(cols); }; - auto dev_col_sizes = make_device_uvector_async(column_info.column_sizes, stream); - auto dev_col_starts = make_device_uvector_async(column_info.column_starts, stream); + auto dev_col_sizes = make_device_uvector_async(column_info.column_sizes, stream, + rmm::mr::get_current_device_resource()); + auto dev_col_starts = make_device_uvector_async(column_info.column_starts, stream, + rmm::mr::get_current_device_resource()); // Get the pointers to the input columnar data ready auto const data_begin = thrust::make_transform_iterator(tbl.begin(), [](auto const &c) { @@ -1764,8 +1769,10 @@ std::vector> convert_to_rows( thrust::make_transform_iterator(tbl.begin(), [](auto const &c) { return c.null_mask(); }); std::vector input_nm(nm_begin, nm_begin + tbl.num_columns()); - auto dev_input_data = make_device_uvector_async(input_data, stream); - auto dev_input_nm = make_device_uvector_async(input_nm, stream); + auto dev_input_data = + make_device_uvector_async(input_data, stream, rmm::mr::get_current_device_resource()); + auto dev_input_nm = + make_device_uvector_async(input_nm, stream, rmm::mr::get_current_device_resource()); // the first batch always exists unless we were sent an empty table auto const first_batch_size = batch_info.row_batches[0].row_count; @@ -1811,7 +1818,8 @@ std::vector> convert_to_rows( auto validity_tile_infos = detail::build_validity_tile_infos( tbl.num_columns(), num_rows, shmem_limit_per_tile, batch_info.row_batches); - auto dev_validity_tile_infos = make_device_uvector_async(validity_tile_infos, stream); + auto dev_validity_tile_infos = make_device_uvector_async(validity_tile_infos, stream, + rmm::mr::get_current_device_resource()); auto const validity_offset = column_info.column_starts.back(); @@ -1847,9 +1855,10 @@ std::vector> convert_to_rows( std::vector variable_width_input_data( variable_data_begin, variable_data_begin + variable_width_table.num_columns()); - auto dev_variable_input_data = make_device_uvector_async(variable_width_input_data, stream); - auto dev_variable_col_output_offsets = - make_device_uvector_async(column_info.variable_width_column_starts, stream); + auto dev_variable_input_data = make_device_uvector_async( + variable_width_input_data, stream, rmm::mr::get_current_device_resource()); + auto dev_variable_col_output_offsets = make_device_uvector_async( + column_info.variable_width_column_starts, stream, rmm::mr::get_current_device_resource()); for (uint i = 0; i < batch_info.row_batches.size(); i++) { auto const batch_row_offset = batch_info.batch_row_boundaries[i]; @@ -2076,8 +2085,10 @@ std::unique_ptr
convert_from_rows(lists_column_view const &input, // Ideally we would check that the offsets are all the same, etc. but for now this is probably // fine CUDF_EXPECTS(size_per_row * num_rows <= child.size(), "The layout of the data appears to be off"); - auto dev_col_starts = make_device_uvector_async(column_info.column_starts, stream); - auto dev_col_sizes = make_device_uvector_async(column_info.column_sizes, stream); + auto dev_col_starts = make_device_uvector_async(column_info.column_starts, stream, + rmm::mr::get_current_device_resource()); + auto dev_col_sizes = make_device_uvector_async(column_info.column_sizes, stream, + rmm::mr::get_current_device_resource()); // Allocate the columns we are going to write into std::vector> output_columns; @@ -2118,16 +2129,20 @@ std::unique_ptr
convert_from_rows(lists_column_view const &input, } } - auto dev_string_row_offsets = make_device_uvector_async(string_row_offsets, stream); - auto dev_string_lengths = make_device_uvector_async(string_lengths, stream); + auto dev_string_row_offsets = + make_device_uvector_async(string_row_offsets, stream, rmm::mr::get_current_device_resource()); + auto dev_string_lengths = + make_device_uvector_async(string_lengths, stream, rmm::mr::get_current_device_resource()); // build the row_batches from the passed in list column std::vector row_batches; row_batches.push_back( {detail::row_batch{child.size(), num_rows, device_uvector(0, stream)}}); - auto dev_output_data = make_device_uvector_async(output_data, stream); - auto dev_output_nm = make_device_uvector_async(output_nm, stream); + auto dev_output_data = + make_device_uvector_async(output_data, stream, rmm::mr::get_current_device_resource()); + auto dev_output_nm = + make_device_uvector_async(output_nm, stream, rmm::mr::get_current_device_resource()); // only ever get a single batch when going from rows, so boundaries are 0, num_rows constexpr auto num_batches = 2; @@ -2164,7 +2179,8 @@ std::unique_ptr
convert_from_rows(lists_column_view const &input, auto validity_tile_infos = detail::build_validity_tile_infos(schema.size(), num_rows, shmem_limit_per_tile, row_batches); - auto dev_validity_tile_infos = make_device_uvector_async(validity_tile_infos, stream); + auto dev_validity_tile_infos = make_device_uvector_async(validity_tile_infos, stream, + rmm::mr::get_current_device_resource()); dim3 const validity_blocks(validity_tile_infos.size()); @@ -2221,8 +2237,10 @@ std::unique_ptr
convert_from_rows(lists_column_view const &input, string_col_offsets.push_back(std::move(output_string_offsets)); string_data_cols.push_back(std::move(string_data)); } - auto dev_string_col_offsets = make_device_uvector_async(string_col_offset_ptrs, stream); - auto dev_string_data_cols = make_device_uvector_async(string_data_col_ptrs, stream); + auto dev_string_col_offsets = make_device_uvector_async(string_col_offset_ptrs, stream, + rmm::mr::get_current_device_resource()); + auto dev_string_data_cols = make_device_uvector_async(string_data_col_ptrs, stream, + rmm::mr::get_current_device_resource()); dim3 const string_blocks( std::min(std::max(MIN_STRING_BLOCKS, num_rows / NUM_STRING_ROWS_PER_BLOCK_FROM_ROWS), @@ -2274,8 +2292,10 @@ std::unique_ptr
convert_from_rows_fixed_width_optimized( // fine CUDF_EXPECTS(size_per_row * num_rows == child.size(), "The layout of the data appears to be off"); - auto dev_column_start = make_device_uvector_async(column_start, stream); - auto dev_column_size = make_device_uvector_async(column_size, stream); + auto dev_column_start = + make_device_uvector_async(column_start, stream, rmm::mr::get_current_device_resource()); + auto dev_column_size = + make_device_uvector_async(column_size, stream, rmm::mr::get_current_device_resource()); // Allocate the columns we are going to write into std::vector> output_columns;