diff --git a/common/cuda_hip/base/math.hpp.inc b/common/cuda_hip/base/math.hpp.inc index fa2850c10d6..39ab5e8baf5 100644 --- a/common/cuda_hip/base/math.hpp.inc +++ b/common/cuda_hip/base/math.hpp.inc @@ -39,6 +39,13 @@ struct device_numeric_limits { static constexpr auto min = std::numeric_limits::min(); }; +template <> +struct device_numeric_limits<__half> { + static constexpr auto inf = std::numeric_limits::infinity(); + static constexpr auto max = std::numeric_limits::max(); + static constexpr auto min = std::numeric_limits::min(); +}; + namespace detail { diff --git a/core/test/utils.hpp b/core/test/utils.hpp index 423f0972e36..6bb9703f4b0 100644 --- a/core/test/utils.hpp +++ b/core/test/utils.hpp @@ -137,7 +137,6 @@ using ValueIndexTypes = std::tuple, std::tuple, gko::int32>, std::tuple, gko::int32>, - std::tuple, std::tuple, gko::int64>>; #else @@ -145,7 +144,6 @@ using ValueIndexTypes = std::tuple, std::tuple, std::tuple, std::tuple, gko::int32>, - std::tuple, gko::int32>, std::tuple, gko::int32>, std::tuple, gko::int32>, std::tuple, std::tuple, @@ -367,7 +365,7 @@ using next_precision = typename detail::next_precision_impl::type; #define SKIP_IF_HALF(type) \ if (std::is_same, gko::half>::value) { \ - GTEST_SKIP() << "Skip due to single mode"; \ + GTEST_SKIP() << "Skip due to half mode"; \ } \ static_assert(true, \ "This assert is used to counter the false positive extra " \ diff --git a/reference/test/factorization/lu_kernels.cpp b/reference/test/factorization/lu_kernels.cpp index 5cde9f132d3..9c6934dcb27 100644 --- a/reference/test/factorization/lu_kernels.cpp +++ b/reference/test/factorization/lu_kernels.cpp @@ -238,7 +238,7 @@ TYPED_TEST(Lu, KernelFactorizeWorks) diag_idxs.get_const_data(), this->mtx_lu.get(), tmp); GKO_ASSERT_MTX_NEAR(this->mtx_lu, mtx_lu_ref, - 15 * r::value); + 30 * r::value); }); } @@ -284,7 +284,7 @@ TYPED_TEST(Lu, FactorizeNonsymmetricWorks) GKO_ASSERT_MTX_EQ_SPARSITY(lu->get_combined(), this->mtx_lu); GKO_ASSERT_MTX_NEAR(lu->get_combined(), this->mtx_lu, - 15 * r::value); + 30 * r::value); ASSERT_EQ(lu->get_storage_type(), gko::experimental::factorization::storage_type::combined_lu); ASSERT_EQ(lu->get_lower_factor(), nullptr); @@ -311,7 +311,7 @@ TYPED_TEST(Lu, FactorizeWithKnownSparsityWorks) auto lu = factory->generate(this->mtx); GKO_ASSERT_MTX_NEAR(lu->get_combined(), this->mtx_lu, - 15 * r::value); + 30 * r::value); ASSERT_EQ(lu->get_storage_type(), gko::experimental::factorization::storage_type::combined_lu); ASSERT_EQ(lu->get_lower_factor(), nullptr); diff --git a/reference/test/preconditioner/isai_kernels.cpp b/reference/test/preconditioner/isai_kernels.cpp index eea171d60fe..b9d3eb9bcff 100644 --- a/reference/test/preconditioner/isai_kernels.cpp +++ b/reference/test/preconditioner/isai_kernels.cpp @@ -1013,6 +1013,8 @@ TYPED_TEST(Isai, ReturnsCorrectInverseA) TYPED_TEST(Isai, ReturnsCorrectInverseALongrow) { using value_type = typename TestFixture::value_type; + // TODO: figure out whether relaxed residual norm works in half or not. + SKIP_IF_HALF(value_type); const auto isai = this->general_isai_factory->generate(this->a_csr_longrow); auto a_inv = isai->get_approximate_inverse(); @@ -1029,6 +1031,7 @@ TYPED_TEST(Isai, ReturnsCorrectInverseALongrowWithExcessSolver) { using value_type = typename TestFixture::value_type; using GeneralIsai = typename TestFixture::GeneralIsai; + SKIP_IF_HALF(value_type); auto general_isai_factory = GeneralIsai::build() .with_excess_solver_factory(this->excess_solver_factory) @@ -1076,6 +1079,7 @@ TYPED_TEST(Isai, ReturnsCorrectInverseLLongrowWithExcessSolver) using Csr = typename TestFixture::Csr; using LowerIsai = typename TestFixture::LowerIsai; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto lower_isai_factory = LowerIsai::build() .with_excess_solver_factory(this->excess_solver_factory) @@ -1123,6 +1127,7 @@ TYPED_TEST(Isai, ReturnsCorrectInverseULongrowWithExcessSolver) using Csr = typename TestFixture::Csr; using UpperIsai = typename TestFixture::UpperIsai; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto upper_isai_factory = UpperIsai::build() .with_excess_solver_factory(this->excess_solver_factory) @@ -1223,6 +1228,7 @@ TYPED_TEST(Isai, ReturnsCorrectInverseSpdLongrow) { using Csr = typename TestFixture::Csr; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); const auto isai = this->spd_isai_factory->generate(this->spd_csr_longrow); const auto expected_transpose = gko::as(this->spd_csr_longrow_inv->transpose()); @@ -1246,6 +1252,7 @@ TYPED_TEST(Isai, ReturnsCorrectInverseSpdLongrowWithExcessSolver) using Csr = typename TestFixture::Csr; using SpdIsai = typename TestFixture::SpdIsai; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); const auto expected_transpose = gko::as(this->spd_csr_longrow_inv->transpose()); auto spd_isai_factory = diff --git a/reference/test/preconditioner/jacobi_kernels.cpp b/reference/test/preconditioner/jacobi_kernels.cpp index 9a2d3411cbb..4f755c35e0e 100644 --- a/reference/test/preconditioner/jacobi_kernels.cpp +++ b/reference/test/preconditioner/jacobi_kernels.cpp @@ -594,11 +594,14 @@ TYPED_TEST(Jacobi, SelectsCorrectBlockPrecisions) auto prec = bj->get_parameters().storage_optimization.block_wise.get_const_data(); - auto precision2 = std::is_same, float>::value - ? gko::precision_reduction(0, 0) // float - : gko::precision_reduction(0, 1); // double - EXPECT_EQ(prec[0], gko::precision_reduction(0, 2)); // u * cond = ~1.2e-3 - ASSERT_EQ(prec[1], precision2); // u * cond = ~2.0e-3 + auto precision1 = std::is_same, gko::half>::value + ? gko::precision_reduction(2, 0) + : gko::precision_reduction(0, 2); + auto precision2 = std::is_same, double>::value + ? gko::precision_reduction(0, 1) // double + : gko::precision_reduction(0, 0); // float, half + EXPECT_EQ(prec[0], precision1); // u * cond = ~1.2e-3 + ASSERT_EQ(prec[1], precision2); // u * cond = ~2.0e-3 } @@ -639,6 +642,9 @@ TYPED_TEST(Jacobi, AvoidsPrecisionsThatOverflow) auto precision = std::is_same, float>::value ? gko::precision_reduction(0, 2) // float : gko::precision_reduction(1, 1); // double + if (std::is_same, gko::half>::value) { + precision = gko::precision_reduction(2, 0); + } EXPECT_EQ(prec[0], precision); ASSERT_EQ(prec[1], precision); } diff --git a/reference/test/reorder/scaled_reordered.cpp b/reference/test/reorder/scaled_reordered.cpp index baeb1cf005d..3ebcaaf5506 100644 --- a/reference/test/reorder/scaled_reordered.cpp +++ b/reference/test/reorder/scaled_reordered.cpp @@ -396,6 +396,8 @@ TYPED_TEST(ScaledReordered, AppliesWithRcmReordering) TYPED_TEST(ScaledReordered, SolvesSingleRhsWithOnlyInnerOperator) { using SR = typename TestFixture::SR; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto scaled_reordered_fact = SR::build().with_inner_operator(this->solver_factory).on(this->exec); auto scaled_reordered = scaled_reordered_fact->generate(this->rcm_mtx); @@ -442,6 +444,8 @@ TYPED_TEST(ScaledReordered, SolvesSingleRhsWithColScaling) TYPED_TEST(ScaledReordered, SolvesSingleRhsWithRcmReordering) { using SR = typename TestFixture::SR; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto scaled_reordered_fact = SR::build() .with_reordering(this->rcm_factory) .with_inner_operator(this->solver_factory) @@ -478,6 +482,7 @@ TYPED_TEST(ScaledReordered, SolvesSingleRhsWithScalingAndRcmReorderingMixed) using SR = typename TestFixture::SR; using T = typename TestFixture::value_type; using Vec = gko::matrix::Dense>; + SKIP_IF_HALF(T); auto scaled_reordered_fact = SR::build() .with_row_scaling(this->diag2) .with_col_scaling(this->diag3) @@ -499,6 +504,8 @@ TYPED_TEST(ScaledReordered, AdvancedSolvesSingleRhsWithScalingAndRcmReordering) { using SR = typename TestFixture::SR; using Vec = typename TestFixture::Vec; + using T = typename TestFixture::value_type; + SKIP_IF_HALF(T); const auto alpha = gko::initialize({2.0}, this->exec); const auto beta = gko::initialize({-1.0}, this->exec); auto scaled_reordered_fact = SR::build() @@ -523,6 +530,7 @@ TYPED_TEST(ScaledReordered, using T = typename TestFixture::value_type; using value_type = next_precision; using Vec = gko::matrix::Dense; + SKIP_IF_HALF(T); auto scaled_reordered_fact = SR::build() .with_row_scaling(this->diag2) .with_col_scaling(this->diag3) diff --git a/reference/test/solver/bicgstab_kernels.cpp b/reference/test/solver/bicgstab_kernels.cpp index 56e11dd84bc..9b0ea1f6c80 100644 --- a/reference/test/solver/bicgstab_kernels.cpp +++ b/reference/test/solver/bicgstab_kernels.cpp @@ -528,7 +528,7 @@ TYPED_TEST(Bicgstab, SolvesDenseSystemUsingAdvancedApply) solver->apply(alpha, b, beta, x); - GKO_ASSERT_MTX_NEAR(x, l({-8.5, -3.0, 6.0}), r::value); + GKO_ASSERT_MTX_NEAR(x, l({-8.5, -3.0, 6.0}), 2 * r::value); } @@ -545,7 +545,7 @@ TYPED_TEST(Bicgstab, SolvesDenseSystemUsingAdvancedApplyMixed) solver->apply(alpha, b, beta, x); GKO_ASSERT_MTX_NEAR(x, l({-8.5, -3.0, 6.0}), - (r_mixed())); + (2 * r_mixed())); } @@ -561,14 +561,14 @@ TYPED_TEST(Bicgstab, SolvesDenseSystemUsingAdvancedApplyComplex) {value_type{-1.0, 2.0}, value_type{3.0, -6.0}, value_type{1.0, -2.0}}, this->exec); auto x = gko::initialize( - {value_type{0.5, -1.0}, value_type{1.0, -2.0}, value_type{2.0, -4.0}}, + {value_type{0.5, -0.5}, value_type{1.0, 0.5}, value_type{2.0, -1.0}}, this->exec); solver->apply(alpha, b, beta, x); GKO_ASSERT_MTX_NEAR(x, - l({value_type{-8.5, 17.0}, value_type{-3.0, 6.0}, - value_type{6.0, -12.0}}), + l({value_type{-8.5, 16.5}, value_type{-3.0, 3.5}, + value_type{6.0, -15.0}}), r::value); } @@ -586,14 +586,14 @@ TYPED_TEST(Bicgstab, SolvesDenseSystemUsingAdvancedApplyMixedComplex) {value_type{-1.0, 2.0}, value_type{3.0, -6.0}, value_type{1.0, -2.0}}, this->exec); auto x = gko::initialize( - {value_type{0.5, -1.0}, value_type{1.0, -2.0}, value_type{2.0, -4.0}}, + {value_type{0.5, -0.5}, value_type{1.0, 0.5}, value_type{2.0, -1.0}}, this->exec); solver->apply(alpha, b, beta, x); GKO_ASSERT_MTX_NEAR(x, - l({value_type{-8.5, 17.0}, value_type{-3.0, 6.0}, - value_type{6.0, -12.0}}), + l({value_type{-8.5, 16.5}, value_type{-3.0, 3.5}, + value_type{6.0, -15.0}}), (r_mixed())); } @@ -624,6 +624,7 @@ TYPED_TEST(Bicgstab, SolvesBigDenseSystemForDivergenceCheck1) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, @@ -652,6 +653,7 @@ TYPED_TEST(Bicgstab, SolvesBigDenseSystemForDivergenceCheck2) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, @@ -681,6 +683,7 @@ TYPED_TEST(Bicgstab, SolvesMultipleDenseSystemsDivergenceCheck) using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; using T = value_type; + SKIP_IF_HALF(value_type); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, {-8.0, -66.0, 29.0, -96.0, -95.0, -14.0}, diff --git a/reference/test/solver/cgs_kernels.cpp b/reference/test/solver/cgs_kernels.cpp index 6f9c821025d..74bf08d08e8 100644 --- a/reference/test/solver/cgs_kernels.cpp +++ b/reference/test/solver/cgs_kernels.cpp @@ -445,6 +445,8 @@ TYPED_TEST(Cgs, SolvesDenseSystemUsingAdvancedApplyComplex) using Scalar = typename TestFixture::Mtx; using Mtx = gko::to_complex; using value_type = typename Mtx::value_type; + // different initial guess leads complex divergent. + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -470,6 +472,8 @@ TYPED_TEST(Cgs, SolvesDenseSystemUsingAdvancedApplyMixedComplex) gko::matrix::Dense>; using Mtx = gko::to_complex; using value_type = typename Mtx::value_type; + // different initial guess leads complex divergent. + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -514,6 +518,7 @@ TYPED_TEST(Cgs, SolvesBigDenseSystem1) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big->generate(this->mtx_big); auto b = gko::initialize( {764.0, -4032.0, -11855.0, 7111.0, -12765.0, -4589}, this->exec); @@ -530,6 +535,7 @@ TYPED_TEST(Cgs, SolvesBigDenseSystemWithImplicitResNormCrit) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big2->generate(this->mtx_big); auto b = gko::initialize( {17356.0, 5466.0, 748.0, -456.0, 3434.0, -7020.0}, this->exec); @@ -546,6 +552,7 @@ TYPED_TEST(Cgs, SolvesBigDenseSystem2) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big->generate(this->mtx_big); auto b = gko::initialize( {17356.0, 5466.0, 748.0, -456.0, 3434.0, -7020.0}, this->exec); @@ -562,6 +569,7 @@ TYPED_TEST(Cgs, SolvesMultipleDenseSystems) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big->generate(this->mtx_big); auto b1 = gko::initialize( {764.0, -4032.0, -11855.0, 7111.0, -12765.0, -4589}, this->exec); @@ -628,6 +636,7 @@ TYPED_TEST(Cgs, SolvesTransposedBigDenseSystem) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big->generate(this->mtx_big->transpose()); auto b = gko::initialize( {764.0, -4032.0, -11855.0, 7111.0, -12765.0, -4589}, this->exec); @@ -644,6 +653,7 @@ TYPED_TEST(Cgs, SolvesConjTransposedBigDenseSystem) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->cgs_factory_big->generate(this->mtx_big->conj_transpose()); auto b = gko::initialize( diff --git a/reference/test/solver/gmres_kernels.cpp b/reference/test/solver/gmres_kernels.cpp index 002245c523c..e34ffc95e23 100644 --- a/reference/test/solver/gmres_kernels.cpp +++ b/reference/test/solver/gmres_kernels.cpp @@ -724,6 +724,7 @@ TYPED_TEST(Gmres, SolvesBigDenseSystem1WithRestart) using Mtx = typename TestFixture::Mtx; using Solver = typename TestFixture::Solver; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); auto gmres_factory_restart = Solver::build() diff --git a/reference/test/solver/idr_kernels.cpp b/reference/test/solver/idr_kernels.cpp index a1154ccb598..2dcb35c84d8 100644 --- a/reference/test/solver/idr_kernels.cpp +++ b/reference/test/solver/idr_kernels.cpp @@ -102,6 +102,9 @@ TYPED_TEST(Idr, SolvesDenseSystem) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto solver = this->idr_factory->generate(this->mtx); auto b = gko::initialize({-1.0, 3.0, 1.0}, this->exec); auto x = gko::initialize({0.0, 0.0, 0.0}, this->exec); @@ -114,8 +117,12 @@ TYPED_TEST(Idr, SolvesDenseSystem) TYPED_TEST(Idr, SolvesDenseSystemMixed) { - using value_type = next_precision; + using T = typename TestFixture::value_type; + using value_type = next_precision; using Mtx = gko::matrix::Dense; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto solver = this->idr_factory->generate(this->mtx); auto b = gko::initialize({-1.0, 3.0, 1.0}, this->exec); auto x = gko::initialize({0.0, 0.0, 0.0}, this->exec); @@ -129,8 +136,12 @@ TYPED_TEST(Idr, SolvesDenseSystemMixed) TYPED_TEST(Idr, SolvesDenseSystemComplex) { + using T = typename TestFixture::value_type; using Mtx = gko::to_complex; using value_type = typename Mtx::value_type; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto solver = this->idr_factory->generate(this->mtx); auto b = gko::initialize( {value_type{-1.0, 2.0}, value_type{3.0, -6.0}, value_type{1.0, -2.0}}, @@ -150,9 +161,12 @@ TYPED_TEST(Idr, SolvesDenseSystemComplex) TYPED_TEST(Idr, SolvesDenseSystemMixedComplex) { - using value_type = - gko::to_complex>; + using T = typename TestFixture::value_type; + using value_type = gko::to_complex>; using Mtx = gko::matrix::Dense; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto solver = this->idr_factory->generate(this->mtx); auto b = gko::initialize( {value_type{-1.0, 2.0}, value_type{3.0, -6.0}, value_type{1.0, -2.0}}, @@ -175,6 +189,8 @@ TYPED_TEST(Idr, SolvesDenseSystemWithComplexSubSpace) using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; using Solver = typename TestFixture::Solver; + // intermediate value is too small to represent in half + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); auto solver_factory = Solver::build() @@ -204,6 +220,7 @@ TYPED_TEST(Idr, SolvesMultipleDenseSystems) using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; using T = value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); auto solver = this->idr_factory->generate(this->mtx); auto b = gko::initialize( @@ -224,6 +241,7 @@ TYPED_TEST(Idr, SolvesMultipleDenseSystemsWithComplexSubspace) using value_type = typename TestFixture::value_type; using T = value_type; using Solver = typename TestFixture::Solver; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); auto solver_factory = Solver::build() @@ -255,6 +273,7 @@ TYPED_TEST(Idr, SolvesDenseSystemUsingAdvancedApply) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto solver = this->idr_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -271,6 +290,7 @@ TYPED_TEST(Idr, SolvesDenseSystemUsingAdvancedApplyMixed) { using value_type = next_precision; using Mtx = gko::matrix::Dense; + SKIP_IF_HALF(typename TestFixture::value_type); auto solver = this->idr_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -289,6 +309,7 @@ TYPED_TEST(Idr, SolvesDenseSystemUsingAdvancedApplyComplex) using Scalar = typename TestFixture::Mtx; using Mtx = gko::to_complex; using value_type = typename Mtx::value_type; + SKIP_IF_HALF(value_type); auto solver = this->idr_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -314,6 +335,7 @@ TYPED_TEST(Idr, SolvesDenseSystemUsingAdvancedApplyMixedComplex) gko::matrix::Dense>; using Mtx = gko::to_complex; using value_type = typename Mtx::value_type; + SKIP_IF_HALF(value_type); auto solver = this->idr_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); auto beta = gko::initialize({-1.0}, this->exec); @@ -338,6 +360,7 @@ TYPED_TEST(Idr, SolvesMultipleDenseSystemsUsingAdvancedApply) using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; using T = value_type; + SKIP_IF_HALF(T); auto half_tol = std::sqrt(r::value); auto solver = this->idr_factory->generate(this->mtx); auto alpha = gko::initialize({2.0}, this->exec); @@ -359,6 +382,7 @@ TYPED_TEST(Idr, SolvesBigDenseSystemForDivergenceCheck1) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, @@ -395,6 +419,7 @@ TYPED_TEST(Idr, SolvesBigDenseSystemForDivergenceCheck2) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto half_tol = std::sqrt(r::value); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, @@ -424,6 +449,7 @@ TYPED_TEST(Idr, SolvesMultipleDenseSystemsDivergenceCheck) using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; using T = value_type; + SKIP_IF_HALF(value_type); std::shared_ptr locmtx = gko::initialize({{-19.0, 47.0, -41.0, 35.0, -21.0, 71.0}, {-8.0, -66.0, 29.0, -96.0, -95.0, -14.0}, @@ -500,6 +526,9 @@ TYPED_TEST(Idr, SolvesTransposedDenseSystem) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto half_tol = std::sqrt(r::value); auto solver = this->idr_factory->generate(this->mtx->transpose()); auto b = gko::initialize({-1.0, 3.0, 1.0}, this->exec); @@ -515,6 +544,9 @@ TYPED_TEST(Idr, SolvesConjTransposedDenseSystem) { using Mtx = typename TestFixture::Mtx; using value_type = typename TestFixture::value_type; + if (std::is_same>::value) { + GTEST_SKIP() << "Skip due to complex half mode"; + } auto half_tol = std::sqrt(r::value); auto solver = this->idr_factory->generate(this->mtx->conj_transpose()); auto b = gko::initialize({-1.0, 3.0, 1.0}, this->exec); diff --git a/test/factorization/par_ic_kernels.cpp b/test/factorization/par_ic_kernels.cpp index 25c7c6450af..62751309f08 100644 --- a/test/factorization/par_ic_kernels.cpp +++ b/test/factorization/par_ic_kernels.cpp @@ -73,8 +73,7 @@ class ParIc : public CommonTestFixture { mtx_l = gko::test::generate_random_lower_triangular_matrix( mtx_size[0], false, std::uniform_int_distribution(10, mtx_size[0]), - std::normal_distribution<>(0, 10.0), - rand_engine, ref); + std::normal_distribution<>(0, 10.0), rand_engine, ref); dmtx_ani = Csr::create(exec); dmtx_l_ani = Csr::create(exec); dmtx_l_ani_init = Csr::create(exec); @@ -139,6 +138,8 @@ TYPED_TEST(ParIc, KernelComputeFactorIsEquivalentToRef) { using Csr = typename TestFixture::Csr; using Coo = typename TestFixture::Coo; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto square_size = this->mtx_ani->get_size(); auto mtx_l_coo = Coo::create(this->ref, square_size); this->mtx_l_ani->convert_to(mtx_l_coo); diff --git a/test/factorization/par_ict_kernels.cpp b/test/factorization/par_ict_kernels.cpp index 514abf1bbe3..c379324172f 100644 --- a/test/factorization/par_ict_kernels.cpp +++ b/test/factorization/par_ict_kernels.cpp @@ -155,6 +155,8 @@ TYPED_TEST(ParIct, KernelComputeFactorIsEquivalentToRef) { using Csr = typename TestFixture::Csr; using Coo = typename TestFixture::Coo; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto square_size = this->mtx_ani->get_size(); auto mtx_l_coo = Coo::create(this->ref, square_size); this->mtx_l_ani->convert_to(mtx_l_coo); diff --git a/test/factorization/par_ilu_kernels.cpp b/test/factorization/par_ilu_kernels.cpp index 480f62057b8..22f4b740fd7 100644 --- a/test/factorization/par_ilu_kernels.cpp +++ b/test/factorization/par_ilu_kernels.cpp @@ -90,8 +90,7 @@ class ParIlu : public CommonTestFixture { return gko::test::generate_random_matrix( num_rows, num_cols, std::uniform_int_distribution(0, num_cols - 1), - std::normal_distribution<>(0.0, 1.0), - rand_engine, ref); + std::normal_distribution<>(0.0, 1.0), rand_engine, ref); } std::unique_ptr gen_unsorted_mtx(index_type num_rows, @@ -277,6 +276,8 @@ TYPED_TEST(ParIlu, KernelInitializeParILUIsEquivalentToRef) TYPED_TEST(ParIlu, KernelComputeParILUIsEquivalentToRef) { using Csr = typename TestFixture::Csr; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); std::unique_ptr l_mtx{}; std::unique_ptr u_mtx{}; std::unique_ptr dl_mtx{}; @@ -295,6 +296,7 @@ TYPED_TEST(ParIlu, KernelComputeParILUWithMoreIterationsIsEquivalentToRef) { using Csr = typename TestFixture::Csr; using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); std::unique_ptr l_mtx{}; std::unique_ptr u_mtx{}; std::unique_ptr dl_mtx{}; diff --git a/test/factorization/par_ilut_kernels.cpp b/test/factorization/par_ilut_kernels.cpp index b664b4c4108..2bd53c19717 100644 --- a/test/factorization/par_ilut_kernels.cpp +++ b/test/factorization/par_ilut_kernels.cpp @@ -396,6 +396,8 @@ TYPED_TEST(ParIlut, KernelAddCandidatesIsEquivalentToRef) { using Csr = typename TestFixture::Csr; using value_type = typename TestFixture::value_type; + // there's one value larger than half range + SKIP_IF_HALF(value_type); auto square_size = this->mtx_square->get_size(); auto mtx_lu = Csr::create(this->ref, square_size); this->mtx_l2->apply(this->mtx_u, mtx_lu); @@ -424,6 +426,8 @@ TYPED_TEST(ParIlut, KernelComputeLUIsEquivalentToRef) { using Csr = typename TestFixture::Csr; using Coo = typename TestFixture::Coo; + using value_type = typename TestFixture::value_type; + SKIP_IF_HALF(value_type); auto square_size = this->mtx_ani->get_size(); auto mtx_l_coo = Coo::create(this->ref, square_size); auto mtx_u_coo = Coo::create(this->ref, square_size);