21 #include <cudf/detail/utilities/vector_factories.hpp>
28 #include <thrust/host_vector.h>
29 #include <thrust/iterator/transform_iterator.h>
31 namespace cudf::test {
36 enum class debug_output_level {
60 debug_output_level verbosity = debug_output_level::FIRST_ERROR);
78 bool expect_column_properties_equivalent(
81 debug_output_level verbosity = debug_output_level::FIRST_ERROR);
99 debug_output_level verbosity = debug_output_level::FIRST_ERROR);
120 debug_output_level verbosity = debug_output_level::FIRST_ERROR,
121 size_type fp_ulps = cudf::test::default_ulp);
132 void expect_equal_buffers(
void const* lhs,
void const* rhs, std::size_t size_bytes);
162 bool validate_host_masks(std::vector<bitmask_type>
const& expected_mask,
163 std::vector<bitmask_type>
const& got_mask_begin,
174 template <typename T, std::enable_if_t<not cudf::is_fixed_point<T>()>* =
nullptr>
175 std::pair<thrust::host_vector<T>, std::vector<bitmask_type>> to_host(column_view c)
177 thrust::host_vector<T> host_data(c.size());
178 CUDF_CUDA_TRY(cudaMemcpy(host_data.data(), c.data<T>(), c.size() *
sizeof(T), cudaMemcpyDefault));
179 return {host_data, bitmask_to_host(c)};
196 template <typename T, std::enable_if_t<cudf::is_fixed_point<T>()>* =
nullptr>
197 std::pair<thrust::host_vector<T>, std::vector<bitmask_type>> to_host(column_view c)
200 using Rep =
typename T::rep;
202 auto host_rep_types = thrust::host_vector<Rep>(c.size());
205 cudaMemcpy(host_rep_types.data(), c.begin<Rep>(), c.size() *
sizeof(Rep), cudaMemcpyDefault));
208 auto begin = thrust::make_transform_iterator(std::cbegin(host_rep_types), to_fp);
209 auto const host_fixed_points = thrust::host_vector<T>(begin, begin + c.size());
211 return {host_fixed_points, bitmask_to_host(c)};
226 inline std::pair<thrust::host_vector<std::string>, std::vector<bitmask_type>> to_host(column_view c)
228 thrust::host_vector<std::string> host_data(c.size());
230 if (c.size() > c.null_count()) {
231 auto const scv = strings_column_view(c);
232 auto const h_chars = cudf::detail::make_std_vector_sync<char>(
234 auto const h_offsets = cudf::detail::make_std_vector_sync(
241 std::begin(h_offsets),
242 std::end(h_offsets) - 1,
243 std::begin(h_offsets) + 1,
245 [&](
auto start,
auto end) { return std::string(h_chars.data() + start, end - start); });
247 return {std::move(host_data), bitmask_to_host(c)};
253 #define CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUAL(lhs, rhs) \
255 SCOPED_TRACE(" <-- line of failure\n"); \
256 cudf::test::detail::expect_column_properties_equal(lhs, rhs); \
259 #define CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUIVALENT(lhs, rhs) \
261 SCOPED_TRACE(" <-- line of failure\n"); \
262 cudf::test::detail::expect_column_properties_equivalent(lhs, rhs); \
265 #define CUDF_TEST_EXPECT_COLUMNS_EQUAL(lhs, rhs...) \
267 SCOPED_TRACE(" <-- line of failure\n"); \
268 cudf::test::detail::expect_columns_equal(lhs, rhs); \
271 #define CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(lhs, rhs...) \
273 SCOPED_TRACE(" <-- line of failure\n"); \
274 cudf::test::detail::expect_columns_equivalent(lhs, rhs); \
277 #define CUDF_TEST_EXPECT_EQUAL_BUFFERS(lhs, rhs, size_bytes) \
279 SCOPED_TRACE(" <-- line of failure\n"); \
280 cudf::test::detail::expect_equal_buffers(lhs, rhs, size_bytes); \
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Class definition for cudf::column.
column view class definitions
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
scale_type
The scale type for fixed_point.
#define CUDF_CUDA_TRY(call)
Error checking macro for CUDA runtime API functions.
int32_t size_type
Row index type for columns and tables.
fixed_point and supporting types
APIs for managing validity bitmasks.
Class definition for cudf::strings_column_view.
Device version of C++20 std::span with reduced feature set.
Helper struct for constructing fixed_point when value is already shifted.
scale_type scale
The scale of the value.
Type declarations for libcudf.