Skip to content

Commit

Permalink
Enable dpcpp batch_richardson tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Mar 26, 2023
1 parent 661210e commit 28907ce
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions test/solver/batch_richardson_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "test/utils/executor.hpp"


#ifndef GKO_COMPILING_DPCPP


namespace {


class BatchRich : public CommonTestFixture {
protected:
using real_type = gko::remove_complex<value_type>;
Expand Down Expand Up @@ -139,7 +133,8 @@ TEST_F(BatchRich, SolvesStencilSystemJacobi)
using T = value_type;
auto r_1 = gko::test::solve_poisson_uniform(
exec, solve_fn, opts_1, sys_1, 1,
gko::preconditioner::BatchJacobi<T>::build().on(exec));
gko::preconditioner::BatchJacobi<T>::build().with_max_block_size(1u).on(
exec));

for (size_t i = 0; i < nbatch; i++) {
ASSERT_LE(r_1.resnorm->get_const_values()[i] /
Expand Down Expand Up @@ -186,10 +181,12 @@ TEST_F(BatchRich, BetterRelaxationFactorGivesBetterConvergence)

auto result1 = gko::test::solve_poisson_uniform(
exec, solve_fn, opts, sys_1, 1,
gko::preconditioner::BatchJacobi<T>::build().on(exec));
gko::preconditioner::BatchJacobi<T>::build().with_max_block_size(1u).on(
exec));
auto result2 = gko::test::solve_poisson_uniform(
exec, solve_fn, opts_slower, sys_1, 1,
gko::preconditioner::BatchJacobi<T>::build().on(exec));
gko::preconditioner::BatchJacobi<T>::build().with_max_block_size(1u).on(
exec));

const int* const iter_arr1 = result1.logdata.iter_counts.get_const_data();
const int* const iter_arr2 = result2.logdata.iter_counts.get_const_data();
Expand All @@ -208,7 +205,9 @@ TEST_F(BatchRich, CoreSolvesSystemJacobi)
.with_default_max_iterations(100)
.with_default_residual_tol(5e-7f)
.with_preconditioner(
gko::preconditioner::BatchJacobi<value_type>::build().on(exec))
gko::preconditioner::BatchJacobi<value_type>::build()
.with_max_block_size(1u)
.on(exec))
.with_tolerance_type(gko::stop::batch::ToleranceType::relative)
.on(exec);
const int nrhs_1 = 1;
Expand Down Expand Up @@ -250,10 +249,12 @@ TEST_F(BatchRich, UnitScalingDoesNotChangeResult)
gko::share(gko::batch_initialize<BDiag>(nbatch, {1.0, 1.0, 1.0}, exec));
auto right_scale =
gko::share(gko::batch_initialize<BDiag>(nbatch, {1.0, 1.0, 1.0}, exec));
auto factory = create_factory(
exec, opts_1,
gko::preconditioner::BatchJacobi<value_type>::build().on(exec),
left_scale, right_scale);
auto factory =
create_factory(exec, opts_1,
gko::preconditioner::BatchJacobi<value_type>::build()
.with_max_block_size(1u)
.on(exec),
left_scale, right_scale);

auto result = gko::test::solve_poisson_uniform_core<solver_type>(
exec, factory.get(), sys_1, 1);
Expand All @@ -268,9 +269,11 @@ TEST_F(BatchRich, GeneralScalingDoesNotChangeResult)
gko::batch_initialize<BDiag>({{0.8, 0.9, 0.95}, {1.1, 3.2, 0.9}}, exec);
auto right_scale =
gko::batch_initialize<BDiag>(nbatch, {1.0, 1.5, 1.05}, exec);
auto factory = create_factory(
exec, opts_1,
gko::preconditioner::BatchJacobi<value_type>::build().on(exec));
auto factory =
create_factory(exec, opts_1,
gko::preconditioner::BatchJacobi<value_type>::build()
.with_max_block_size(1u)
.on(exec));

auto result = gko::test::solve_poisson_uniform_core<solver_type>(
exec, factory.get(), sys_1, 1);
Expand All @@ -296,15 +299,11 @@ TEST_F(BatchRich, CanSolveCsrSystemWithoutScaling)
.with_default_residual_tol(tol)
.with_relaxation_factor(RT{0.95})
.with_tolerance_type(gko::stop::batch::ToleranceType::relative)
.with_preconditioner(
gko::preconditioner::BatchJacobi<T>::build().on(exec))
.with_preconditioner(gko::preconditioner::BatchJacobi<T>::build()
.with_max_block_size(1u)
.on(exec))
.on(exec);

gko::test::test_solve<Solver, Csr>(exec, nbatch, nrows, nrhs, 10 * tol,
maxits, batchrich_factory.get(), 2);
}

} // namespace


#endif

0 comments on commit 28907ce

Please sign in to comment.