diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 215d93d4119..4360b418e95 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -203,7 +203,7 @@ ConfigureTest(SORT_TEST ################################################################################################### # - copying tests --------------------------------------------------------------------------------- ConfigureTest(COPYING_TEST - copying/concatenate_tests.cu + copying/concatenate_tests.cpp copying/copy_if_else_nested_tests.cpp copying/copy_range_tests.cpp copying/copy_tests.cu diff --git a/cpp/tests/copying/concatenate_tests.cu b/cpp/tests/copying/concatenate_tests.cpp similarity index 97% rename from cpp/tests/copying/concatenate_tests.cu rename to cpp/tests/copying/concatenate_tests.cpp index a5564062de6..2e390039a31 100644 --- a/cpp/tests/copying/concatenate_tests.cu +++ b/cpp/tests/copying/concatenate_tests.cpp @@ -29,11 +29,9 @@ #include #include -#include - #include -#include +#include #include template @@ -53,14 +51,21 @@ struct TypedColumnTest : public cudf::test::BaseFixture { static std::size_t mask_size() { return 100; } cudf::data_type type() { return cudf::data_type{cudf::type_to_id()}; } - TypedColumnTest() - : data{_num_elements * cudf::size_of(type()), rmm::cuda_stream_default}, - mask{cudf::bitmask_allocation_size_bytes(_num_elements), rmm::cuda_stream_default} + TypedColumnTest(rmm::cuda_stream_view stream = rmm::cuda_stream_default) + : data{_num_elements * cudf::size_of(type()), stream}, + mask{cudf::bitmask_allocation_size_bytes(_num_elements), stream} { auto typed_data = static_cast(data.data()); auto typed_mask = static_cast(mask.data()); - thrust::sequence(thrust::device, typed_data, typed_data + data_size()); - thrust::sequence(thrust::device, typed_mask, typed_mask + mask_size()); + std::vector h_data(data_size()); + std::iota(h_data.begin(), h_data.end(), char{0}); + std::vector h_mask(mask_size()); + std::iota(h_mask.begin(), h_mask.end(), char{0}); + CUDA_TRY(cudaMemcpyAsync( + typed_data, h_data.data(), data_size(), cudaMemcpyHostToDevice, stream.value())); + CUDA_TRY(cudaMemcpyAsync( + typed_mask, h_mask.data(), mask_size(), cudaMemcpyHostToDevice, stream.value())); + stream.synchronize(); } cudf::size_type num_elements() { return _num_elements; } @@ -703,7 +708,7 @@ TEST_F(ListsColumnTest, ConcatenateEmptyLists) } { - cudf::test::lists_column_wrapper a{{LCW{}}}; + cudf::test::lists_column_wrapper a{LCW{}}; cudf::test::lists_column_wrapper b{4, 5, 6, 7}; cudf::test::lists_column_wrapper expected{LCW{}, {4, 5, 6, 7}}; @@ -713,7 +718,7 @@ TEST_F(ListsColumnTest, ConcatenateEmptyLists) } { - cudf::test::lists_column_wrapper a{{LCW{}}}, b{{LCW{}}}, c{{LCW{}}}; + cudf::test::lists_column_wrapper a{LCW{}}, b{LCW{}}, c{LCW{}}; cudf::test::lists_column_wrapper d{4, 5, 6, 7}; cudf::test::lists_column_wrapper expected{LCW{}, LCW{}, LCW{}, {4, 5, 6, 7}}; @@ -724,7 +729,7 @@ TEST_F(ListsColumnTest, ConcatenateEmptyLists) { cudf::test::lists_column_wrapper a{1, 2}; - cudf::test::lists_column_wrapper b{{LCW{}}}, c{{LCW{}}}; + cudf::test::lists_column_wrapper b{LCW{}}, c{LCW{}}; cudf::test::lists_column_wrapper d{4, 5, 6, 7}; cudf::test::lists_column_wrapper expected{{1, 2}, LCW{}, LCW{}, {4, 5, 6, 7}}; @@ -797,10 +802,10 @@ TEST_F(ListsColumnTest, ConcatenateNestedEmptyLists) // empty lists in lists_column_wrapper documentation using LCW = cudf::test::lists_column_wrapper; { - cudf::test::lists_column_wrapper a{{{LCW{}}}, {{0, 1}, {2, 3}}}; + cudf::test::lists_column_wrapper a{{LCW{}}, {{0, 1}, {2, 3}}}; cudf::test::lists_column_wrapper b{{{6, 7}}, {LCW{}, {11, 12}}}; cudf::test::lists_column_wrapper expected{ - {{LCW{}}}, {{0, 1}, {2, 3}}, {{6, 7}}, {LCW{}, {11, 12}}}; + {LCW{}}, {{0, 1}, {2, 3}}, {{6, 7}}, {LCW{}, {11, 12}}}; auto result = cudf::concatenate(std::vector({a, b})); @@ -810,23 +815,23 @@ TEST_F(ListsColumnTest, ConcatenateNestedEmptyLists) { cudf::test::lists_column_wrapper a{ {{{0, 1, 2}, LCW{}}, {{5}, {6, 7}}, {{8, 9}}}, - {{{LCW{}}}, {{17, 18}, {19, 20}}}, - {{{LCW{}}}}, + {{LCW{}}, {{17, 18}, {19, 20}}}, + {{LCW{}}}, {{{50}, {51, 52}}, {{53, 54}, {55, 16, 17}}, {{59, 60}}}}; cudf::test::lists_column_wrapper b{ {{{21, 22}, {23, 24}}, {LCW{}, {26, 27}}, {{28, 29, 30}}}, {{{31, 32}, {33, 34}}, {{35, 36}, {37, 38}, {1, 2}}, {{39, 40}}}, - {{{LCW{}}}}}; + {{LCW{}}}}; cudf::test::lists_column_wrapper expected{ {{{0, 1, 2}, LCW{}}, {{5}, {6, 7}}, {{8, 9}}}, - {{{LCW{}}}, {{17, 18}, {19, 20}}}, - {{{LCW{}}}}, + {{LCW{}}, {{17, 18}, {19, 20}}}, + {{LCW{}}}, {{{50}, {51, 52}}, {{53, 54}, {55, 16, 17}}, {{59, 60}}}, {{{21, 22}, {23, 24}}, {LCW{}, {26, 27}}, {{28, 29, 30}}}, {{{31, 32}, {33, 34}}, {{35, 36}, {37, 38}, {1, 2}}, {{39, 40}}}, - {{{LCW{}}}}}; + {{LCW{}}}}; auto result = cudf::concatenate(std::vector({a, b}));