Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixed point to AllTypes in libcudf unit tests #9472

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cpp/include/cudf_test/type_list_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,8 @@ constexpr bool Exists = ExistsImpl<NEEDLE, HAYSACK>::value;
*== false_type
*
* // Used as a predicate
* using MyTypes = RemoveIf<ContainedIn<Types<Types<char, char>>,
* Types<Types<char, char>,
*Types<float,int>>>
* using MyTypes = RemoveIf<ContainedIn<Types<Types<char, char>>>,
* Types<Types<char, char>, Types<float,int>>>;
* // MyTypes == Types<float, int>
*
* ```
Expand Down Expand Up @@ -421,9 +420,8 @@ struct RemoveIfImpl<PRED, Types<HEAD, TAIL...>> {
* RemoveIf<AllSame, Types<Types<int, float, int>>> == Types<Types<int, float,
*int>>
*
* using MyTypes = RemoveIf<ContainedIn<Types<Types<char, char>>,
* Types<Types<char, char>,
*Types<float,int>>>
* using MyTypes = RemoveIf<ContainedIn<Types<Types<char, char>>>,
* Types<Types<char, char>, Types<float,int>>>;
* // MyTypes == Types<float, int>
* ```
*
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf_test/type_lists.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ using CompoundTypes =
* TYPED_TEST_CASE(MyTypedFixture, cudf::test::AllTypes);
* ```
*/
using AllTypes = Concat<NumericTypes, ChronoTypes>;
using AllTypes = Concat<NumericTypes, ChronoTypes, FixedPointTypes>;

/**
* @brief `std::array` of all `cudf::type_id`s
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/reductions/minmax.cu
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ struct minmax_functor {
template <typename T>
static constexpr bool is_supported()
{
return !(cudf::is_fixed_point<T>() || std::is_same_v<T, cudf::list_view> ||
std::is_same_v<T, cudf::struct_view>);
return !(std::is_same_v<T, cudf::list_view> || std::is_same_v<T, cudf::struct_view>);
}

template <typename T>
Expand Down Expand Up @@ -187,15 +186,16 @@ struct minmax_functor {
std::pair<std::unique_ptr<scalar>, std::unique_ptr<scalar>> operator()(
cudf::column_view const& col, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr)
{
using storage_type = device_storage_type_t<T>;
// compute minimum and maximum values
auto dev_result = reduce<T>(col, stream);
auto dev_result = reduce<storage_type>(col, stream);
// create output scalars
using ScalarType = cudf::scalar_type_t<T>;
auto minimum = new ScalarType(T{}, true, stream, mr);
auto maximum = new ScalarType(T{}, true, stream, mr);
// copy dev_result to the output scalars
device_single_thread(assign_min_max<T>{dev_result.data(), minimum->data(), maximum->data()},
stream);
device_single_thread(
assign_min_max<storage_type>{dev_result.data(), minimum->data(), maximum->data()}, stream);
return {std::unique_ptr<scalar>(minimum), std::unique_ptr<scalar>(maximum)};
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/iterator/scalar_iterator_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
#include <tests/iterator/iterator_tests.cuh>

using TestingTypes = cudf::test::AllTypes;
using TestingTypes = cudf::test::FixedWidthTypesWithoutFixedPoint;

TYPED_TEST_CASE(IteratorTest, TestingTypes);

Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/quantiles/quantile_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ template <typename T>
struct QuantileUnsupportedTypesTest : public BaseFixture {
};

using UnsupportedTestTypes = RemoveIf<ContainedIn<TestTypes>, AllTypes>;
// TODO add tests for FixedPointTypes
using UnsupportedTestTypes = RemoveIf<ContainedIn<Concat<TestTypes, FixedPointTypes>>, AllTypes>;
TYPED_TEST_CASE(QuantileUnsupportedTypesTest, UnsupportedTestTypes);

TYPED_TEST(QuantileUnsupportedTypesTest, TestZeroElements)
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/reductions/reduction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct ReductionTest : public cudf::test::BaseFixture {
using ScalarType = cudf::scalar_type_t<T_out>;
auto result1 = static_cast<ScalarType*>(result.get());
EXPECT_EQ(expected_null, !result1->is_valid());
if (result1->is_valid()) { EXPECT_EQ(expected_value, result1->value()); }
if (result1->is_valid()) { EXPECT_EQ(expected_value, T_out{result1->value()}); }
};

if (succeeded_condition) {
Expand Down Expand Up @@ -152,8 +152,8 @@ TYPED_TEST(MinMaxReductionTest, MinMax)
using ScalarType = cudf::scalar_type_t<T>;
auto min_result = static_cast<ScalarType*>(res.first.get());
auto max_result = static_cast<ScalarType*>(res.second.get());
EXPECT_EQ(min_result->value(), expected_min_result);
EXPECT_EQ(max_result->value(), expected_max_result);
EXPECT_EQ(T{min_result->value()}, expected_min_result);
EXPECT_EQ(T{max_result->value()}, expected_max_result);

// test with some nulls
cudf::test::fixed_width_column_wrapper<T> col_nulls = construct_null_column(v, host_bools);
Expand All @@ -174,8 +174,8 @@ TYPED_TEST(MinMaxReductionTest, MinMax)
using ScalarType = cudf::scalar_type_t<T>;
auto min_null_result = static_cast<ScalarType*>(null_res.first.get());
auto max_null_result = static_cast<ScalarType*>(null_res.second.get());
EXPECT_EQ(min_null_result->value(), expected_min_null_result);
EXPECT_EQ(max_null_result->value(), expected_max_null_result);
EXPECT_EQ(T{min_null_result->value()}, expected_min_null_result);
EXPECT_EQ(T{max_null_result->value()}, expected_max_null_result);

// test with all null
cudf::test::fixed_width_column_wrapper<T> col_all_nulls = construct_null_column(v, all_null);
Expand Down