21 #include <cudf/detail/utilities/vector_factories.hpp>
25 #include <cudf/utilities/default_stream.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)};
193 template <typename T, std::enable_if_t<cudf::is_fixed_point<T>()>* =
nullptr>
194 std::pair<thrust::host_vector<T>, std::vector<bitmask_type>> to_host(column_view c)
197 using Rep =
typename T::rep;
199 auto host_rep_types = thrust::host_vector<Rep>(c.size());
202 cudaMemcpy(host_rep_types.data(), c.begin<Rep>(), c.size() *
sizeof(Rep), cudaMemcpyDefault));
205 auto begin = thrust::make_transform_iterator(std::cbegin(host_rep_types), to_fp);
206 auto const host_fixed_points = thrust::host_vector<T>(begin, begin + c.size());
208 return {host_fixed_points, bitmask_to_host(c)};
222 inline std::pair<thrust::host_vector<std::string>, std::vector<bitmask_type>> to_host(column_view c)
224 thrust::host_vector<std::string> host_data(c.size());
225 if (c.size() > c.null_count()) {
226 auto const scv = strings_column_view(c);
227 auto const h_chars = cudf::detail::make_std_vector_sync<char>(
230 auto const h_offsets = cudf::detail::make_std_vector_sync(
237 std::begin(h_offsets),
238 std::end(h_offsets) - 1,
239 std::begin(h_offsets) + 1,
241 [&](
auto start,
auto end) { return std::string(h_chars.data() + start, end - start); });
243 return {std::move(host_data), bitmask_to_host(c)};
249 #define CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUAL(lhs, rhs) \
251 SCOPED_TRACE(" <-- line of failure\n"); \
252 cudf::test::detail::expect_column_properties_equal(lhs, rhs); \
255 #define CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUIVALENT(lhs, rhs) \
257 SCOPED_TRACE(" <-- line of failure\n"); \
258 cudf::test::detail::expect_column_properties_equivalent(lhs, rhs); \
261 #define CUDF_TEST_EXPECT_COLUMNS_EQUAL(lhs, rhs...) \
263 SCOPED_TRACE(" <-- line of failure\n"); \
264 cudf::test::detail::expect_columns_equal(lhs, rhs); \
267 #define CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(lhs, rhs...) \
269 SCOPED_TRACE(" <-- line of failure\n"); \
270 cudf::test::detail::expect_columns_equivalent(lhs, rhs); \
273 #define CUDF_TEST_EXPECT_EQUAL_BUFFERS(lhs, rhs, size_bytes) \
275 SCOPED_TRACE(" <-- line of failure\n"); \
276 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
#define CUDF_CUDA_TRY(call)
Error checking macro for CUDA runtime API functions.
int32_t size_type
Row index type for columns and tables.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
fixed_point and supporting types
scale_type
The scale type for fixed_point.
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.