From bc32205dadde4a5b09212c5400345cde8fa07207 Mon Sep 17 00:00:00 2001 From: Mike Wilson Date: Wed, 11 Sep 2024 17:57:41 +0000 Subject: [PATCH 1/2] Switching to cudf's default resource ref --- .../cpp/benchmarks/common/generate_input.cu | 12 ++--- src/main/cpp/src/bloom_filter.hpp | 8 +-- src/main/cpp/src/case_when.hpp | 2 +- src/main/cpp/src/cast_string.hpp | 12 ++--- src/main/cpp/src/datetime_rebase.cu | 4 +- src/main/cpp/src/decimal_utils.cu | 14 ++--- src/main/cpp/src/decimal_utils.hpp | 2 +- src/main/cpp/src/from_json.hpp | 2 +- src/main/cpp/src/from_json_to_raw_map.cu | 6 +-- src/main/cpp/src/get_json_object.cu | 6 +-- src/main/cpp/src/get_json_object.hpp | 4 +- src/main/cpp/src/hash.hpp | 6 +-- src/main/cpp/src/histogram.cu | 6 +-- src/main/cpp/src/histogram.hpp | 4 +- src/main/cpp/src/parse_uri.hpp | 12 ++--- src/main/cpp/src/regex_rewrite_utils.hpp | 4 +- src/main/cpp/src/row_conversion.cu | 52 +++++++++---------- src/main/cpp/src/row_conversion.hpp | 8 +-- src/main/cpp/src/substring_index.cu | 4 +- src/main/cpp/src/substring_index.hpp | 2 +- src/main/cpp/src/timezones.hpp | 4 +- src/main/cpp/src/utilities.cu | 2 +- src/main/cpp/src/utilities.hpp | 2 +- src/main/cpp/src/zorder.hpp | 4 +- src/main/cpp/tests/timezones.cpp | 12 ++--- 25 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/cpp/benchmarks/common/generate_input.cu b/src/main/cpp/benchmarks/common/generate_input.cu index d0a61d05a0..c77c745900 100644 --- a/src/main/cpp/benchmarks/common/generate_input.cu +++ b/src/main/cpp/benchmarks/common/generate_input.cu @@ -433,7 +433,7 @@ std::unique_ptr create_random_column(data_profile const& profile, null_mask.end(), thrust::identity{}, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); return std::make_unique( cudf::data_type{cudf::type_to_id()}, @@ -517,7 +517,7 @@ std::unique_ptr create_random_utf8_string_column(data_profile cons null_mask.end() - 1, thrust::identity{}, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); return cudf::make_strings_column( num_rows, @@ -553,7 +553,7 @@ std::unique_ptr create_random_column(data_profi cudf::out_of_bounds_policy::DONT_CHECK, cudf::detail::negative_index_policy::NOT_ALLOWED, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); return std::move(str_table->release()[0]); } @@ -641,7 +641,7 @@ std::unique_ptr create_random_column(data_profi valids.end(), thrust::identity{}, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); } return std::pair{}; }(); @@ -731,7 +731,7 @@ std::unique_ptr create_random_column(data_profile valids.end(), thrust::identity{}, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); list_column = cudf::make_lists_column( num_rows, std::move(offsets_column), @@ -851,7 +851,7 @@ std::pair create_random_null_mask( thrust::make_counting_iterator(size), bool_generator{seed, 1.0 - *null_probability}, cudf::get_default_stream(), - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); } } diff --git a/src/main/cpp/src/bloom_filter.hpp b/src/main/cpp/src/bloom_filter.hpp index 9bb83e0b8b..8dd5392efd 100644 --- a/src/main/cpp/src/bloom_filter.hpp +++ b/src/main/cpp/src/bloom_filter.hpp @@ -48,7 +48,7 @@ std::unique_ptr bloom_filter_create( int num_hashes, int bloom_filter_longs, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Inserts input values into a bloom filter. @@ -79,7 +79,7 @@ std::unique_ptr bloom_filter_probe( cudf::column_view const& input, cudf::device_span bloom_filter, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Probe a bloom filter with an input column of int64_t values. @@ -96,7 +96,7 @@ std::unique_ptr bloom_filter_probe( cudf::column_view const& input, cudf::list_scalar& bloom_filter, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Merge multiple bloom filters into a single output. @@ -114,6 +114,6 @@ std::unique_ptr bloom_filter_probe( std::unique_ptr bloom_filter_merge( cudf::column_view const& bloom_filters, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/case_when.hpp b/src/main/cpp/src/case_when.hpp index b7056c6c8f..0101480435 100644 --- a/src/main/cpp/src/case_when.hpp +++ b/src/main/cpp/src/case_when.hpp @@ -48,6 +48,6 @@ namespace spark_rapids_jni { std::unique_ptr select_first_true_index( cudf::table_view const& when_bool_columns, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/cast_string.hpp b/src/main/cpp/src/cast_string.hpp index 2850fbfae5..26bc16c4be 100644 --- a/src/main/cpp/src/cast_string.hpp +++ b/src/main/cpp/src/cast_string.hpp @@ -75,7 +75,7 @@ std::unique_ptr string_to_integer( bool ansi_mode, bool strip, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Convert a string column into an decimal column. @@ -97,7 +97,7 @@ std::unique_ptr string_to_decimal( bool ansi_mode, bool strip, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Convert a string column into an float column. @@ -115,22 +115,22 @@ std::unique_ptr string_to_float( cudf::strings_column_view const& string_col, bool ansi_mode, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr format_float( cudf::column_view const& input, int const digits, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr float_to_string( cudf::column_view const& input, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr decimal_to_non_ansi_string( cudf::column_view const& input, rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/datetime_rebase.cu b/src/main/cpp/src/datetime_rebase.cu index 976c9b1530..62abe01ee9 100644 --- a/src/main/cpp/src/datetime_rebase.cu +++ b/src/main/cpp/src/datetime_rebase.cu @@ -353,7 +353,7 @@ std::unique_ptr rebase_gregorian_to_julian(cudf::column_view const if (input.size() == 0) { return cudf::empty_like(input); } auto const stream = cudf::get_default_stream(); - auto const mr = rmm::mr::get_current_device_resource(); + auto const mr = cudf::get_current_device_resource_ref(); return type == cudf::type_id::TIMESTAMP_DAYS ? gregorian_to_julian_days(input, stream, mr) : gregorian_to_julian_micros(input, stream, mr); } @@ -368,7 +368,7 @@ std::unique_ptr rebase_julian_to_gregorian(cudf::column_view const if (input.size() == 0) { return cudf::empty_like(input); } auto const stream = cudf::get_default_stream(); - auto const mr = rmm::mr::get_current_device_resource(); + auto const mr = cudf::get_current_device_resource_ref(); return type == cudf::type_id::TIMESTAMP_DAYS ? julian_to_gregorian_days(input, stream, mr) : julian_to_gregorian_micros(input, stream, mr); } diff --git a/src/main/cpp/src/decimal_utils.cu b/src/main/cpp/src/decimal_utils.cu index 147818d9aa..2d2f9c193c 100644 --- a/src/main/cpp/src/decimal_utils.cu +++ b/src/main/cpp/src/decimal_utils.cu @@ -991,7 +991,7 @@ std::unique_ptr multiply_decimal128(cudf::column_view const& a, auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1026,7 +1026,7 @@ std::unique_ptr divide_decimal128(cudf::column_view const& a, auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1060,7 +1060,7 @@ std::unique_ptr integer_divide_decimal128(cudf::column_view const& auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1093,7 +1093,7 @@ std::unique_ptr remainder_decimal128(cudf::column_view const& a, auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1126,7 +1126,7 @@ std::unique_ptr add_decimal128(cudf::column_view const& a, auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1159,7 +1159,7 @@ std::unique_ptr sub_decimal128(cudf::column_view const& a, auto const num_rows = a.size(); CUDF_EXPECTS(num_rows == b.size(), "inputs have mismatched row counts"); auto [result_null_mask, result_null_count] = cudf::detail::bitmask_and( - cudf::table_view{{a, b}}, stream, rmm::mr::get_current_device_resource()); + cudf::table_view{{a, b}}, stream, cudf::get_current_device_resource_ref()); std::vector> columns; // copy the null mask here, as it will be used again later columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, @@ -1410,7 +1410,7 @@ std::pair, bool> floating_point_to_decimal( output_type, input.size(), cudf::mask_state::UNALLOCATED, stream, mr); auto const decimal_places = -output_type.scale(); - auto const default_mr = rmm::mr::get_current_device_resource(); + auto const default_mr = cudf::get_current_device_resource_ref(); rmm::device_uvector validity(input.size(), stream, default_mr); rmm::device_scalar has_failure(false, stream, default_mr); diff --git a/src/main/cpp/src/decimal_utils.hpp b/src/main/cpp/src/decimal_utils.hpp index 8673314454..86a05142e8 100644 --- a/src/main/cpp/src/decimal_utils.hpp +++ b/src/main/cpp/src/decimal_utils.hpp @@ -79,6 +79,6 @@ std::pair, bool> floating_point_to_decimal( cudf::data_type output_type, int32_t precision, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace cudf::jni diff --git a/src/main/cpp/src/from_json.hpp b/src/main/cpp/src/from_json.hpp index 75fc3bc103..dee6b5d240 100644 --- a/src/main/cpp/src/from_json.hpp +++ b/src/main/cpp/src/from_json.hpp @@ -29,6 +29,6 @@ namespace spark_rapids_jni { std::unique_ptr from_json_to_raw_map( cudf::strings_column_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/from_json_to_raw_map.cu b/src/main/cpp/src/from_json_to_raw_map.cu index 73c2c4b559..068cc7ba41 100644 --- a/src/main/cpp/src/from_json_to_raw_map.cu +++ b/src/main/cpp/src/from_json_to_raw_map.cu @@ -64,7 +64,7 @@ rmm::device_uvector unify_json_strings(cudf::strings_column_view const& in { if (input.is_empty()) { return cudf::detail::make_device_uvector_async( - std::vector{'[', ']'}, stream, rmm::mr::get_current_device_resource()); + std::vector{'[', ']'}, stream, cudf::get_current_device_resource_ref()); } auto const d_strings = cudf::column_device_view::create(input.parent(), stream); @@ -84,7 +84,7 @@ rmm::device_uvector unify_json_strings(cudf::strings_column_view const& in cudf::string_scalar(","), // append `,` character between the input rows cudf::string_scalar("{}"), // replacement for null rows stream, - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); auto const joined_input_scv = cudf::strings_column_view{*joined_input}; auto const joined_input_size_bytes = joined_input_scv.chars_size(stream); // TODO: This assertion requires a stream synchronization, may want to remove at some point. @@ -656,7 +656,7 @@ std::unique_ptr from_json_to_raw_map(cudf::strings_column_view con cudf::device_span{unified_json_buff.data(), unified_json_buff.size()}, cudf::io::json_reader_options{}, stream, - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); #ifdef DEBUG_FROM_JSON print_debug(tokens, "Tokens", ", ", stream); diff --git a/src/main/cpp/src/get_json_object.cu b/src/main/cpp/src/get_json_object.cu index f836186192..e1d375bfbf 100644 --- a/src/main/cpp/src/get_json_object.cu +++ b/src/main/cpp/src/get_json_object.cu @@ -959,7 +959,7 @@ construct_path_commands( d_path_commands.reserve(h_path_commands->size()); for (auto const& path_commands : *h_path_commands) { d_path_commands.emplace_back(cudf::detail::make_device_uvector_async( - path_commands, stream, rmm::mr::get_current_device_resource())); + path_commands, stream, cudf::get_current_device_resource_ref())); } return {std::move(d_path_commands), @@ -1060,7 +1060,7 @@ std::vector> get_json_object_batch( d_error_check.data() + idx}); } auto d_path_data = cudf::detail::make_device_uvector_async( - h_path_data, stream, rmm::mr::get_current_device_resource()); + h_path_data, stream, cudf::get_current_device_resource_ref()); thrust::uninitialized_fill( rmm::exec_policy(stream), d_error_check.begin(), d_error_check.end(), 0); @@ -1130,7 +1130,7 @@ std::vector> get_json_object_batch( // Push data to the GPU and launch the kernel again. d_path_data = cudf::detail::make_device_uvector_async( - h_path_data, stream, rmm::mr::get_current_device_resource()); + h_path_data, stream, cudf::get_current_device_resource_ref()); thrust::uninitialized_fill( rmm::exec_policy(stream), d_error_check.begin(), d_error_check.end(), 0); kernel_launcher::exec(input, d_path_data, d_max_path_depth_exceeded, stream); diff --git a/src/main/cpp/src/get_json_object.hpp b/src/main/cpp/src/get_json_object.hpp index 0cc773517f..78b3deb2ea 100644 --- a/src/main/cpp/src/get_json_object.hpp +++ b/src/main/cpp/src/get_json_object.hpp @@ -45,7 +45,7 @@ std::unique_ptr get_json_object( cudf::strings_column_view const& input, std::vector> const& instructions, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Extract multiple JSON objects from a JSON string based on the specified JSON paths. @@ -67,6 +67,6 @@ std::vector> get_json_object_multiple_paths( int64_t memory_budget_bytes, int32_t parallel_override, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/hash.hpp b/src/main/cpp/src/hash.hpp index 4021b9e75c..2e5e2a9db8 100644 --- a/src/main/cpp/src/hash.hpp +++ b/src/main/cpp/src/hash.hpp @@ -40,7 +40,7 @@ std::unique_ptr murmur_hash3_32( cudf::table_view const& input, uint32_t seed = 0, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Computes the xxhash64 hash value of each row in the input set of columns. @@ -56,7 +56,7 @@ std::unique_ptr xxhash64( cudf::table_view const& input, int64_t seed = DEFAULT_XXHASH64_SEED, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Computes the Hive hash value of each row in the input set of columns. @@ -70,6 +70,6 @@ std::unique_ptr xxhash64( std::unique_ptr hive_hash( cudf::table_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/histogram.cu b/src/main/cpp/src/histogram.cu index b78c5ae1e0..e3909c66ea 100644 --- a/src/main/cpp/src/histogram.cu +++ b/src/main/cpp/src/histogram.cu @@ -192,7 +192,7 @@ struct percentile_dispatcher { // - Having nulls in the input, and/or, // - Having empty histograms. auto out_validities = - rmm::device_uvector(num_histograms, stream, rmm::mr::get_current_device_resource()); + rmm::device_uvector(num_histograms, stream, cudf::get_current_device_resource_ref()); auto const fill_percentile = [&](auto const sorted_validity_it) { auto const sorted_input_it = @@ -307,7 +307,7 @@ std::unique_ptr create_histogram_if_valid(cudf::column_view const& } } - auto const default_mr = rmm::mr::get_current_device_resource(); + auto const default_mr = cudf::get_current_device_resource_ref(); // We only check if there is any row in frequencies that are negative (invalid) or zero. auto check_invalid_and_zero = @@ -439,7 +439,7 @@ std::unique_ptr percentile_from_histogram(cudf::column_view const& auto const data_col = cudf::structs_column_view{histograms}.get_sliced_child(0); auto const counts_col = cudf::structs_column_view{histograms}.get_sliced_child(1); - auto const default_mr = rmm::mr::get_current_device_resource(); + auto const default_mr = cudf::get_current_device_resource_ref(); auto const d_data = cudf::column_device_view::create(data_col, stream); auto const d_percentages = cudf::detail::make_device_uvector_sync(percentages, stream, default_mr); diff --git a/src/main/cpp/src/histogram.hpp b/src/main/cpp/src/histogram.hpp index 23318bdfac..ed5758396d 100644 --- a/src/main/cpp/src/histogram.hpp +++ b/src/main/cpp/src/histogram.hpp @@ -52,7 +52,7 @@ std::unique_ptr create_histogram_if_valid( cudf::column_view const& frequencies, bool output_as_lists, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Compute percentiles from the given histograms and percentage values. @@ -72,6 +72,6 @@ std::unique_ptr percentile_from_histogram( std::vector const& percentage, bool output_as_lists, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/parse_uri.hpp b/src/main/cpp/src/parse_uri.hpp index 2afc879cba..923e3127db 100644 --- a/src/main/cpp/src/parse_uri.hpp +++ b/src/main/cpp/src/parse_uri.hpp @@ -38,7 +38,7 @@ namespace spark_rapids_jni { std::unique_ptr parse_uri_to_protocol( cudf::strings_column_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Parse host and copy from the input string column to the output string column. @@ -51,7 +51,7 @@ std::unique_ptr parse_uri_to_protocol( std::unique_ptr parse_uri_to_host( cudf::strings_column_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Parse query and copy from the input string column to the output string column. @@ -64,7 +64,7 @@ std::unique_ptr parse_uri_to_host( std::unique_ptr parse_uri_to_query( cudf::strings_column_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Parse query and copy from the input string column to the output string column. @@ -79,7 +79,7 @@ std::unique_ptr parse_uri_to_query( cudf::strings_column_view const& input, std::string const& query_match, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Parse query and copy from the input string column to the output string column. @@ -94,7 +94,7 @@ std::unique_ptr parse_uri_to_query( cudf::strings_column_view const& input, cudf::strings_column_view const& query_match, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Parse path and copy from the input string column to the output string column. @@ -107,6 +107,6 @@ std::unique_ptr parse_uri_to_query( std::unique_ptr parse_uri_to_path( cudf::strings_column_view const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/regex_rewrite_utils.hpp b/src/main/cpp/src/regex_rewrite_utils.hpp index e5e500b180..4067423ce3 100644 --- a/src/main/cpp/src/regex_rewrite_utils.hpp +++ b/src/main/cpp/src/regex_rewrite_utils.hpp @@ -40,6 +40,6 @@ std::unique_ptr literal_range_pattern( int const len, int const start, int const end, - rmm::cuda_stream_view stream = rmm::cuda_stream_default, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::cuda_stream_view stream = cudf::get_default_stream(), + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/row_conversion.cu b/src/main/cpp/src/row_conversion.cu index 4ad3927a41..756c52e052 100644 --- a/src/main/cpp/src/row_conversion.cu +++ b/src/main/cpp/src/row_conversion.cu @@ -223,7 +223,7 @@ build_string_row_offsets(table_view const& tbl, std::back_inserter(offsets_iterators), thrust::identity{}); return make_device_uvector_sync( - offsets_iterators, stream, rmm::mr::get_current_device_resource()); + offsets_iterators, stream, cudf::get_current_device_resource_ref()); }(); auto const num_columns = static_cast(d_offsets_iterators.size()); @@ -1540,11 +1540,11 @@ batch_data build_batches(size_type num_rows, last_row_end = row_end; } - 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)}; + return {std::move(batch_row_offsets), + make_device_uvector_async( + batch_row_boundaries, stream, cudf::get_current_device_resource_ref()), + std::move(batch_row_boundaries), + std::move(row_batches)}; } /** @@ -1786,9 +1786,9 @@ std::vector> convert_to_rows( }; auto dev_col_sizes = make_device_uvector_async( - column_info.column_sizes, stream, rmm::mr::get_current_device_resource()); + column_info.column_sizes, stream, cudf::get_current_device_resource_ref()); auto dev_col_starts = make_device_uvector_async( - column_info.column_starts, stream, rmm::mr::get_current_device_resource()); + column_info.column_starts, stream, cudf::get_current_device_resource_ref()); // Get the pointers to the input columnar data ready auto const data_begin = thrust::make_transform_iterator(tbl.begin(), [](auto const& c) { @@ -1802,9 +1802,9 @@ std::vector> convert_to_rows( std::vector input_nm(nm_begin, nm_begin + tbl.num_columns()); auto dev_input_data = - make_device_uvector_async(input_data, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(input_data, stream, cudf::get_current_device_resource_ref()); auto dev_input_nm = - make_device_uvector_async(input_nm, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(input_nm, stream, cudf::get_current_device_resource_ref()); // the first batch always exists unless we were sent an empty table auto const first_batch_size = batch_info.row_batches[0].row_count; @@ -1868,7 +1868,7 @@ std::vector> convert_to_rows( 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, rmm::mr::get_current_device_resource()); + make_device_uvector_async(validity_tile_infos, stream, cudf::get_current_device_resource_ref()); auto const validity_offset = column_info.column_starts.back(); @@ -1916,9 +1916,9 @@ std::vector> convert_to_rows( 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, rmm::mr::get_current_device_resource()); + variable_width_input_data, stream, cudf::get_current_device_resource_ref()); auto dev_variable_col_output_offsets = make_device_uvector_async( - column_info.variable_width_column_starts, stream, rmm::mr::get_current_device_resource()); + column_info.variable_width_column_starts, stream, cudf::get_current_device_resource_ref()); for (uint i = 0; i < batch_info.row_batches.size(); i++) { auto const batch_row_offset = batch_info.batch_row_boundaries[i]; @@ -2191,9 +2191,9 @@ std::unique_ptr convert_from_rows(lists_column_view const& input, // 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, rmm::mr::get_current_device_resource()); + column_info.column_starts, stream, cudf::get_current_device_resource_ref()); auto dev_col_sizes = make_device_uvector_async( - column_info.column_sizes, stream, rmm::mr::get_current_device_resource()); + column_info.column_sizes, stream, cudf::get_current_device_resource_ref()); // Allocate the columns we are going to write into std::vector> output_columns; @@ -2223,11 +2223,11 @@ std::unique_ptr
convert_from_rows(lists_column_view const& input, if (i.id() == type_id::STRING) { auto const int32type = data_type(type_id::INT32); auto offset_col = - make_col(int32type, num_rows, true, stream, rmm::mr::get_current_device_resource()); + make_col(int32type, num_rows, true, stream, cudf::get_current_device_resource_ref()); string_row_offsets.push_back(offset_col->mutable_view().data()); string_row_offset_columns.emplace_back(std::move(offset_col)); auto length_col = - make_col(int32type, num_rows, false, stream, rmm::mr::get_current_device_resource()); + make_col(int32type, num_rows, false, stream, cudf::get_current_device_resource_ref()); string_lengths.push_back(length_col->mutable_view().data()); string_length_columns.emplace_back(std::move(length_col)); // placeholder @@ -2238,9 +2238,9 @@ std::unique_ptr
convert_from_rows(lists_column_view const& input, } auto dev_string_row_offsets = - make_device_uvector_async(string_row_offsets, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(string_row_offsets, stream, cudf::get_current_device_resource_ref()); auto dev_string_lengths = - make_device_uvector_async(string_lengths, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(string_lengths, stream, cudf::get_current_device_resource_ref()); // build the row_batches from the passed in list column std::vector row_batches; @@ -2248,9 +2248,9 @@ std::unique_ptr
convert_from_rows(lists_column_view const& input, {detail::row_batch{child.size(), num_rows, device_uvector(0, stream)}}); auto dev_output_data = - make_device_uvector_async(output_data, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(output_data, stream, cudf::get_current_device_resource_ref()); auto dev_output_nm = - make_device_uvector_async(output_nm, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(output_nm, stream, cudf::get_current_device_resource_ref()); // only ever get a single batch when going from rows, so boundaries are 0, num_rows constexpr auto num_batches = 2; @@ -2304,7 +2304,7 @@ std::unique_ptr
convert_from_rows(lists_column_view const& input, 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, rmm::mr::get_current_device_resource()); + make_device_uvector_async(validity_tile_infos, stream, cudf::get_current_device_resource_ref()); dim3 const validity_blocks(validity_tile_infos.size()); @@ -2393,9 +2393,9 @@ std::unique_ptr
convert_from_rows(lists_column_view const& input, string_data_cols.push_back(std::move(string_data)); } auto dev_string_col_offsets = make_device_uvector_async( - string_col_offset_ptrs, stream, rmm::mr::get_current_device_resource()); + string_col_offset_ptrs, stream, cudf::get_current_device_resource_ref()); auto dev_string_data_cols = make_device_uvector_async( - string_data_col_ptrs, stream, rmm::mr::get_current_device_resource()); + string_data_col_ptrs, stream, cudf::get_current_device_resource_ref()); dim3 const string_blocks( std::min(std::max(MIN_STRING_BLOCKS, num_rows / NUM_STRING_ROWS_PER_BLOCK_FROM_ROWS), @@ -2466,9 +2466,9 @@ std::unique_ptr
convert_from_rows_fixed_width_optimized(lists_column_view 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, rmm::mr::get_current_device_resource()); + make_device_uvector_async(column_start, stream, cudf::get_current_device_resource_ref()); auto dev_column_size = - make_device_uvector_async(column_size, stream, rmm::mr::get_current_device_resource()); + make_device_uvector_async(column_size, stream, cudf::get_current_device_resource_ref()); // Allocate the columns we are going to write into std::vector> output_columns; diff --git a/src/main/cpp/src/row_conversion.hpp b/src/main/cpp/src/row_conversion.hpp index 0aa7593516..9e497209cf 100644 --- a/src/main/cpp/src/row_conversion.hpp +++ b/src/main/cpp/src/row_conversion.hpp @@ -31,24 +31,24 @@ std::vector> convert_to_rows_fixed_width_optimized cudf::table_view const& tbl, // TODO need something for validity rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::vector> convert_to_rows( cudf::table_view const& tbl, // TODO need something for validity rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr convert_from_rows_fixed_width_optimized( cudf::lists_column_view const& input, std::vector const& schema, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr convert_from_rows( cudf::lists_column_view const& input, std::vector const& schema, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/substring_index.cu b/src/main/cpp/src/substring_index.cu index c685b3b7c9..4e9d997e0d 100644 --- a/src/main/cpp/src/substring_index.cu +++ b/src/main/cpp/src/substring_index.cu @@ -124,11 +124,11 @@ std::unique_ptr substring_index(strings_column_view const& strings, auto start_chars_pos_vec = make_column_from_scalar(numeric_scalar(0, true, stream), strings_count, stream, - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); auto stop_chars_pos_vec = make_column_from_scalar(numeric_scalar(0, true, stream), strings_count, stream, - rmm::mr::get_current_device_resource()); + cudf::get_current_device_resource_ref()); auto start_char_pos = start_chars_pos_vec->mutable_view().data(); auto end_char_pos = stop_chars_pos_vec->mutable_view().data(); diff --git a/src/main/cpp/src/substring_index.hpp b/src/main/cpp/src/substring_index.hpp index aacfc9b813..59bbda0e17 100644 --- a/src/main/cpp/src/substring_index.hpp +++ b/src/main/cpp/src/substring_index.hpp @@ -35,6 +35,6 @@ std::unique_ptr substring_index( cudf::strings_column_view const& strings, cudf::string_scalar const& delimiter, cudf::size_type count, - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/timezones.hpp b/src/main/cpp/src/timezones.hpp index 00173075b6..0d61f0a719 100644 --- a/src/main/cpp/src/timezones.hpp +++ b/src/main/cpp/src/timezones.hpp @@ -44,7 +44,7 @@ std::unique_ptr convert_timestamp_to_utc( cudf::table_view const& transitions, cudf::size_type tz_index, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); /** * @brief Convert input column timestamps in UTC to specified timezone @@ -65,6 +65,6 @@ std::unique_ptr convert_utc_timestamp_to_timezone( cudf::table_view const& transitions, cudf::size_type tz_index, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni \ No newline at end of file diff --git a/src/main/cpp/src/utilities.cu b/src/main/cpp/src/utilities.cu index 0b44a2a994..969cfeb7fe 100644 --- a/src/main/cpp/src/utilities.cu +++ b/src/main/cpp/src/utilities.cu @@ -48,7 +48,7 @@ std::unique_ptr bitmask_bitwise_or( std::transform( input.begin(), input.end(), h_input.begin(), [](auto mask) { return mask.data(); }); auto d_input = cudf::detail::make_device_uvector_async( - h_input, stream, rmm::mr::get_current_device_resource()); + h_input, stream, cudf::get_current_device_resource_ref()); std::unique_ptr out = std::make_unique(mask_size * sizeof(cudf::bitmask_type), stream, mr); diff --git a/src/main/cpp/src/utilities.hpp b/src/main/cpp/src/utilities.hpp index ad0eae7dc6..9f1cd6fec7 100644 --- a/src/main/cpp/src/utilities.hpp +++ b/src/main/cpp/src/utilities.hpp @@ -37,6 +37,6 @@ namespace spark_rapids_jni { std::unique_ptr bitmask_bitwise_or( std::vector> const& input, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/src/zorder.hpp b/src/main/cpp/src/zorder.hpp index 1e084a09de..83a3272232 100644 --- a/src/main/cpp/src/zorder.hpp +++ b/src/main/cpp/src/zorder.hpp @@ -29,12 +29,12 @@ namespace spark_rapids_jni { std::unique_ptr interleave_bits( cudf::table_view const& tbl, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); std::unique_ptr hilbert_index( int32_t const num_bits, cudf::table_view const& tbl, rmm::cuda_stream_view stream = cudf::get_default_stream(), - rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource()); + rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); } // namespace spark_rapids_jni diff --git a/src/main/cpp/tests/timezones.cpp b/src/main/cpp/tests/timezones.cpp index 9801a3c0a4..da6a55871a 100644 --- a/src/main/cpp/tests/timezones.cpp +++ b/src/main/cpp/tests/timezones.cpp @@ -111,7 +111,7 @@ TEST_F(TimeZoneTest, ConvertToUTCSeconds) 1699537367L, 568008000L}; auto const actual = spark_rapids_jni::convert_timestamp_to_utc( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } @@ -140,7 +140,7 @@ TEST_F(TimeZoneTest, ConvertToUTCMilliseconds) 1699542834312L, 568008000000L}; auto const actual = spark_rapids_jni::convert_timestamp_to_utc( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } @@ -169,7 +169,7 @@ TEST_F(TimeZoneTest, ConvertToUTCMicroseconds) 1699542834312000L, 568008000000000L}; auto const actual = spark_rapids_jni::convert_timestamp_to_utc( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } @@ -198,7 +198,7 @@ TEST_F(TimeZoneTest, ConvertFromUTCSeconds) 568036800L, }; auto const actual = spark_rapids_jni::convert_utc_timestamp_to_timezone( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } @@ -227,7 +227,7 @@ TEST_F(TimeZoneTest, ConvertFromUTCMilliseconds) 568036800000L, }; auto const actual = spark_rapids_jni::convert_utc_timestamp_to_timezone( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } @@ -256,7 +256,7 @@ TEST_F(TimeZoneTest, ConvertFromUTCMicroseconds) 568036800000000L, }; auto const actual = spark_rapids_jni::convert_utc_timestamp_to_timezone( - ts_col, *transitions, 1, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); + ts_col, *transitions, 1, cudf::get_default_stream(), cudf::get_current_device_resource_ref()); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *actual); } \ No newline at end of file From 48f668c8866433524039620cfd91ef45b4ae4b6d Mon Sep 17 00:00:00 2001 From: Mike Wilson Date: Thu, 17 Oct 2024 23:34:43 +0000 Subject: [PATCH 2/2] signoff Signed-off-by: Mike Wilson